Skip to the page

Google Custom Search API in Python

The call that still answers.

Google ends the Custom Search JSON API on January 1, 2027, and it is already closed to new customers. A new Google key no longer comes with it.

SpecStream answers the same GET /customsearch/v1 in Google's JSON. In Python, set the base address to https://api.specstream.ai and pass a SpecStream key as key. items[], start and queries.nextPage work as on Google.

It is the most accurate web search API in the world: 97.9 F-score on all 1,000 SimpleQA Verified questions, on the benchmarks page. Searches cost $5 per 1,000.

New accounts get $10 of credit, no card. It covers 2,000 searches.

The Custom Search call from Python: SpecStream, Google and Vertex AI Search

SpecStreamGoogle Custom Search JSON APIVertex AI Search
The callGET https://api.specstream.ai/customsearch/v1 with key, q, num and start. cx is accepted and not usedGET https://www.googleapis.com/customsearch/v1 with q, an API key and cx, the ID of a Programmable Search Engine you configuredPOST https://discoveryengine.googleapis.com/v1/{servingConfig}:search, a different request and reply
Open to new customersYes. Create a key in a minute and start with $10 of credit, no cardNo. Closed to new customers, and discontinued on January 1, 2027Yes, with a free trial of 10,000 queries per account a month
What it searchesThe whole live web, read at the moment of the call. siteSearch keeps a search to one siteThe Programmable Search Engine you configuredUp to 50 domains. For full web search, Google asks you to contact it
Price per 1,000$5 per 1,000 searches. A call of up to 10 results is $0.005$5 per 1,000 queries after 100 free queries a day, for existing customers$1.50 per 1,000 queries on Search Standard Edition, $4.00 on Search Enterprise Edition
What Python readsGoogle's JSON: items[] with title, link, snippet, displayLink, htmlTitle, htmlSnippet and formattedUrl, searchInformation.totalResults and queries.nextPageAn items array with the URL, title and text snippets of each result, in JSONSearch Enterprise Edition includes generated answers, at $4.00 per 1,000 queries
Results a callnum from 1 to 10, as on Google. Up to 100 in one search on GET /v1/web-search1 to 10 results a call, and never more than 100 for a queryBilled per query: any API call to Enterprise Search counts as one
What a call costs when it failsA 429 with Retry-After charges nothing. With an Idempotency-Key, a retried call is charged onceIts terms say you may be charged for each successful requestA request is any API call, direct or through an integration or the console

Why Python code that called Custom Search moves to SpecStream

Other options for the Custom Search JSON API in Python

How SpecStream scores

The same numbers as the benchmarks page, from the official tasks and scorers.

How to run the Python example

1. Create a key under Agents & API in the workspace. A new account gets $10 of credit, no card, which covers 2,000 searches.

2. Put it in the environment.

export SPECSTREAM_API_KEY="your key"
pip install requests

3. Run the requests example above. In code that already calls Google, change https://www.googleapis.com or https://customsearch.googleapis.com to https://api.specstream.ai and the key. cx can stay in the call.

If your code uses Google's own client library, change one line. google-api-python-client and googleapis for Node both work against https://api.specstream.ai: set the address where the client is built, put the SpecStream key where Google's key went, and cse().list(q=..., cx=...) stays as it is. Tested on November 10, 2026 with versions 2.201.0 and 189.0.0.

# Python: google-api-python-client
from googleapiclient.discovery import build

service = build("customsearch", "v1", developerKey=SPECSTREAM_API_KEY,
                client_options={"api_endpoint": "https://api.specstream.ai"})
reply = service.cse().list(q="open source vector databases", cx="any").execute()

// Node: googleapis
const customsearch = google.customsearch({ version: "v1", auth: SPECSTREAM_API_KEY, rootUrl: "https://api.specstream.ai/" });
const reply = await customsearch.cse.list({ q: "open source vector databases", cx: "any" });

When your product needs every match in place of a results page, write the request in plain words. SpecStream reads it back as the conditions every row must meet and the facts to bring back, quotes the most it can cost, and delivers the rows after you approve.

Frequently asked questions

Something we didn't answer? Talk to a human

How do I use the Google Custom Search API in Python?
Send GET /customsearch/v1 with key, q and num using requests or urllib, and read items[]. Google closed the API to new customers and ends it on January 1, 2027. The same call works at https://api.specstream.ai/customsearch/v1 with a SpecStream key.
Do I need the google-api-python-client package?
No. Plain requests is enough, as in the example above. If your code already uses google-api-python-client, keep it: pass client_options={"api_endpoint": "https://api.specstream.ai"} to build, put the SpecStream key in developerKey, and service.cse().list(q=..., cx=...).execute() works as before. Tested on November 10, 2026 with version 2.201.0.
How do I get more than 10 results in Python?
Page with start: 1, then 11, then 21, or read queries.nextPage[0].startIndex from each reply. On the same key, GET https://api.specstream.ai/v1/web-search returns up to 100 results in one search for $0.059.
Do I still need a search engine ID (cx)?
No. cx is accepted and not used, so code that sends it runs unchanged. SpecStream searches the whole live web, and siteSearch keeps a search to one site.
What does the Custom Search JSON API cost?
$5 per 1,000 queries after 100 free queries a day, up to 10,000 queries a day, for existing customers until January 1, 2027. SpecStream costs $5 per 1,000 searches with no daily limit. Every rate is on the pricing page.
Why does my code get a KeyError on items?
A search with 0 results has no items key, on Google and on SpecStream. Read it with data.get("items", []), as the examples here do.

Sources

SpecStream wrote this page. Each figure about Google comes from Google's own pages, and each other figure from that company's own page.

  1. Google Custom Search JSON API overviewdevelopers.google.com/custom-search/v1/overview, read Nov 9, 2026
  2. Google Custom Search JSON API reference, cse.listdevelopers.google.com/custom-search/v1/reference/rest/v1/cse/list, read Nov 9, 2026
  3. Google Custom Search JSON API, using RESTdevelopers.google.com/custom-search/v1/using_rest, read Nov 9, 2026
  4. Google Custom Search terms of servicedevelopers.google.com/custom-search/terms, read Nov 9, 2026
  5. Programmable Search Engine blog: updates to our web search productsprogrammablesearchengine.googleblog.com/2026/01/updates-to-our-web-search-products.html, read Nov 9, 2026
  6. Google Cloud: Agent Search pricingcloud.google.com/generative-ai-app-builder/pricing, read Nov 9, 2026
  7. Google Cloud: servingConfigs.search methodcloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search, read Nov 9, 2026
  8. Gemini API: Grounding with Google Searchai.google.dev/gemini-api/docs/google-search, read Nov 9, 2026
  9. Brave Search APIbrave.com/search/api/, read Nov 9, 2026
  10. Brave, alternatives to the Google Search APIbrave.com/learn/google-api-shutdown/, read Nov 9, 2026
  11. SpecStream benchmarksspecstream.ai/benchmarks, read Nov 10, 2026
  12. SpecStream pricingspecstream.ai/pricing, read Nov 10, 2026
  13. SpecStream for agentsspecstream.ai/agents.md, read Nov 10, 2026