Skip to content

About

Zero dependency Node 22+ TypeScript client for the Tavily, Exa, Serper, SerpApi, Firecrawl, Google CSE and Bing v7 drop-in routes of SpecStream: $1 per 1,000 searches at a 937 ms median.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

One TypeScript client for seven search APIs, on SpecStream

A zero dependency Node 22+ TypeScript client that sends Tavily, Exa, Serper, SerpApi, Firecrawl, Google Custom Search and Bing Web Search v7 requests to SpecStream, the live web data engine, which answers each in that API's own JSON. Keep the code you wrote for the old API, or call search() and get the same { title, url, snippet, published } from any of them.

SpecStream answers 70 drop-in APIs on 78 routes. Every drop-in search runs the fast tier: $1 per 1,000 searches at a 937 ms median, first on WideSearch and 99 on SimpleQA Verified (benchmarks).

You call Method Route on https://api.specstream.ai Key goes in
Tavily tavilySearch(query, maxResults) POST /tavily/search Bearer token
Exa exaSearch(query, numResults), exaContents(urls) POST /exa/search, POST /exa/contents x-api-key
Serper serperSearch(q, num, page) POST /serper/search X-API-KEY
SerpApi serpapiSearch(q, num, start) GET /serpapi/search.json?engine=google api_key
Firecrawl v2 firecrawlSearch(query, limit), firecrawlScrape(url) POST /firecrawl/v2/search, POST /firecrawl/v2/scrape Bearer token
Google Custom Search googleSearch(q, num, start) GET /customsearch/v1 X-Goog-Api-Key
Bing Web Search v7 bingSearch(q, count, offset) GET /v7.0/search Ocp-Apim-Subscription-Key
SpecStream webSearch(q, num), extract(urls) GET /v1/web-search?speed=fast, POST /v1/extract Bearer token

Google closes its Custom Search JSON API to existing customers on January 1, 2027, and Microsoft retired the Bing Search APIs in August 2025: their routes here run on SpecStream with no other change.

Run

Get a key under Agents & API at specstream.ai/workspace. New accounts get $2 of free credit, which is 2,000 fast searches, with no card.

git clone https://github.com/specstream/node-typescript-specstream-dropin
cd node-typescript-specstream-dropin

node examples/live-check.ts        # live and free: all 8 routes answer that they need a key
export SPECSTREAM_API_KEY=your_key
node examples/search.ts "who makes the fastest vector database" --via tavily
node examples/search.ts "who makes the fastest vector database" --via bing

Node 22.18 and later run .ts files as they are. On Node 22.6 to 22.17, add --experimental-strip-types.

ok  specstream HTTP 401: SpecStream didn't accept this API key or token. Create a key under Agents & API,
ok  tavily     HTTP 401: Missing API key. Send your SpecStream API key in an Authorization: Bearer header
ok  exa        HTTP 401: Missing API key. Send your SpecStream API key in an x-api-key header. Get a key
ok  serper     HTTP 401: Missing API key. Send your SpecStream API key in an X-API-KEY header. Get a key
...

In your code

Copy src/specstream-dropin.ts into your project; it has no dependencies.

import { SpecStream } from "./specstream-dropin.ts";

const client = new SpecStream();                      // reads SPECSTREAM_API_KEY

const tavily = await client.tavilySearch("EU AI Act guidance for SaaS", 5);
console.log(tavily.results[0].url);                   // Tavily's own shape

const results = await client.search("EU AI Act guidance for SaaS", "google");
console.log(results[0]);                              // { title, url, snippet, published }

const [page] = await client.extract(["https://specstream.ai/pricing"]);
console.log(page.markdown);                           // $0.80 per 1,000 pages

Errors throw SpecStreamError with the HTTP status and the message read from that API's own error shape.

With the official SDKs instead

// Exa (exa-js): new Exa(key, "https://api.specstream.ai/compat/exa")
// Firecrawl (@mendable/firecrawl-js): new Firecrawl({ apiKey: key, apiUrl: "https://api.specstream.ai" })
// Bing: any client whose endpoint is https://api.specstream.ai

With a made up key, exa-js 2.29.0 and @mendable/firecrawl-js 4.57.0 set this way both reach SpecStream and get its 401, so a real key is the only change left.

Test

npm test                 # node --test, offline, against a local fake of every route with null and empty fields

The tests also pass on Node 22.6.0 with --experimental-strip-types, and tsc --noEmit passes in strict mode with erasableSyntaxOnly.

Links

License

MIT

About

Zero dependency Node 22+ TypeScript client for the Tavily, Exa, Serper, SerpApi, Firecrawl, Google CSE and Bing v7 drop-in routes of SpecStream: $1 per 1,000 searches at a 937 ms median.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages