Web Search
Give any model access to real-time web information
Beta
Server tools are currently in beta. The API and behavior may change.
The openrouter:web_search server tool gives any model on OpenRouter access to real-time web information. When the model determines it needs current information, it calls the tool with a search query. OpenRouter executes the search and returns results that the model uses to formulate a grounded, cited response.
How It Works
- You include
{ "type": "openrouter:web_search" }in yourtoolsarray. - Based on the user’s prompt, the model decides whether a web search is needed and generates a search query.
- OpenRouter executes the search using the configured engine (defaults to
auto, which uses native provider search when available or falls back to Exa). - The search results (URLs, titles, and content snippets) are returned to the model.
- The model synthesizes the results into its response. It may search multiple times in a single request if needed.
Quick Start
Configuration
The web search tool accepts optional parameters to customize search behavior:
User Location
Pass an approximate user location to bias search results geographically:
All fields within user_location are optional.
Engine Selection
The web search server tool supports multiple search engines:
auto(default): Uses native search if the provider supports it, otherwise falls back to Exanative: Forces the provider’s built-in web search (falls back to Exa with a warning if the provider doesn’t support it)exa: Uses Exa’s search API, which combines keyword and embeddings-based searchfirecrawl: Uses Firecrawl’s search API (BYOK — bring your own key)parallel: Uses Parallel’s search API
Engine Capabilities
Firecrawl (BYOK)
Firecrawl uses your own API key. To set it up:
- Go to your OpenRouter plugin settings and select Firecrawl as the web search engine
- Accept the Firecrawl Terms of Service — this creates a Firecrawl account linked to your email
- Your account starts with a free hobby plan and 100,000 credits
Firecrawl searches use your Firecrawl credits directly — no additional charge from OpenRouter. Domain filtering is not supported with Firecrawl.
Parallel
Parallel supports domain filtering and uses OpenRouter credits at the same rate as Exa ($4 per 1,000 results).
Domain Filtering
Restrict which domains appear in search results using allowed_domains and excluded_domains:
Controlling Total Results
When the model searches multiple times in a single request, use max_total_results to cap the cumulative number of results:
Once the limit is reached, subsequent search calls return a message telling the model the limit was hit instead of performing another search. This is useful for controlling cost and context window usage in agentic loops.
Works with the Responses API
The web search server tool also works with the Responses API:
Usage Tracking
Web search usage is reported in the response usage object:
The web_search_requests field counts the total number of search queries the model made during the request.
Pricing
All pricing is in addition to standard LLM token costs for processing the search result content.
Migrating from the Web Search Plugin
The web search plugin (plugins: [{ id: "web" }]) and the :online variant are deprecated. Use the openrouter:web_search server tool instead.
The key differences:
Migration example
Next Steps
- Server Tools Overview — Learn about server tools
- Datetime — Get the current date and time
- Tool Calling — Learn about user-defined tool calling