Google APIs · AI Mode

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 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.

FieldTypeWhat it holds
text_blocks[]arrayThe answer in Google's order, one block at a time.
typestringparagraph, heading, list, code or table.
snippetstringThe block's text; level gives a heading's level.
list, orderedarray of strings, booleanA list's items, and whether it is numbered.
codestringA code block's text.
tablearray of rowsA table, each row an array of strings.
reference_indexesarray of integersThe block's citations, as indexes into references.
snippet_linksarrayThe links Google writes into the block's text: text and link.
references[]arrayThe sources the answer cites.
indexintegerThe number a block's reference_indexes point at.
title, snippet, sourcestringThe source's title, its lines on the card, and the site's name.
linkstringThe page, or Google's /goto to it when Google did not resolve it.
domainstringThe source's site, without "www.", known either way.
product_idstringFor a product: the id /v1/shopping/product takes for its stores.
local_results[]arrayThe places the answer names: title, rating, reviews, type, address, phone, website, and link to Google Maps.
markdownstringThe whole answer as Markdown.
meta.creditsintegerThe credits the call spent.
request_idstringThe 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.

PlanPrice a monthAnswers a monthPer 1,000 answers
Free$0500free
Starter$2512,500$2.00
Developer$7550,000$1.50
Production$150150,000$1.00
Scale$350400,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.