Web Search

Web Search

OpenRouter provides model-agnostic grounding for any model.

Getting Started

You can incorporate relevant web search results by activating and customizing the web plugin, or by simply appending :online to any model:

{
  "model": "openai/gpt-4o:online",
  "messages": [{
    "role": "user",
    "content": "What happened in the news today?"
  }]
}

This is a shortcut for using the web plugin:

{
  "model": "openrouter/auto", // Works with any model or router
  "plugins": [{ "id": "web" }] // See configuration options below
}

Conversations

When using the web plugin, the web search results are sent to the model as a system message right above the most recent user message. That user message is used to make prompt for querying the web (which we currently do using Exa.ai).

For each result, OpenRouter loads the title, URL, date, and a five-sentence summary (relevant to your user message) into context.

You can use the search_prompt to change the prefix used when the search results are summarized and listed.

Customizing the Web Plugin

The maximum results allowed by the web plugin and the prompt used to attach them to your message stream can be customized:

{
  "model": "openrouter/auto",
  "plugins": [
    {
      "id": "web",
      "max_results": 1, // Defaults to 5
      "search_prompt": "Some relevant web results:" // See default below
    }
  ]
}

By default, the web plugin uses the following search prompt, using the current date:

A web search was conducted on 2025-01-30T04:58:20.696Z. Incorporate the following web search results into your response. IMPORTANT: Cite them using markdown links named using the domain of the source. Example: [nytimes.com](https://nytimes.com/some-page).

Pricing

The web plugin uses your OpenRouter credits and charges $4 per 1000 results. By default, max_results is set to 5, so this comes out to a maximum of $0.02 per request, in addition to the LLM usage for the search result prompt tokens.

The number of results and the total cost of the web plugin are visible in the generation detail view on your Activity page.