Google AI Mode API
Google's AI Mode answer to any question, as JSON or Markdown: the text in blocks, each pointing at the sources it cites, and the places it names. Asked from any country or city, 2 credits an answer.
One call, one answer
Ask the question as a person would. An answer usually takes 5 to 20 seconds and up to a minute, so give the call a 120-second timeout. A call that gets no answer is free.
curl -G https://api.serpbit.com/v1/ai-mode \ -H "Authorization: Bearer $SERPBIT_API_KEY" \ --data-urlencode "q=why is the sky blue" \ --max-time 120 { "text_blocks": [ { "type": "paragraph", "snippet": "The sky is blue because of Rayleigh scattering…", "reference_indexes": [0, 1] } ], "references": [ { "index": 0, "title": "Why Is the Sky Blue? | NASA Space Place", "link": "https://spaceplace.nasa.gov/blue-sky/", "domain": "spaceplace.nasa.gov" } ], "markdown": "The sky is blue because of Rayleigh scattering…" }
What comes back
The answer in blocks
Paragraphs, headings, lists, code and tables, in Google's order.
Its sources
Each block names the sources it cites; each source has its title, link and domain.
The places it names
Ratings, addresses, phones and Google Maps ids for a local question.
Markdown
The whole answer as Markdown, or ask
output=mdfor Markdown alone.From where you ask
glandhlfor a country and language,locationfor a city.
The same call in Python and JavaScript
Ask a question, print the answer, then each block's cited sites. Give the client a 120-second timeout: its default is 90. The clients read the key from SERPBIT_API_KEY and retry a failed call without billing it twice.
# pip install serpbit from serpbit import Serpbit sb = Serpbit(timeout=120) # reads SERPBIT_API_KEY answer = sb.ai_mode("best espresso grinder for beginners", gl="us") print(answer["markdown"]) refs = {r["index"]: r for r in answer["references"]} for block in answer["text_blocks"]: sites = [refs[i].get("domain") for i in block.get("reference_indexes", []) if i in refs] print(block["type"], sites)
// npm install serpbit import Serpbit from "serpbit"; const sb = new Serpbit({ timeout: 120_000 }); // reads SERPBIT_API_KEY const answer = await sb.aiMode("best espresso grinder for beginners", { gl: "us" }); console.log(answer.markdown); const refs = new Map(answer.references.map((r) => [r.index, r])); for (const block of answer.text_blocks) { const sites = (block.reference_indexes ?? []).map((i) => refs.get(i)?.domain); console.log(block.type, sites); }
Response fields
The main fields of an answer. Most are left out when Google shows nothing for them. The reference has every parameter.
| Field | Type | What it holds |
|---|---|---|
| text_blocks[] | array | The answer in Google's order, one block at a time. |
| type | string | paragraph, heading, list, code or table. |
| snippet | string | The block's text; level gives a heading's level. |
| list, ordered | array of strings, boolean | A list's items, and whether it is numbered. |
| code | string | A code block's text. |
| table | array of rows | A table, each row an array of strings. |
| reference_indexes | array of integers | The block's citations, as indexes into references. |
| snippet_links | array | The links Google writes into the block's text: text and link. |
| references[] | array | The sources the answer cites. |
| index | integer | The number a block's reference_indexes point at. |
| title, snippet, source | string | The source's title, its lines on the card, and the site's name. |
| link | string | The page, or Google's /goto to it when Google did not resolve it. |
| domain | string | The source's site, without "www.", known either way. |
| product_id | string | For a product: the id /v1/shopping/product takes for its stores. |
| local_results[] | array | The places the answer names: title, rating, reviews, type, address, phone, website, and link to Google Maps. |
| markdown | string | The whole answer as Markdown. |
| meta.credits | integer | The credits the call spent. |
| request_id | string | The call's id, to quote to support. |
What it is used for
See whether your site is cited
Ask the questions your buyers ask and count how often your domain is in references. Ask each one several times: the sources change between answers.
Compare answers by place
Ask the same question with another gl or location to see what AI Mode tells people in another country or city.
Find the products it names
A source that is a product has a product_id. Give it to the Shopping API for every store's price.
Store or quote the answer
markdown holds the whole answer, ready to save, compare with last week's, or pass to a language model.
What 1,000 answers cost
An answer is 2 credits, on the same key and credits as every other API.
| Plan | Price a month | Answers a month | Per 1,000 answers |
|---|---|---|---|
| Free | $0 | 500 | free |
| Starter | $25 | 12,500 | $2.00 |
| Developer | $75 | 50,000 | $1.50 |
| Production | $150 | 150,000 | $1.00 |
| Scale | $350 | 400,000 | $0.88 |
In US dollars before tax. All plans are on the pricing page.
Questions
How is AI Mode different from the AI Overview?
AI Mode is Google's separate AI search: a full answer to a question, with its own sources. The AI Overview is the short summary at the top of an ordinary results page. Serpbit has both: the AI Overview API.
Does the same question get the same answer?
Not always. In our test, the same 24 questions asked four times over 35 minutes never came back the same all four times: the number of sources changed on every one. To track an answer, ask it several times and count how often a source appears.
Can I ask as if from a city?
Yes. Give location by Google's name for the place, for example Austin,Texas,United States, down to a ZIP code.
Are the source links the pages themselves?
Mostly. Google resolves only the first few links of an answer; the others stay as its /goto links. Every source still carries its domain, read from the card Google draws for it, so you know who was cited either way.
Can an AI agent use it?
Yes. Our MCP server has it as the google_ai_mode tool: add https://api.serpbit.com/mcp as a connector in Claude, ChatGPT or Cursor and sign in.
Is Serpbit part of Google?
No. Serpbit is not affiliated with Google; Google is a trademark of Google LLC.
Start with 1,000 free credits.
Every month. No card.