Skip to content

New AI assistant answers: ChatGPT, Gemini, Copilot and AI Mode by API

SerpKite
Get API key
Docs menu / Google AI Mode

Google AI Mode

Ask Google AI Mode, Google's conversational search, as a logged-out user and get its answer with the sources it cited, for the country you choose.

POST https://api.serpkite.com/v1/ai_mode Credits: 2 per answer (the same in a batch); failed, refused and empty answers are free
View as Markdown

Runs prompt in Google AI Mode (the AI Mode tab of Google Search, udm=50) as a logged-out visitor and returns the answer with the sources it cited. For the AI Overview Google shows above ordinary results, use /v1/search: its response carries ai_overview when the page has one, at the price of the search.

Billing: 2 credits per answer, 1 from the cache with max_age. AI answers cost the same in POST /v1/batches: the batch lane does not halve them. A failed, refused or empty answer is refunded (503, nothing billed).

Latency: answers typically take 5–45 s; requests wait up to 90 s. Set a client timeout of at least 120 s, or queue prompts with batches or a monitor instead of holding requests open.

Variance: assistants answer the same prompt differently from run to run and by country. To measure visibility, ask each prompt several times and compare shares, not single answers. See AI visibility tracking.

Request body

ParameterTypeDefaultDescription
prompt requiredstringThe message to the assistant, up to 4,000 characters. Required. (q is not accepted here.)
countrystringThe country Google answers for (ISO 3166-1 alpha-2). AI Mode is asked from that country.
languagestringenInterface language (e.g. en, de). The answer follows the prompt's language.
trackstring[]Up to 20 brands ("Acme") or domains ("acme.com", subdomains match), 100 characters each, to check the answer for. Each comes back in mentions. A term with a dot is a domain: it matches sources and product links on that domain; other terms match whole words, case-insensitively.
include_htmlbooleanfalseAlso return the answer's HTML in html.
formatstringjsonmarkdown returns the answer, its sources, searches, products and a Mentions section as one Markdown document; compact keeps text, sources (n, title, link), search_queries, products and places. One of: json, markdown, compact.
fieldsstringComma-separated projection, e.g. results.title,results.link,knowledge_graph. Cuts tokens.
max_ageintegerAccept a cached answer up to this many seconds old, at half price. Answers are cached for at most 1 hour, and only a request with max_age reads the cache.

Example request

Authenticate with Authorization: Bearer $SERPKITE_API_KEY (GET requests may pass ?api_key= instead). The official SDKs read SERPKITE_API_KEY for you. See Authentication.

curl https://api.serpkite.com/v1/ai_mode \
  -H "Authorization: Bearer $SERPKITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"how to remove a red wine stain from a wool carpet"}'

Response fields

FieldTypeDescription
requestobjectThe normalised request: endpoint, prompt, country, language (not chatgpt), web_search (chatgpt), include_html.
textstringThe answer as plain text.
markdownstringThe answer as Markdown. Citations are [n](link), where n is the position of a source in sources.
htmlstringThe answer's HTML, only with include_html: true.
modelstringThe model the assistant reports to logged-out visitors, when it reports one.
sources[]arrayposition (the n in the citations), title, link, domain, snippet, date, cited (true: cited inline in the answer; false: only listed beside it).
search_queries[]arrayThe searches the assistant ran to answer (its fan-out), where it shows them.
products[]arrayProduct cards shown with the answer: position, title, brand, price (as shown), extracted_price, currency (ISO 4217 when unambiguous), rating, reviews, merchant, link, image, description.
places[]arrayLocal businesses the answer showed, same shape as /v1/maps results.
related_questions[]arrayFollow-up questions the assistant suggested.
mentions[]arrayOnly with track, one per term: term, mentioned (the answer text names it), cited (a cited source matches it), sources (positions of matching sources, cited or listed), products (positions of matching products), text_position (where the text first names it, 0 = start to 1 = end; -1 when it doesn't). See AI visibility tracking.
metaobjectrequest_id, credits_used, cached, cached_at, engine (the assistant), latency_ms, parse_quality.

Every billed response also carries credit and latency headers (X-Credits-Used, X-Credits-Remaining, X-Request-Id…).

Example response

200 OK · illustrative
{
  "request": {
    "endpoint": "ai_mode",
    "prompt": "how to remove a red wine stain from a wool carpet",
    "country": "us",
    "language": "en"
  },
  "text": "Blot (don't rub) as much wine as you can, then dab the stain with cold water and a little wool-safe detergent…",
  "markdown": "**Blot, don't rub**, as much wine as you can, then dab the stain with cold water and a little wool-safe detergent [1](https://www.example.com/wool-carpet-stains)…",
  "sources": [
    {
      "position": 1,
      "title": "Cleaning wool carpets: stains",
      "link": "https://www.example.com/wool-carpet-stains",
      "domain": "example.com",
      "cited": true
    },
    {
      "position": 2,
      "title": "How to get red wine out of carpet",
      "link": "https://www.example.org/red-wine-carpet",
      "domain": "example.org",
      "cited": false
    }
  ],
  "search_queries": [],
  "products": [],
  "meta": {
    "request_id": "req_01J8ZK4M6Q2V7",
    "credits_used": 3,
    "cached": false,
    "engine": "ai_mode",
    "latency_ms": 9800,
    "parse_quality": "ok"
  }
}

Errors

Errors use one shape: {"error":{"code","message","request_id"}}. Errors are never billed. Full list in Errors.

StatusCodeMeaning
400invalid_requestA parameter is missing or invalid.
401unauthorizedThe API key is missing, invalid or revoked.
402insufficient_creditsYour balance is too low. Buy a pack or wait for the monthly free grant.
429rate_limitedToo many requests per second for your plan. Retry after the Retry-After header.
503upstream_errorGoogle could not be fetched or parsed. Not billed; retry after Retry-After.
503upstream_blockedGoogle is rate limiting the upstream right now, or refused this query (Retry-After 120 s; rephrase it, or use engine=auto where another engine serves the endpoint). Not billed; retry after Retry-After.
503upstream_timeoutThe search took too long. Not billed; retry after Retry-After.

Notes

  • AI Mode isn't offered in every country; a prompt for a country where Google doesn't show it fails with 503 and is free.
  • We ask like a logged-out visitor in a standard browser and never sign in. When the assistant refuses the visit or asks the visitor to sign in, the call fails with 503 upstream_blocked and is free. See AI assistants.
  • engine is not accepted (the path names the assistant), and neither are search options such as q, num or location: they return 400 invalid_request.
  • Monitors take endpoint: "ai_mode" with prompt and track, and report every run's answer with new_sources and mentions. See Monitors.
  • The remote MCP server has a ai_mode tool. See MCP server.
  • The prompt is handled like a search query: never logged, and cached for at most an hour under a hashed key. See Privacy and data retention.