Skip to content

About

Elixir client on :httpc and built-in JSON for live web search and Markdown page extraction in Phoenix and LiveView AI apps. Drop-in Google CSE, Bing v7, Tavily and Exa routes. $1 per 1,000 searches.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elixir client for live web search and page extraction in Phoenix and LiveView apps

An Elixir client on Erlang's :httpc and Elixir's built-in JSON, with no dependency, for SpecStream, the live web data engine. Ground a Phoenix or LiveView AI feature in the live web: ranked search results, the main text of any page, PDF or Office file as Markdown, and the drop-in routes that speak Google Custom Search, Bing Web Search v7, Tavily and Exa in their own reply shapes. Needs Elixir 1.18 or later.

Function Route on https://api.specstream.ai Key goes Returns
web_search/2 GET /v1/web-search Authorization: Bearer {:ok, sources}
extract/2 POST /v1/extract Authorization: Bearer {:ok, pages}, text as Markdown
google_cse/2 GET /customsearch/v1 key= in the address {:ok, %{"items" => ...}}
bing/2 GET /v7.0/search Ocp-Apim-Subscription-Key {:ok, %{"webPages" => ...}}
tavily/2 POST /tavily/search Authorization: Bearer {:ok, %{"results" => ...}}
exa/2 POST /exa/search x-api-key {:ok, %{"results" => ...}}

Every search runs on the fast tier: $1 per 1,000 searches, 937 ms median over 6,548 live calls in the 7 days to December 1, 2026. SpecStream is first on WideSearch and scores 99 on SimpleQA Verified.

Run

git clone https://github.com/specstream/elixir-specstream-search
cd elixir-specstream-search
mix specstream check          # live, no key, nothing charged
mix test                      # live, no key
API reachable: 70 drop-in APIs on 78 routes at https://api.specstream.ai
  Google Custom Search JSON API    replaces https://www.googleapis.com
  Tavily                           replaces https://api.tavily.com
  Exa                              replaces https://api.exa.ai
  Bing Web Search API v7           replaces https://api.bing.microsoft.com/v7.0/search
  ready list:    204755 rows  /data/nonprofits/california

Get a key under Agents & API at specstream.ai/workspace. A new account gets $2 of credit with no card, which is 2,000 fast searches.

export SPECSTREAM_API_KEY=your_key
mix specstream search "Phoenix LiveView 1.0 release"
mix specstream extract https://hexdocs.pm/phoenix_live_view/welcome.html
mix specstream bing "best crm for startups"

In your app

# mix.exs
{:specstream, github: "specstream/elixir-specstream-search"}
{:ok, sources} = SpecStream.web_search("latest PostgreSQL release notes")
for s <- sources, do: IO.puts("#{s["title"]} #{s["url"]}")

{:ok, [page | _]} = SpecStream.extract(["https://www.postgresql.org/docs/release/"])
page["text"] # Markdown, also from PDFs and Office files

In a LiveView, search off the socket process and show results as they land:

def handle_event("ask", %{"q" => q}, socket) do
  {:noreply, start_async(socket, :search, fn -> SpecStream.web_search(q, num: 8) end)}
end

def handle_async(:search, {:ok, {:ok, sources}}, socket),
  do: {:noreply, assign(socket, sources: sources)}

def handle_async(:search, {:ok, {:error, reason}}, socket),
  do: {:noreply, put_flash(socket, :error, "Search failed: #{inspect(reason)}")}

Pass api_key: on any call to use a key per tenant; without it the client reads SPECSTREAM_API_KEY. TLS verifies the server against the operating system's CA store. A reply outside 2xx is {:error, {:http, status, body}} with the body decoded in that route's own error shape, and a missing or null list reads as [].

Moving code you already have

- https://www.googleapis.com/customsearch/v1?key=GOOGLE_KEY&cx=CX&q=...
+ https://api.specstream.ai/customsearch/v1?key=SPECSTREAM_KEY&q=...
- https://api.bing.microsoft.com/v7.0/search
+ https://api.specstream.ai/v7.0/search
- https://api.tavily.com/search
+ https://api.specstream.ai/tavily/search

Google ends the Custom Search JSON API on January 1, 2027, and Microsoft retired the Bing Search APIs in August 2025; both requests answer here unchanged. SpecStream.dialects/0 lists all 70 APIs SpecStream answers, live.

Prices

Price
Free credit on sign-up $2, which is 2,000 fast searches, no card
Fast search, every drop-in route $1 per 1,000
Extract API, page text as Markdown $0.80 per 1,000 pages
Monthly Pro Pass $49 a month: 5,000 ready list rows a month and $49 of API credit

Links

License

MIT

About

Elixir client on :httpc and built-in JSON for live web search and Markdown page extraction in Phoenix and LiveView AI apps. Drop-in Google CSE, Bing v7, Tavily and Exa routes. $1 per 1,000 searches.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages