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.
GPT and Grok: Responses web_search
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 billedmessage: the final answer, withurl_citationsources inannotations
model="grok-4.5". Grok may search several times for one request, which adds time and search fees.
Gemini: google_search
Install the SDK (python -m pip install google-genai):
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:
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 inweb_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.Related documentation
- Let the model call your own functions: Function calling
- Chat Completions compared with Responses: OpenAI models
- All fields of the native Gemini format: Gemini protocol
- Token prices per model: Models and pricing
References
- OpenAI: Web search tool
- xAI: Search tools
- Google: Grounding with Google Search
- LaoZhang API search fees and token usage: console call logs