DEV Community

Tarek Etman for SpecStream

Posted on

Google Custom Search JSON API ends January 1, 2027: migration code for Python, Node and curl, with a price table

By Tarek Etman, Founder & CEO, SpecStream

Google's Custom Search JSON API stops working for everyone on January 1, 2027. If your code calls googleapis.com/customsearch/v1, you can move it to SpecStream by changing the host to api.specstream.ai and the key. The reply keeps Google's shape (items[].title, link, snippet, displayLink), so your parser stays as it is, and each call costs $1 per 1,000 instead of Google's $5.

Below is the code for both ways to move (keep Google's shape, or port to our native endpoint), in Python, Node and curl, then a price and latency table for the APIs people are moving to, and a small script to measure latency yourself.

What Google said

From the Custom Search JSON API overview page [1]:

"The Custom Search JSON API is closed to new customers. Vertex AI Search is a favorable alternative for searching up to 50 domains. [...] Existing Custom Search JSON API customers have until January 1, 2027 to transition to an alternative solution."

And on price:

"The following pricing applies only to existing Custom Search JSON API customers until the service discontinuation on January 1, 2027. This API is not available for new customers."

"Custom Search JSON API provides 100 search queries per day for free. If you need more, you may sign up for billing in the API Console. Additional requests cost $5 per 1000 queries, up to 10k queries per day."

The Programmable Search Engine blog post of January 20, 2026 [2] says the same: Vertex AI Search for up to 50 domains, and a transition "completed by January 1, 2027". If you search the whole web, Vertex AI Search with its 50 domain limit doesn't replace what you have.

Option 1: keep Google's request and reply

SpecStream answers Google's own path, GET /customsearch/v1, with q, num and start, and replies with items[] (title, link, snippet, displayLink), searchInformation.totalResults and queries.nextPage. The key can go in key=, in the X-Goog-Api-Key header or as a Bearer token. cx is accepted and ignored, so you can leave it in.

Each call on this route is one search on our fast tier: $0.001 for up to 10 results, $1 per 1,000.

Python (requests)

Before, Google:

import os
import requests

resp = requests.get(
    "https://www.googleapis.com/customsearch/v1",
    params={
        "key": os.environ["GOOGLE_API_KEY"],
        "cx": os.environ["GOOGLE_CSE_ID"],
        "q": "eu ai act enforcement date",
        "num": 10,
        "start": 1,
    },
    timeout=30,
)
resp.raise_for_status()
for item in resp.json().get("items", []):
    print(item["title"], item["link"], item["displayLink"], item["snippet"], sep="\n  ")
Enter fullscreen mode Exit fullscreen mode

After, SpecStream with Google's shape:

import os
import requests

resp = requests.get(
    "https://api.specstream.ai/customsearch/v1",
    params={
        "key": os.environ["SPECSTREAM_API_KEY"],
        "cx": os.environ["GOOGLE_CSE_ID"],  # accepted and ignored; delete it when you like
        "q": "eu ai act enforcement date",
        "num": 10,
        "start": 1,
    },
    timeout=30,
)
resp.raise_for_status()
for item in resp.json().get("items", []):
    print(item["title"], item["link"], item["displayLink"], item["snippet"], sep="\n  ")
Enter fullscreen mode Exit fullscreen mode

Only the host and the key changed. If your config holds the base URL, change https://www.googleapis.com (or https://customsearch.googleapis.com) to https://api.specstream.ai. To keep the key out of URL logs, send it in the X-Goog-Api-Key header instead of key=.

Node (fetch, Node 18+)

Before, Google:

const params = new URLSearchParams({
  key: process.env.GOOGLE_API_KEY,
  cx: process.env.GOOGLE_CSE_ID,
  q: "eu ai act enforcement date",
  num: "10",
  start: "1",
});

const res = await fetch(`https://www.googleapis.com/customsearch/v1?${params}`);
if (!res.ok) throw new Error(`search failed: ${res.status}`);
const body = await res.json();
for (const item of body.items ?? []) {
  console.log(item.title, item.link, item.displayLink, item.snippet);
}
Enter fullscreen mode Exit fullscreen mode

After, SpecStream with Google's shape:

const params = new URLSearchParams({
  key: process.env.SPECSTREAM_API_KEY,
  cx: process.env.GOOGLE_CSE_ID, // accepted and ignored
  q: "eu ai act enforcement date",
  num: "10",
  start: "1",
});

const res = await fetch(`https://api.specstream.ai/customsearch/v1?${params}`);
if (!res.ok) throw new Error(`search failed: ${res.status}`);
const body = await res.json();
for (const item of body.items ?? []) {
  console.log(item.title, item.link, item.displayLink, item.snippet);
}
Enter fullscreen mode Exit fullscreen mode

curl

Before, Google:

curl -s "https://www.googleapis.com/customsearch/v1?key=$GOOGLE_API_KEY&cx=$GOOGLE_CSE_ID&q=eu+ai+act+enforcement+date&num=10&start=1"
Enter fullscreen mode Exit fullscreen mode

After, SpecStream with Google's shape:

curl -s "https://api.specstream.ai/customsearch/v1?key=$SPECSTREAM_API_KEY&cx=$GOOGLE_CSE_ID&q=eu+ai+act+enforcement+date&num=10&start=1"
Enter fullscreen mode Exit fullscreen mode

When search is busy, this route answers 429 with Google's error body and a Retry-After header, so the retry code you already have keeps working.

Option 2: port to the native Search API

The native endpoint is GET https://api.specstream.ai/v1/web-search with Authorization: Bearer <key>. It returns more than Google's route does: each source carries published and modified dates when the page states them, and with passages=true you get the best passages of each page, so you can answer without fetching the page yourself.

Every reply is wrapped in data. The results are in data.sources[], each with url, title, site and snippet.

Field map

Google Custom Search SpecStream /v1/web-search
q q (1 to 2,000 characters, any language)
num num (1 to 100)
start (1, 11, 21...) page (1 to 10), where page = (start - 1) // num + 1
cx not needed
key Authorization: Bearer <key>
items[] data.sources[]
items[].title title
items[].link url
items[].displayLink site
items[].snippet snippet
queries.nextPage data.next_page (null when there are no more results)

Add speed=fast to stay at $1 per 1,000. Without it, a call runs the default search at $5 per 1,000, which also returns an answer for a question and rows for a list.

Python (requests)

import os
import requests

def search(q: str, num: int = 10, start: int = 1) -> dict:
    page = (start - 1) // num + 1
    resp = requests.get(
        "https://api.specstream.ai/v1/web-search",
        headers={"Authorization": f"Bearer {os.environ['SPECSTREAM_API_KEY']}"},
        params={"q": q, "num": num, "page": page, "speed": "fast"},
        timeout=30,
    )
    resp.raise_for_status()
    return resp.json()["data"]

data = search("eu ai act enforcement date")
for src in data["sources"]:
    print(src["title"], src["url"], src["site"], src["snippet"], sep="\n  ")
print("cost:", data["price_usd"], "took_ms:", data["took_ms"])
Enter fullscreen mode Exit fullscreen mode

Node (fetch, Node 18+)

async function search(q, num = 10, start = 1) {
  const page = Math.floor((start - 1) / num) + 1;
  const params = new URLSearchParams({ q, num: String(num), page: String(page), speed: "fast" });
  const res = await fetch(`https://api.specstream.ai/v1/web-search?${params}`, {
    headers: { Authorization: `Bearer ${process.env.SPECSTREAM_API_KEY}` },
  });
  if (!res.ok) throw new Error(`search failed: ${res.status}`);
  const { data } = await res.json();
  return data;
}

const data = await search("eu ai act enforcement date");
for (const src of data.sources) {
  console.log(src.title, src.url, src.site, src.snippet);
}
console.log("cost:", data.price_usd, "took_ms:", data.took_ms);
Enter fullscreen mode Exit fullscreen mode

curl

curl -s -G "https://api.specstream.ai/v1/web-search" \
  -H "Authorization: Bearer $SPECSTREAM_API_KEY" \
  --data-urlencode "q=eu ai act enforcement date" \
  -d num=10 -d page=1 -d speed=fast
Enter fullscreen mode Exit fullscreen mode

To keep query text out of URL logs, POST /v1/web-search takes the same parameters as a JSON body ({"q": "...", "speed": "fast"}) at the same price. Send an Idempotency-Key header and a retried call is charged once.

Price and latency

Prices are list prices per 1,000 requests, read on each vendor's own pricing page on December 2, 2026. Latency is our measured figure, or the vendor's own figure where its pricing page gives one; for the rest, the script in the next section measures it.

API Price per 1,000 requests Free start Latency
SpecStream fast tier (speed=fast, and the Google route) $1 for up to 10 results $2 of credit on sign up, no card (2,000 fast searches) 937 ms median, 6,548 live calls in the 7 days to December 1, 2026
SpecStream default search $5 for up to 10 results same measure with the script below
Google Custom Search JSON API [1] $5 after 100 free a day, capped at 10,000 a day; existing customers only; ends January 1, 2027 closed to new customers measure with the script below
Exa [3] $4 lite, $7 fast and auto, $12 deep; up to 10 results, then $1 per 1,000 results $10 of credit at sign up, reset monthly, no card lite, fast, auto: measure with the script below; deep: 4 to 15 seconds (Exa's figure)
Tavily [4][5] $8 basic (1 credit), $16 advanced (2 credits), at $0.008 a credit pay as you go 1,000 credits a month, no card measure with the script below
Brave Search API [6] $5 $5 of credit every month measure with the script below
Serper [7] $1.00 per 1,000 credits on the $50 pack, down to $0.30 on the $3,750 pack 2,500 free queries, no card 1 to 2 seconds (Serper's figure)

SpecStream searches its own index of 6.77 billion pages together with the live web on every call, and each source comes back with its URL and the time it was read. On accuracy, the Search API is first on SimpleQA Verified (99) and FRAMES (90.78%); the method and every score are on https://specstream.ai/benchmarks.

SpecStream is a French company. Our index runs in Frankfurt, and a key created with "eu_egress_only": true sends its searches out only from our Frankfurt servers.

Measure latency yourself

We haven't measured the other APIs, so here is a script that times each one with your own keys and queries. It skips any provider whose key isn't set.

# bench.py: python bench.py  (set the API keys you have as env vars)
import os
import statistics
import time
import requests

QUERIES = [
    "eu ai act enforcement date",
    "postgres 17 release notes logical replication",
    "best practices rate limiting api gateway",
    "who acquired tavily",
    "python requests retry backoff example",
]

def specstream(q):
    return requests.get(
        "https://api.specstream.ai/v1/web-search",
        headers={"Authorization": f"Bearer {os.environ['SPECSTREAM_API_KEY']}"},
        params={"q": q, "num": 10, "speed": "fast"}, timeout=60)

def exa(q):
    return requests.post(
        "https://api.exa.ai/search",
        headers={"x-api-key": os.environ["EXA_API_KEY"]},
        json={"query": q, "numResults": 10}, timeout=60)

def tavily(q):
    return requests.post(
        "https://api.tavily.com/search",
        headers={"Authorization": f"Bearer {os.environ['TAVILY_API_KEY']}"},
        json={"query": q, "max_results": 10}, timeout=60)

def brave(q):
    return requests.get(
        "https://api.search.brave.com/res/v1/web/search",
        headers={"X-Subscription-Token": os.environ["BRAVE_API_KEY"]},
        params={"q": q, "count": 10}, timeout=60)

def serper(q):
    return requests.post(
        "https://google.serper.dev/search",
        headers={"X-API-KEY": os.environ["SERPER_API_KEY"]},
        json={"q": q, "num": 10}, timeout=60)

PROVIDERS = {
    "specstream": ("SPECSTREAM_API_KEY", specstream),
    "exa": ("EXA_API_KEY", exa),
    "tavily": ("TAVILY_API_KEY", tavily),
    "brave": ("BRAVE_API_KEY", brave),
    "serper": ("SERPER_API_KEY", serper),
}

ROUNDS = 4
for name, (env, call) in PROVIDERS.items():
    if not os.environ.get(env):
        print(f"{name:11} skipped ({env} not set)")
        continue
    times, errors = [], 0
    for _ in range(ROUNDS):
        for q in QUERIES:
            t0 = time.perf_counter()
            try:
                r = call(q)
                r.raise_for_status()
                times.append((time.perf_counter() - t0) * 1000)
            except requests.RequestException:
                errors += 1
    if times:
        times.sort()
        p90 = times[int(0.9 * (len(times) - 1))]
        print(f"{name:11} n={len(times):3} median={statistics.median(times):7.0f} ms  p90={p90:7.0f} ms  errors={errors}")
    else:
        print(f"{name:11} all {errors} calls failed")
Enter fullscreen mode Exit fullscreen mode

Run it from the region your code runs in, since network distance moves every number in the table. Twenty calls per provider is enough to see the order; for a decision, raise ROUNDS and use queries from your own logs.

Test your own queries first

Paste a query into the live tester at https://specstream.ai/tools/google-cse-migrator and it runs the same call on https://api.specstream.ai/customsearch/v1, with Google's reply shape, before you touch any code. Ready to import versions of these calls for n8n, Dify, Activepieces and Open WebUI are in https://github.com/Specstreamai/specstream-templates.

Getting a key

Sign up at https://specstream.ai and you get $2 of credit with no card, which covers 2,000 searches on the Google route. Put the key in SPECSTREAM_API_KEY, change the host, and run your existing tests against it before January 1.

Sources

  1. Google, Custom Search JSON API overview, https://developers.google.com/custom-search/v1/overview (page last updated February 18, 2026), read November 11, 2026.
  2. Google, Programmable Search Engine blog, "Updates to our web search products", January 20, 2026, https://programmablesearchengine.googleblog.com/2026/01/updates-to-our-web-search-products.html, read November 11, 2026.
  3. Exa pricing, https://exa.ai/pricing, read Dec 2, 2026.
  4. Tavily pricing, https://www.tavily.com/pricing, read Dec 2, 2026.
  5. Tavily API credits, https://docs.tavily.com/documentation/api-credits, read Dec 2, 2026.
  6. Brave Search API, https://brave.com/search/api/, read Dec 2, 2026.
  7. Serper, https://serper.dev/, read Dec 2, 2026.
  8. SpecStream Search API reference, https://specstream.ai/agents.md, and benchmarks, https://specstream.ai/benchmarks.

Top comments (0)