Skip to content

About

Move from Serper to SpecStream in one line: the same paths, JSON body, X-API-KEY header and organic results. Python, Node and cURL, tested on a local mock and the live route.

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

Move from Serper to SpecStream in one line

Keep your Serper code. Change the base URL from https://google.serper.dev to https://api.specstream.ai/serper and put a SpecStream key in the X-API-KEY header. The paths, the JSON body and the reply stay Serper's own.

- https://google.serper.dev/search
+ https://api.specstream.ai/serper/search

SpecStream is the live web data engine: first on WideSearch and 99 on SimpleQA Verified (benchmarks). Every Serper call runs on its fast tier, at a 937 ms median over 6,548 live calls in the 7 days to December 1, 2026, for $1 per 1,000 calls.

cURL

curl https://api.specstream.ai/serper/search \
  -H "X-API-KEY: $SPECSTREAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q": "best crm for dental clinics", "num": 10, "page": 1}'

Python

import os, requests

r = requests.post(
    "https://api.specstream.ai/serper/search",          # was https://google.serper.dev/search
    headers={"X-API-KEY": os.environ["SPECSTREAM_API_KEY"]},
    json={"q": "best crm for dental clinics", "num": 10},
)
for result in r.json()["organic"]:
    print(result["position"], result["title"], result["link"])

python/serper_search.py is the same call with the standard library only, Serper's errors and a command line:

export SPECSTREAM_API_KEY=your_key
python python/serper_search.py "best crm for dental clinics"

Node

const res = await fetch('https://api.specstream.ai/serper/search', {   // was https://google.serper.dev/search
  method: 'POST',
  headers: { 'X-API-KEY': process.env.SPECSTREAM_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({ q: 'best crm for dental clinics', num: 10 }),
})
const { organic } = await res.json()
for (const r of organic) console.log(r.position, r.title, r.link)

node/serperSearch.mjs is the same with Serper's errors, for Node 18 and later, with no dependencies.

What carries over

Serper On SpecStream
POST /search, and GET with apiKey in the address POST /serper/search and GET /serper/search
POST /news and POST /images /serper/news and /serper/images
q, num (1 to 100), page, gl, hl, tbs (qdr:d, qdr:w, cdr:1,cd_min:...), location, autocorrect the same, sent as JSON or in the query string as LangChain sends them
organic[] with title, link, snippet, position, date; answerBox; searchParameters; credits the same
Errors as {"message", "statusCode"} the same shape

Each reply also carries a specstream object with the request_id and the price_usd of the call, and answerBox holds the direct answer with its page when the pages give one.

Prices

Price
A Serper call with up to 10 results $0.001, which is $1 per 1,000
Each started block of 10 more results $0.0012 more: num=100 is $0.0118
Free credit on sign up $2, which is 2,000 fast searches, no card
Monthly Pro Pass $49 a month: 5,000 ready list rows a month and $49 of API credit

The default search tier is $5 per 1,000 on /v1/web-search, and the Extract API reads any page as Markdown for $0.80 per 1,000 pages.

Check it without a key

python check_live.py
https://api.specstream.ai/serper replaces https://google.serper.dev, key in the X-API-KEY header
no key       401 missing_api_key: Missing API key. Send your SpecStream API key in an X-API-KEY header. Get a key at https:/
made up key  401 invalid_token: SpecStream didn't accept this API key or token. Create a key under Agents & API, or connec
The route answers in Serper's own shape. Set SPECSTREAM_API_KEY to search.

A call with no key or a made up key is refused before any search runs, so the check spends nothing.

Test

python -m unittest discover -s tests -v
node --test node/test.mjs

The tests run against a local stand-in for the route, with missing, null and empty fields, so they need no key and spend nothing.

Links

License

MIT

About

Move from Serper to SpecStream in one line: the same paths, JSON body, X-API-KEY header and organic results. Python, Node and cURL, tested on a local mock and the live route.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages