Web Search

Model-agnostic grounding

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:

1{
2 "model": "openai/gpt-4o:online",
3}

This is a shortcut for using the web plugin:

1{
2 "model": "openrouter/auto",
3 "plugins": [{ "id": "web" }]
4}
5
6## Customizing the Web Plugin
7
8The maximum results allowed by the web plugin and the prompt used to attach them
9to your message stream can be customized:
10
11```json
12{
13 "model": "openai/gpt-4o:online",
14 "plugins": [
15 {
16 "id": "web",
17 "max_results": 1, // Defaults to 5
18 "search_prompt": "Some relevant web results:" // See default below
19 }
20 ]
21}

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

A web search was conducted on `date`. 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 set to 5, this comes out to a maximum of $0.02 per request, in addition to the LLM usage for the search result prompt tokens.

Built with