Chat
Online mode
Any chat model can search the web. Add the web plugin to search before every answer, or pass the web_search tool to let the model decide whether a search is needed. Either way, the results are added to the prompt as real-time context. Appending :online to the model ID is shorthand for the web plugin.
Always search
Add a plugins array with the web plugin to the request body.
Plugin parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Plugin identifier. Use "web". |
max_results | integer | No | Number of search results added to the model's context. More results give broader context but use more tokens. Default: 5. |
engine | string | No | Search provider. Default: "exa", except on Perplexity, which always uses its native search. Set "native" or "auto" to use a provider's built-in search instead. |
A value you pass in engine is always honored; the Exa default applies only when you omit it.
Example
from openai import OpenAI
client = OpenAI(base_url="https://api.ppq.ai/v1", api_key="YOUR_API_KEY")
response = client.chat.completions.create(
model="claude-sonnet-5.5",
messages=[{"role": "user", "content": "What is the weather in Omaha, Nebraska right now?"}],
extra_body={"plugins": [{"id": "web", "max_results": 5}]},
)
print(response.choices[0].message.content)Search providers
The engine parameter selects one of two providers.
| Provider | Used for | Cost |
|---|---|---|
Exa (default) | Every model except Perplexity, unless you set engine. Exa is a search engine built for AI applications. | $0.02 per request, on top of the model's token price. |
Native search | Always on Perplexity. Models from OpenAI (GPT-5 and later), Anthropic (Claude), Gemini and Grok when you set "engine": "native". | Varies by provider. |
Let the model decide
Instead of the plugins array, pass the web_search tool. The model decides whether a search is needed and may skip it for questions it can already answer. Set the provider with parameters.engine; the same default applies.
curl https://api.ppq.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "claude-sonnet-5.5",
"tools": [{"type": "web_search"}],
"messages": [{"role": "user", "content": "Who won the 2026 World Cup?"}]
}'The legacy tool type "openrouter:web_search" is still accepted and behaves the same, so existing integrations keep working. Use web_search in new code.