Build

Google search

Search Google directly, or give your model current sources.

Search with a model

Set MINIROUTER_KEY to your funded integration API key. Use Chat Completions and a paid, tool-capable model. Free models, chat-session keys and provider keys (BYOK) are unsupported.

Search once and cite sources
curl https://api.minirouter.sh/v1/chat/completions \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "google/gemma-4-26b-a4b-it",
  "messages": [
    {
      "role": "user",
      "content": "Search Google for MiniRouter API documentation. Summarize what you find and cite the source URLs."
    }
  ],
  "tools": [
    {
      "type": "minirouter:google_search",
      "parameters": {
        "max_uses": 1,
        "max_results": 5,
        "region": "GB"
      }
    }
  ],
  "max_tool_calls": 1,
  "max_tokens": 512
}'

Read the answer in choices[0].message.content. MiniRouter handles the tool call for you.

  1. 01AskGive the model a task and permission to search.
  2. 02SearchGoogle results arrive through Serper: titles, URLs and snippets.
  3. 03AnswerThe model answers using those results in the same response.

Ask explicitly for search; the model may otherwise skip it. Raw results go to the model. Treat source content as untrusted.

Set limits and region

max_uses
Search attempts per request: 1–10. Default: 3. Dispatched attempts count even if they fail.
max_results
Results per search: 1–10. Default: 5. Each has title, url and description. Fewer may be available.
region
Optional uppercase country code, such as GB or US.

Set these in parameters. The model supplies a query of 1–2,048 characters. Date, language and domain filters are unsupported.

max_tool_calls caps Google, datetime and web-fetch calls together: 1–30, default 5. Once this cap is reached, the model finishes without tools.

Cost and usage

Each completed search costs $0.01. Chat Completions also charges model tokens. A completed search with no matches still counts. Failed or timed-out searches have no search fee.

1 search
$0.01
3 searches
$0.03
10 searches
$0.10
Calculated search fees. Model tokens are additional.

Credit is reserved for the allowed searches before dispatch. Each model round costs tokens; max_tokens applies per round. Completed searches remain billable if the final answer fails.

usage.server_tool_use.google_search_requests counts completed searches. usage.cost includes search fees and all model rounds.

For streaming, add stream: true and stream_options: {"include_usage": true}. Totals arrive in the final usage chunk. Keep-alives precede the completed answer; intermediate rounds are not streamed token by token.

Support and errors

In Chat Completions, search runs independently of the model provider and requires a supported paid route.

Invalid request
Check the endpoint, model and option ranges.
Insufficient credits
Add credit or lower search and output limits. Funds must cover searches and model tokens.
Search fails
The model receives the failure and can answer without results or retry within your limits.

Search times out after 15 seconds. Handle HTTP and streaming errors; check answers for missing sources.

Use web fetch to read a full page, or compare web and news search for other search options.