Web Search
Model-agnostic grounding
Model-agnostic grounding
For improved quality results, try the openrouter:web_search server tool. Server tools give the model control over when and how often to search, rather than always running once per request.
You can incorporate relevant web search results for any model on OpenRouter by activating and customizing the web plugin, or by appending :online to the model slug:
You can also append :online to :free model variants like so:
Using web search will incur extra costs, even with free models. See the pricing section below for details.
:online is a shortcut for using the web plugin, and is exactly equivalent to:
The web search plugin is powered by native search for Anthropic, OpenAI, Perplexity, and xAI models.
For xAI models, the web search plugin enables both Web Search and X Search.
For other models, the web search plugin is powered by Exa. It uses their “auto” method (a combination of keyword search and embeddings-based web search) to find the most relevant results and augment/ground your prompt. For each result, OpenRouter requests Exa highlights — extractive excerpts drawn from the page that Exa selects as most relevant to the search query, sized adaptively (typically ~2,000–4,000 characters per result). These are returned to the model and surfaced via url_citation annotations, with Exa’s [...] markers separating excerpts that come from different parts of the same page.
Web search results for all models (including native-only models like Perplexity and OpenAI Online) are available in the API and standardized by OpenRouter to follow the same annotation schema in the OpenAI Chat Completion Message type:
The maximum results allowed by the web plugin and the prompt used to attach them to your message stream can be customized:
By default, the web plugin uses the following search prompt, using the current date:
You can restrict which domains appear in web search results using include_domains and exclude_domains:
Both fields accept an array of domain strings. You can use wildcards (*.substack.com) and path filtering (openai.com/blog).
When using native search, domain filter support depends on the provider:
include_domains and exclude_domains, but they are mutually exclusive — you cannot use both at onceinclude_domains only; exclude_domains is silently ignoredWhen using xAI models with web search enabled,
OpenRouter automatically adds the x_search tool
alongside web_search. You can pass filter
parameters to control X/Twitter search results
using the top-level x_search_filter parameter:
allowed_x_handles and excluded_x_handles are
mutually exclusive — you cannot use both in the
same request. If validation fails, the filter is
silently dropped and a basic x_search tool is
used instead.
The web search plugin supports the following options for the engine parameter:
native: Always uses the model provider’s built-in web search capabilitiesexa: Uses Exa’s search API for web resultsfirecrawl: Uses Firecrawl’s search APIparallel: Uses Parallel’s search API for web resultsundefined (not specified): Uses native search if available for the provider, otherwise falls back to ExaWhen the engine parameter is not specified:
When you explicitly specify "engine": "native", it will always attempt to use the provider’s native search, even if the model doesn’t support it (which may result in an error).
You can explicitly specify which engine to use:
Or force Exa search even for models that support native search:
Firecrawl is a BYOK (bring your own key) search engine. To use it:
Once set up, Firecrawl searches use your Firecrawl credits directly — there is no additional charge from OpenRouter.
Firecrawl supports include_domains and exclude_domains, but they are mutually exclusive — you cannot use both in the same request.
Parallel is a search engine that supports domain filtering and uses OpenRouter credits at $0.005 per request. Includes up to 10 results in a request, then $0.001 per additional result.
When using Exa search (either explicitly via "engine": "exa" or as fallback), the web plugin uses your OpenRouter credits and charges $0.005 per request. This includes up to 10 results; additional results are charged at $0.001 each, in addition to the LLM usage for the search result prompt tokens.
Some models have built-in web search. These models charge a fee based on the search context size, which determines how much search data is retrieved and processed for a query.
Search context can be ‘low’, ‘medium’, or ‘high’ and determines how much search context is retrieved for a query:
You can specify the search context size in your API request using the web_search_options parameter:
Refer to each provider’s documentation for their native web search pricing info:
Native web search pricing only applies when using "engine": "native" or when native search is used by default for supported models. When using "engine": "exa", the Exa search pricing applies instead.