Blog / API guides

Google AI Mode API: Answers and Follow-ups as JSON

Google doesn't offer an API for AI Mode, its conversational search answers. GET /v1/google-search/google-ai-mode-search returns an AI Mode answer as JSON for a question you pass in q, with hl, gl, google_domain and uule to set language and location. A follow_up_token parameter carries a conversation into its next turn. Every turn is one call at 1 credit, so a three-turn conversation costs 3 credits.

Is there an official Google AI Mode API?

No. AI Mode is a tab in Google Search, not a developer product. Google describes it as using a "query fan-out" technique: it splits a question into subtopics and searches for each one at once across several sources, then writes one answer with links (Google Search Help, 2026). Google's developer offerings for generative answers sit elsewhere, in its Gemini API and Vertex AI, which ground a model you call on Google Search results rather than returning the AI Mode answer a searcher sees.

If you want your own model's answer grounded in search, a model API with a search tool is the more direct route, and our guide to grounding LLM answers with live search covers that pattern. If you need the answer Google itself gives, for monitoring what AI Mode says about a brand, a product or a topic, the Google AI Mode Search endpoint returns it. Data is collected from publicly available sources and returned as found at the time of the call.

How do you ask AI Mode a question?

Send a GET request with q, the question as a user would type it. Add hl and gl so the answer matches the language and country you care about. Put your key in the X-API-Key header; keys start with sk_live_, and the authentication docs cover the rest. A first call looks like this:

curl "https://api.perceptlayer.com/v1/google-search/google-ai-mode-search?q=what+should+I+look+for+in+a+first+road+bike&hl=en&gl=us" \
  -H "X-API-Key: $API_KEY"

We haven't run this request for the article and there's no recorded AI Mode response yet, so we won't describe the response fields. Run it in the playground on the AI Mode endpoint page to see the real output.

Which parameters does it take?

The endpoint takes q and five optional parameters. Note the name: it's q, while the other Google Search endpoints, including the AI Overview one, use query. Types and lengths come from the endpoint definition; defaults aren't documented, so set language and location on every call.

Parameter Type Notes
q string, required The question, up to 8,192 characters
hl string Language, 2 characters, for example en
gl string Country, 2 characters, for example us
google_domain string Up to 100 characters, for example google.co.uk
uule string Encoded location, up to 500 characters
follow_up_token string Links a follow-up to the previous turn, up to 4,000 characters

The long q limit matters for AI Mode more than for classic search. People tend to ask it long, specific questions. A question with constraints ("a first road bike under 1,500 dollars for 40 km commutes on rough roads") fits easily.

How do follow-up questions work?

AI Mode is conversational: in Search you can ask a follow-up and the answer takes the earlier question into account. The endpoint models that with follow_up_token. The first call sends only q. Each later call sends the new question as q plus a token that identifies the conversation so far. Without the token, the follow-up is answered as a new, standalone question.

The token comes from a response, and that's the part we can't show yet. Without a recording we can't name the field that carries it, say whether it changes every turn, or say how long it stays valid. Check these three things in the playground before you build a multi-turn flow:

  1. Which field in the first response holds the token to send back.
  2. Whether the second response returns a new token for the third turn, or the same one.
  3. What a stale or malformed token returns: a fresh answer, or an invalid_parameters (422) error.

Here's a Python helper that runs a conversation and leaves the token lookup to you. It's written to the parameters above; we haven't run it against the live API.

import os
import requests

URL = "https://api.perceptlayer.com/v1/google-search/google-ai-mode-search"
HEADERS = {"X-API-Key": os.environ["API_KEY"]}

def converse(questions, get_token, hl="en", gl="us"):
    """Ask questions in order, passing each turn's token to the next.

    get_token(response_json) returns the follow-up token, or None.
    Write it once you've seen a real response in the playground."""
    token, turns = None, []
    for q in questions:
        params = {"q": q, "hl": hl, "gl": gl}
        if token:
            params["follow_up_token"] = token
        r = requests.get(URL, headers=HEADERS, params=params, timeout=90)
        r.raise_for_status()
        body = r.json()
        turns.append({"q": q, "credits": r.headers.get("X-Credits-Used"), "body": body})
        token = get_token(body)
        if not token:
            break
    return turns

The helper records X-Credits-Used for each turn, so your first run also confirms the cost per turn. It stops if a turn returns no token, rather than silently starting a new conversation. Wrap the request in retries for rate_limited and temporarily_unavailable, as in handling web data API errors in Python.

What does a conversation cost?

Every call costs 1 credit on success, so a conversation costs one credit per turn. Failed calls cost nothing and return X-Credits-Used: 0; every success returns X-Credits-Used and X-Credits-Remaining. The credits docs explain billing.

Job Calls Credits
One question 1 1
A three-turn conversation 3 3
50 brand questions, daily, one turn each, 30 days 1,500 1,500
50 brand questions, daily, three turns each, 30 days 4,500 4,500

Worked example: 1,000 three-turn conversations are 1,000 × 3 × 1 credit = 3,000 credits. The 1,000 free credits you get every month after verifying an email address cover 333 of them. The daily three-turn brand check, 4,500 credits a month, fits twice in a Starter pack of 10,000 credits with room to spare, and purchased credits last 12 months. See pricing for what credits cost.

The helper allows a 90-second client timeout, longer than the 60 seconds after which the API returns timeout (504). A request whose reply is lost to a client timeout may still have succeeded and been billed, because requests have no idempotency key. The rate limits docs cover per-account limits.

How is AI Mode different from AI Overviews?

They're separate features and separate endpoints. An AI Overview is a summary Google adds above classic results on some searches, when its systems judge it helpful. AI Mode is a separate tab where every question gets a generated answer and you can ask follow-ups. Google says you can also jump from an AI Overview into an AI Mode conversation on mobile (Google, 2026).

AI Overview AI Mode
Endpoint /v1/google-search/search-ai-overview /v1/google-search/google-ai-mode-search
Query parameter query, up to 2,048 characters q, up to 8,192 characters
Follow-ups No follow_up_token
Appears on every query No, only some Every question gets an answer
Credits 1 per call 1 per turn

For monitoring, use both. AI Overviews are what most searchers see on the classic results page; AI Mode is where people go for longer research questions. The AI Overview API guide covers that endpoint and why many queries return no overview. For classic results, see the Google Search API guide.

Where is AI Mode available?

Google says AI Mode is available in over 200 countries and territories and has added languages through 2025 and 2026, including Hindi, Indonesian, Japanese, Korean and Brazilian Portuguese in one 2025 expansion (Google, 2025). Set hl and gl to a market where it's offered.

We haven't tested how the endpoint responds when gl points at a market without AI Mode, so include that case in your first playground runs if you track several countries. Keep hl, gl and google_domain fixed per market across runs; otherwise day-over-day changes in an answer mix market differences with real ones.

Can an AI agent call AI Mode?

Yes. The MCP server at https://api.perceptlayer.com/mcp exposes search_endpoints and get_endpoint, which are free catalogue lookups, and call_endpoint, which runs google-search.google-ai-mode-search and spends 1 credit per turn on success. An agent can ask AI Mode a question and read the answer as JSON.

Treat the answer as one more source, not as ground truth: it's generated, so have the agent follow the linked pages for anything it will state as fact. Setup is in the AI agents docs, and error codes are in the errors docs.

To see the response shape and find the follow-up token, get a free API key and run a question in the playground on the Google Search API page.

APIs in this post

Frequently asked questions

Does Google have an AI Mode API?

No. AI Mode is a Google Search feature with no public API. Google's Gemini API and Vertex AI can ground a model's answer in search results, but they don't return the AI Mode answer a searcher sees. GET /v1/google-search/google-ai-mode-search returns that answer as JSON, at 1 credit per successful call.

How do I ask a follow-up question?

Send the follow-up as q with the follow_up_token from the previous turn's response. Without the token, the question is answered on its own. We haven't recorded a response yet, so check in the playground which field holds the token and whether it changes from turn to turn before you build a multi-turn flow.

How much does an AI Mode conversation cost?

Each turn is one call and costs 1 credit on success, so a three-turn conversation costs 3 credits. Failed calls cost nothing. Every account gets 1,000 free credits a month after verifying an email address, and prepaid packs start at 10,000 credits. The pricing page has what credits cost.

Why is the parameter q and not query?

The AI Mode endpoint names its question parameter q, while the other Google Search endpoints, including the AI Overview endpoint, use query. Sending query to the AI Mode endpoint leaves q missing, which returns invalid_parameters (422) and costs nothing. q accepts up to 8,192 characters.

What happens if a call fails?

You get an HTTP status and a JSON error with a code, message and request_id, and no credits are debited. Rate-limited (429) and temporarily unavailable (503) responses include a Retry-After header with the seconds to wait, and a timeout (504) error means the source didn't answer within 60 seconds. The errors docs list every code.

  1. Google Search API: Get Search Results as JSON

    Call GET /v1/google-search/search for organic results as JSON at 1 credit a call. Parameters, a real recorded response and the cost in credits.

  2. Google AI Overview API: Get AI Overviews as JSON

    Google has no AI Overview API. GET /v1/google-search/search-ai-overview takes a query, hl and gl, costs 1 credit, and suits daily keyword tracking.

  3. Google News API: Search News Articles as JSON

    One GET call to /v1/google-news/news returns articles with title, link, source and ISO date as JSON for 1 credit. Parameters, a real response, cost.

Start with 1,000 free credits

No password to set. We email you a sign-in link, and your key works on every API.

No credit card. 1,000 free credits a month.