You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Represents the 'Provider' object from the OpenRouter API."""
116
116
117
-
order: list[OpenRouterSlug]
117
+
order: list[OpenRouterProvider]
118
118
"""List of provider slugs to try in order (e.g. ["anthropic", "openai"]). [See details](https://openrouter.ai/docs/features/provider-routing#ordering-specific-providers)"""
119
119
120
120
allow_fallbacks: bool
@@ -129,7 +129,7 @@ class OpenRouterProviderConfig(TypedDict, total=False):
129
129
zdr: bool
130
130
"""Restrict routing to only ZDR (Zero Data Retention) endpoints. [See details](https://openrouter.ai/docs/features/provider-routing#zero-data-retention-enforcement)"""
131
131
132
-
only: list[OpenRouterSlug]
132
+
only: list[OpenRouterProvider]
133
133
"""List of provider slugs to allow for this request. [See details](https://openrouter.ai/docs/features/provider-routing#allowing-only-specific-providers)"""
134
134
135
135
ignore: list[str]
@@ -166,6 +166,36 @@ class OpenRouterReasoning(TypedDict, total=False):
166
166
"""Whether to enable reasoning with default parameters. Default is inferred from effort or max_tokens."""
167
167
168
168
169
+
classWebPlugin(TypedDict, total=False):
170
+
"""You can incorporate relevant web search results for any model on OpenRouter by activating and customizing the web plugin.
171
+
172
+
The web search plugin is powered by native search for Anthropic and OpenAI natively and by Exa for other models. For 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.
173
+
"""
174
+
175
+
id: Literal['web']
176
+
177
+
engine: Literal['native', 'exa', 'undefined']
178
+
"""The web search plugin supports the following options for the engine parameter:
179
+
180
+
`native`: Always uses the model provider's built-in web search capabilities
181
+
`exa`: Uses Exa's search API for web results
182
+
`undefined` (not specified): Uses native search if available for the provider, otherwise falls back to Exa
183
+
184
+
Native search is used by default for OpenAI and Anthropic models that support it
185
+
Exa search is used for all other models or when native search is not supported.
186
+
187
+
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)."""
188
+
189
+
max_results: int
190
+
"""The maximum results allowed by the web plugin."""
191
+
192
+
search_prompt: str
193
+
"""The prompt used to attach results to your message."""
"""Settings used for an OpenRouter model request."""
171
201
@@ -199,6 +229,8 @@ class OpenRouterModelSettings(ModelSettings, total=False):
199
229
The reasoning config object consolidates settings for controlling reasoning strength across different models. [See more](https://openrouter.ai/docs/use-cases/reasoning-tokens)
200
230
"""
201
231
232
+
openrouter_plugins: list[OpenRouterPlugin]
233
+
202
234
203
235
classOpenRouterError(BaseModel):
204
236
"""Utility class to validate error messages from OpenRouter."""
0 commit comments