Skip to main content
Web search is a server-side tool. The model decides what to search for and how many times, reads the results, and answers with source links; your code doesn’t run anything. LaoZhang API exposes it the way each vendor does: Responses for GPT and Grok, native generateContent for Gemini. On top of the search fee, the search results the model reads are billed as input tokens, which usually adds several thousand to tens of thousands of input tokens per search. Searching takes longer than a plain request, typically from ten seconds to a minute. Set your client timeout to 300 seconds.

Supported models

Verified on October 14, 2026: The Chat Completions web_search_options parameter isn’t available and returns 400 Unknown parameter. If your app is built on Chat Completions, send the requests that need search through Responses. Install the SDK (python -m pip install openai) and set the LAOZHANG_API_KEY environment variable first.
response.output contains, in order:
  • web_search_call: one item per search, and each one is billed
  • message: the final answer, with url_citation sources in annotations
The same code works with model="grok-4.5". Grok may search several times for one request, which adds time and search fees. Install the SDK (python -m pip install google-genai):
The search fee is charged per query in web_search_queries. grounding_chunks lists the pages the model used; each uri is a Google redirect link that opens the original page. Without the SDK, send the JSON directly:
Gemini’s OpenAI-compatible endpoint doesn’t support this tool, so use the native format for search.

Check search fees in your logs

On the console Logs page, a request that searched shows the number of web search tool calls and their cost. Through the log query API, the same details are in web_search_billing inside the other field. Total cost = number of searches × per-search price + token cost.

FAQ

Why did the model answer without searching?

The tool lets the model search; it doesn’t force it. Models usually search when the question needs current information. To make a search more likely, ask for it in the prompt, for example “search the web and cite your sources”.

Can I limit search to certain sites?

You can ask the model in the prompt to prefer certain sites, but it may still cite others. Check the behavior with a few requests before you rely on it.

Is Nano Banana’s Google Search grounding priced the same?

Yes. When a Nano Banana image model uses Google Search grounding, each search is also $0.014; see Nano Banana 2.1.

References