Compare commits

..
1 Commits
Author SHA1 Message Date
OpenRouter Team 13d706e274 Commits included in this export:
- 35d4e3137846cf3e0a5800e012692818f0dfe309
  - b2f10545419cea6b8a12c509f41ec4bd3937af0c
  - 2dbb7d9612a6e699caa91f334ad105dbde6442ee
  - 50539a3577b5a7e925b756f6bb87744052701215
  - 2cdbe64441ce4435ea0a1ff9127472e815fdaccf
  - f35bb49a8b788937fa61c0cf4591b14f2bc8b217
  - 08a37babde9ad8df5e24e0cd865d3292b1627464
  - 7ddc8e1ed230ca489bc11a5e14696c209ea76349
  - ad31290f38f3f02627f3e1953f1d7cf3e06159a5
  - fb7f764b500618e322f56d49997fbcfaebba7e39
  - 4306c032b9b4f3cfefeacdd3d243b0336f3b2f15

GitOrigin-RevId: 35d4e3137846cf3e0a5800e012692818f0dfe309
2026-03-17 02:59:58 +00:00
100 changed files with 3523 additions and 270 deletions
+63 -4
View File
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
management:
docChecksum: 74d4d2140677e899c1489f39198ea464
docChecksum: fff8b3c28663df858db3a222b1f62d40
docVersion: 1.0.0
speakeasyVersion: 1.666.0
generationVersion: 2.768.0
releaseVersion: 0.8.0
configChecksum: fd866e0d9d3fef2d1d0ef2a52689a406
releaseVersion: 0.9.0
configChecksum: e6f61aeb6e1587fb2f6f67ef3b5217c5
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true
@@ -74,6 +74,7 @@ generatedFiles:
- docs/components/chatgenerationparams.md
- docs/components/chatgenerationparamsby.md
- docs/components/chatgenerationparamsidautorouter.md
- docs/components/chatgenerationparamsidcontextcompression.md
- docs/components/chatgenerationparamsidfileparser.md
- docs/components/chatgenerationparamsidmoderation.md
- docs/components/chatgenerationparamsidresponsehealing.md
@@ -85,6 +86,7 @@ generatedFiles:
- docs/components/chatgenerationparamsorder.md
- docs/components/chatgenerationparamspartition.md
- docs/components/chatgenerationparamspluginautorouter.md
- docs/components/chatgenerationparamsplugincontextcompression.md
- docs/components/chatgenerationparamspluginfileparser.md
- docs/components/chatgenerationparamspluginmoderation.md
- docs/components/chatgenerationparamspluginresponsehealing.md
@@ -143,14 +145,19 @@ generatedFiles:
- docs/components/completiontokensdetails.md
- docs/components/compoundfilter.md
- docs/components/compoundfiltertype.md
- docs/components/conflictresponseerrordata.md
- docs/components/connectorid.md
- docs/components/container.md
- docs/components/containerauto.md
- docs/components/containertype.md
- docs/components/contextcompressionengine.md
- docs/components/costdetails.md
- docs/components/createchargerequest.md
- docs/components/data.md
- docs/components/datacollection.md
- docs/components/datetimeservertool.md
- docs/components/datetimeservertoolparameters.md
- docs/components/datetimeservertooltype.md
- docs/components/debugoptions.md
- docs/components/defaultparameters.md
- docs/components/developermessage.md
@@ -350,6 +357,7 @@ generatedFiles:
- docs/components/openresponsesreasoningtype.md
- docs/components/openresponsesrequest.md
- docs/components/openresponsesrequestidautorouter.md
- docs/components/openresponsesrequestidcontextcompression.md
- docs/components/openresponsesrequestidfileparser.md
- docs/components/openresponsesrequestidmoderation.md
- docs/components/openresponsesrequestidresponsehealing.md
@@ -360,6 +368,7 @@ generatedFiles:
- docs/components/openresponsesrequestonly.md
- docs/components/openresponsesrequestorder.md
- docs/components/openresponsesrequestpluginautorouter.md
- docs/components/openresponsesrequestplugincontextcompression.md
- docs/components/openresponsesrequestpluginfileparser.md
- docs/components/openresponsesrequestpluginmoderation.md
- docs/components/openresponsesrequestpluginresponsehealing.md
@@ -397,13 +406,25 @@ generatedFiles:
- docs/components/openresponsesstreameventtoplogprob2.md
- docs/components/openresponsesusage.md
- docs/components/openresponseswebsearch20250826tool.md
- docs/components/openresponseswebsearch20250826toolengine.md
- docs/components/openresponseswebsearch20250826toolfilters.md
- docs/components/openresponseswebsearch20250826tooltype.md
- docs/components/openresponseswebsearchcallcompleted.md
- docs/components/openresponseswebsearchcallcompletedtype.md
- docs/components/openresponseswebsearchcallinprogress.md
- docs/components/openresponseswebsearchcallinprogresstype.md
- docs/components/openresponseswebsearchcallsearching.md
- docs/components/openresponseswebsearchcallsearchingtype.md
- docs/components/openresponseswebsearchpreview20250311tool.md
- docs/components/openresponseswebsearchpreview20250311toolengine.md
- docs/components/openresponseswebsearchpreview20250311toolfilters.md
- docs/components/openresponseswebsearchpreview20250311tooltype.md
- docs/components/openresponseswebsearchpreviewtool.md
- docs/components/openresponseswebsearchpreviewtoolengine.md
- docs/components/openresponseswebsearchpreviewtoolfilters.md
- docs/components/openresponseswebsearchpreviewtooltype.md
- docs/components/openresponseswebsearchtool.md
- docs/components/openresponseswebsearchtoolengine.md
- docs/components/openresponseswebsearchtoolfilters.md
- docs/components/openresponseswebsearchtooltype.md
- docs/components/outputformat.md
@@ -550,7 +571,12 @@ generatedFiles:
- docs/components/responsesoutputmessagetype.md
- docs/components/responsesoutputmodality.md
- docs/components/responsessearchcontextsize.md
- docs/components/responsesservertooloutput.md
- docs/components/responsesservertooloutputstatus.md
- docs/components/responseswebsearchcalloutput.md
- docs/components/responseswebsearchservertool.md
- docs/components/responseswebsearchservertoolparameters.md
- docs/components/responseswebsearchservertooltype.md
- docs/components/responseswebsearchuserlocation.md
- docs/components/responseswebsearchuserlocationtype.md
- docs/components/responsetextconfig.md
@@ -573,6 +599,7 @@ generatedFiles:
- docs/components/toolchoiceoptionrequired.md
- docs/components/tooldefinitionjson.md
- docs/components/tooldefinitionjsonfunction.md
- docs/components/tooldefinitionjsonfunctionfunction.md
- docs/components/tooldefinitionjsontype.md
- docs/components/toolresponsemessage.md
- docs/components/toolresponsemessagecontent.md
@@ -620,9 +647,28 @@ generatedFiles:
- docs/components/websearchengine.md
- docs/components/websearchpreviewtooluserlocation.md
- docs/components/websearchpreviewtooluserlocationtype.md
- docs/components/websearchservertool.md
- docs/components/websearchservertoolengine.md
- docs/components/websearchservertoolparameters.md
- docs/components/websearchservertoolparameterstype.md
- docs/components/websearchservertoolsearchcontextsize.md
- docs/components/websearchservertooltypeopenrouterwebsearch.md
- docs/components/websearchservertooluserlocation.md
- docs/components/websearchshorthand.md
- docs/components/websearchshorthandengine.md
- docs/components/websearchshorthandparameters.md
- docs/components/websearchshorthandparametersengine.md
- docs/components/websearchshorthandparameterssearchcontextsize.md
- docs/components/websearchshorthandparameterstype.md
- docs/components/websearchshorthandparametersuserlocation.md
- docs/components/websearchshorthandsearchcontextsize.md
- docs/components/websearchshorthandtype.md
- docs/components/websearchshorthandtypeapproximate.md
- docs/components/websearchshorthanduserlocation.md
- docs/components/websearchstatus.md
- docs/errors/badgatewayresponseerror.md
- docs/errors/badrequestresponseerror.md
- docs/errors/conflictresponseerror.md
- docs/errors/edgenetworktimeoutresponseerror.md
- docs/errors/forbiddenresponseerror.md
- docs/errors/internalserverresponseerror.md
@@ -861,8 +907,11 @@ generatedFiles:
- src/openrouter/components/chatstreamingresponsechunk.py
- src/openrouter/components/chatstreamoptions.py
- src/openrouter/components/compoundfilter.py
- src/openrouter/components/conflictresponseerrordata.py
- src/openrouter/components/contextcompressionengine.py
- src/openrouter/components/createchargerequest.py
- src/openrouter/components/datacollection.py
- src/openrouter/components/datetimeservertool.py
- src/openrouter/components/debugoptions.py
- src/openrouter/components/defaultparameters.py
- src/openrouter/components/developermessage.py
@@ -929,6 +978,9 @@ generatedFiles:
- src/openrouter/components/openresponsesstreamevent.py
- src/openrouter/components/openresponsesusage.py
- src/openrouter/components/openresponseswebsearch20250826tool.py
- src/openrouter/components/openresponseswebsearchcallcompleted.py
- src/openrouter/components/openresponseswebsearchcallinprogress.py
- src/openrouter/components/openresponseswebsearchcallsearching.py
- src/openrouter/components/openresponseswebsearchpreview20250311tool.py
- src/openrouter/components/openresponseswebsearchpreviewtool.py
- src/openrouter/components/openresponseswebsearchtool.py
@@ -985,7 +1037,9 @@ generatedFiles:
- src/openrouter/components/responsesoutputmessage.py
- src/openrouter/components/responsesoutputmodality.py
- src/openrouter/components/responsessearchcontextsize.py
- src/openrouter/components/responsesservertooloutput.py
- src/openrouter/components/responseswebsearchcalloutput.py
- src/openrouter/components/responseswebsearchservertool.py
- src/openrouter/components/responseswebsearchuserlocation.py
- src/openrouter/components/responsetextconfig.py
- src/openrouter/components/security.py
@@ -1004,6 +1058,8 @@ generatedFiles:
- src/openrouter/components/videoinput.py
- src/openrouter/components/websearchengine.py
- src/openrouter/components/websearchpreviewtooluserlocation.py
- src/openrouter/components/websearchservertool.py
- src/openrouter/components/websearchshorthand.py
- src/openrouter/components/websearchstatus.py
- src/openrouter/credits.py
- src/openrouter/embeddings.py
@@ -1011,6 +1067,7 @@ generatedFiles:
- src/openrouter/errors/__init__.py
- src/openrouter/errors/badgatewayresponse_error.py
- src/openrouter/errors/badrequestresponse_error.py
- src/openrouter/errors/conflictresponse_error.py
- src/openrouter/errors/edgenetworktimeoutresponse_error.py
- src/openrouter/errors/forbiddenresponse_error.py
- src/openrouter/errors/internalserverresponse_error.py
@@ -1102,7 +1159,7 @@ examples:
application/json: {"store": false, "service_tier": "auto", "stream": false}
responses:
"200":
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "status": "completed", "completed_at": 2510.63, "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "content": [{"type": "output_text", "text": "Hello! How can I help you today?"}]}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "presence_penalty": 7468.94, "frequency_penalty": 3967.09, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "status": "completed", "completed_at": 2510.63, "output": [{"type": "message", "status": "completed"}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "presence_penalty": 7468.94, "frequency_penalty": 3967.09, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
"400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"401":
@@ -1420,6 +1477,8 @@ examples:
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
"409":
application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}}
sendChatCompletionRequest:
speakeasy-default-send-chat-completion-request:
requestBody:
+1 -1
View File
@@ -31,7 +31,7 @@ generation:
skipResponseBodyAssertions: false
preApplyUnionDiscriminators: true
python:
version: 0.8.0
version: 0.9.0
additionalDependencies:
dev: {}
main: {}
+743 -52
View File
@@ -589,6 +589,31 @@ components:
id: imagegen-abc123
result: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
status: completed
ResponsesServerToolOutput:
type: object
properties:
type:
type: string
pattern: '^openrouter:'
description: Server tool type (e.g. openrouter:datetime, openrouter:web_search)
id:
type: string
status:
type: string
enum:
- completed
- in_progress
- incomplete
required:
- type
- status
additionalProperties:
nullable: true
description: A generic OpenRouter server tool output item
example:
type: openrouter:web_search
id: ws_tmp_abc123
status: completed
ResponsesOutputItem:
anyOf:
- $ref: '#/components/schemas/ResponsesOutputMessage'
@@ -597,6 +622,7 @@ components:
- $ref: '#/components/schemas/ResponsesWebSearchCallOutput'
- $ref: '#/components/schemas/ResponsesOutputItemFileSearchCall'
- $ref: '#/components/schemas/ResponsesImageGenerationCall'
- $ref: '#/components/schemas/ResponsesServerToolOutput'
description: An output item from the response
example:
id: msg-abc123
@@ -1062,6 +1088,39 @@ components:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/WebSearchPreviewToolUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain
filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa
engine; ignored with native provider search.
example: 5
filters:
type: object
nullable: true
properties:
allowed_domains:
type: array
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
required:
- type
description: Web search preview tool configuration
@@ -1078,6 +1137,39 @@ components:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/WebSearchPreviewToolUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain
filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa
engine; ignored with native provider search.
example: 5
filters:
type: object
nullable: true
properties:
allowed_domains:
type: array
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
required:
- type
description: Web search preview tool configuration (2025-03-11 version)
@@ -1126,15 +1218,40 @@ components:
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
search_context_size:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/ResponsesWebSearchUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain
filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa
engine; ignored with native provider search.
example: 5
required:
- type
description: Web search tool configuration
example:
type: web_search
engine: auto
filters:
allowed_domains:
- example.com
@@ -1154,15 +1271,40 @@ components:
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
search_context_size:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/ResponsesWebSearchUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain
filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa
engine; ignored with native provider search.
example: 5
required:
- type
description: Web search tool configuration (2025-08-26 version)
example:
type: web_search_2025_08_26
engine: auto
filters:
allowed_domains:
- example.com
@@ -2973,6 +3115,93 @@ components:
output_index: 0
sequence_number: 4
item_id: call-123
OpenAIResponsesWebSearchCallInProgress:
type: object
properties:
type:
type: string
enum:
- response.web_search_call.in_progress
item_id:
type: string
output_index:
type: number
sequence_number:
type: number
required:
- type
- item_id
- output_index
- sequence_number
OpenResponsesWebSearchCallInProgress:
allOf:
- $ref: '#/components/schemas/OpenAIResponsesWebSearchCallInProgress'
- type: object
properties: {}
description: Web search call in progress
example:
type: response.web_search_call.in_progress
output_index: 0
sequence_number: 1
item_id: ws-123
OpenAIResponsesWebSearchCallSearching:
type: object
properties:
type:
type: string
enum:
- response.web_search_call.searching
item_id:
type: string
output_index:
type: number
sequence_number:
type: number
required:
- type
- item_id
- output_index
- sequence_number
OpenResponsesWebSearchCallSearching:
allOf:
- $ref: '#/components/schemas/OpenAIResponsesWebSearchCallSearching'
- type: object
properties: {}
description: Web search call is searching
example:
type: response.web_search_call.searching
output_index: 0
sequence_number: 2
item_id: ws-123
OpenAIResponsesSearchCompleted:
type: object
properties:
type:
type: string
enum:
- response.web_search_call.completed
item_id:
type: string
output_index:
type: number
sequence_number:
type: number
required:
- type
- item_id
- output_index
- sequence_number
OpenResponsesWebSearchCallCompleted:
allOf:
- $ref: '#/components/schemas/OpenAIResponsesSearchCompleted'
- type: object
properties: {}
description: Web search call completed
example:
type: response.web_search_call.completed
output_index: 0
sequence_number: 3
item_id: ws-123
OpenResponsesStreamEvent:
oneOf:
- allOf:
@@ -3360,6 +3589,9 @@ components:
- $ref: '#/components/schemas/OpenResponsesImageGenCallGenerating'
- $ref: '#/components/schemas/OpenResponsesImageGenCallPartialImage'
- $ref: '#/components/schemas/OpenResponsesImageGenCallCompleted'
- $ref: '#/components/schemas/OpenResponsesWebSearchCallInProgress'
- $ref: '#/components/schemas/OpenResponsesWebSearchCallSearching'
- $ref: '#/components/schemas/OpenResponsesWebSearchCallCompleted'
description: Union of all possible event types emitted during response streaming
example:
type: response.created
@@ -4100,10 +4332,41 @@ components:
- $ref: '#/components/schemas/ResponsesWebSearchCallOutput'
- $ref: '#/components/schemas/ResponsesOutputItemFileSearchCall'
- $ref: '#/components/schemas/ResponsesImageGenerationCall'
- $ref: '#/components/schemas/ResponsesServerToolOutput'
description: Input for a response request - can be a string or array of items
example:
- role: user
content: What is the weather today?
ResponsesWebSearchServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:web_search
parameters:
type: object
properties:
max_results:
type: number
minimum: 1
maximum: 25
description: Maximum number of search results to return per search call. Defaults to 5.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is
reached, the tool will stop returning new results.
example: 20
required:
- type
description: 'OpenRouter built-in server tool: searches the web for current information'
example:
type: openrouter:web_search
parameters:
max_results: 5
OpenResponsesResponseText:
allOf:
- $ref: '#/components/schemas/ResponseTextConfig'
@@ -4379,6 +4642,11 @@ components:
engine:
$ref: '#/components/schemas/PDFParserEngine'
description: Options for PDF parsing.
ContextCompressionEngine:
type: string
enum:
- middle-out
description: The compression engine to use. Defaults to "middle-out".
OpenResponsesRequest:
type: object
properties:
@@ -4392,7 +4660,7 @@ components:
tools:
type: array
items:
oneOf:
anyOf:
- allOf:
- $ref: '#/components/schemas/OpenResponsesFunctionTool'
- type: object
@@ -4428,6 +4696,8 @@ components:
- $ref: '#/components/schemas/OpenResponsesFunctionShellTool'
- $ref: '#/components/schemas/OpenResponsesApplyPatchTool'
- $ref: '#/components/schemas/OpenResponsesCustomTool'
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/ResponsesWebSearchServerTool'
tool_choice:
$ref: '#/components/schemas/OpenAIResponsesToolChoice'
parallel_tool_calls:
@@ -4740,6 +5010,19 @@ components:
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required:
- id
- type: object
properties:
id:
type: string
enum:
- context-compression
enabled:
type: boolean
description: Set to false to disable the context-compression plugin for this request. Defaults to true.
engine:
$ref: '#/components/schemas/ContextCompressionEngine'
required:
- id
description: Plugins you want to enable for this request, including their settings.
route:
type: string
@@ -9720,6 +10003,89 @@ components:
- role
- content
description: Anthropic message with OpenRouter extensions
AnthropicWebSearchServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:web_search
parameters:
type: object
properties:
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and
domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the
Exa engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is
reached, the tool will stop returning new results. Useful for controlling cost and context size in
agentic loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the
Exa engine; ignored with native provider search.
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native
provider search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native
provider search.
required:
- type
description: 'OpenRouter built-in server tool: searches the web for current information'
example:
type: openrouter:web_search
parameters:
max_results: 5
AnthropicOutputConfig:
type: object
properties:
@@ -9940,7 +10306,7 @@ components:
tools:
type: array
items:
oneOf:
anyOf:
- type: object
properties:
name:
@@ -10099,6 +10465,8 @@ components:
required:
- type
- name
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/AnthropicWebSearchServerTool'
tool_choice:
oneOf:
- type: object
@@ -10541,6 +10909,19 @@ components:
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required:
- id
- type: object
properties:
id:
type: string
enum:
- context-compression
enabled:
type: boolean
description: Set to false to disable the context-compression plugin for this request. Defaults to true.
engine:
$ref: '#/components/schemas/ContextCompressionEngine'
required:
- id
description: Plugins you want to enable for this request, including their settings.
route:
type: string
@@ -11835,63 +12216,320 @@ components:
- $ref: '#/components/schemas/NamedToolChoice'
description: Tool choice configuration
example: auto
ToolDefinitionJson:
DatetimeServerTool:
type: object
properties:
type:
type: string
enum:
- function
function:
- openrouter:datetime
parameters:
type: object
properties:
name:
timezone:
type: string
maxLength: 64
description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)
example: get_weather
description:
type: string
description: Function description for the model
example: Get the current weather for a location
parameters:
type: object
additionalProperties:
nullable: true
description: Function parameters as JSON Schema object
example:
type: object
properties:
location:
type: string
description: City name
required:
- location
strict:
type: boolean
nullable: true
description: Enable strict schema adherence
example: false
required:
- name
description: Function definition for tool calling
example:
name: get_weather
description: Get the current weather for a location
parameters:
type: object
properties:
location:
type: string
description: City name
required:
- location
cache_control:
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
description: IANA timezone name (e.g. "America/New_York"). Defaults to UTC.
example: America/New_York
required:
- type
- function
description: Tool definition for function calling
description: 'OpenRouter built-in server tool: returns the current date and time'
example:
type: openrouter:datetime
parameters:
timezone: America/New_York
WebSearchServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:web_search
parameters:
type: object
properties:
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and
domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the
Exa engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is
reached, the tool will stop returning new results. Useful for controlling cost and context size in
agentic loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the
Exa engine; ignored with native provider search.
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native
provider search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native
provider search.
required:
- type
description: 'OpenRouter built-in server tool: searches the web for current information'
example:
type: openrouter:web_search
parameters:
engine: auto
max_results: 5
WebSearchShorthand:
type: object
properties:
type:
type: string
enum:
- web_search
- web_search_preview
- web_search_preview_2025_03_11
- web_search_2025_08_26
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain
filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa
engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is
reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic
loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa
engine; ignored with native provider search.
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider
search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native
provider search.
parameters:
type: object
properties:
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa.
"native" forces the provider's built-in search (parameters like max_results, search_context_size, and
domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the
Exa engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is
reached, the tool will stop returning new results. Useful for controlling cost and context size in
agentic loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the
Exa engine; ignored with native provider search.
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native
provider search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native
provider search.
required:
- type
description: Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search.
ToolDefinitionJson:
anyOf:
- type: object
properties:
type:
type: string
enum:
- function
function:
type: object
properties:
name:
type: string
maxLength: 64
description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)
example: get_weather
description:
type: string
description: Function description for the model
example: Get the current weather for a location
parameters:
type: object
additionalProperties:
nullable: true
description: Function parameters as JSON Schema object
example:
type: object
properties:
location:
type: string
description: City name
required:
- location
strict:
type: boolean
nullable: true
description: Enable strict schema adherence
example: false
required:
- name
description: Function definition for tool calling
example:
name: get_weather
description: Get the current weather for a location
parameters:
type: object
properties:
location:
type: string
description: City name
required:
- location
cache_control:
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
required:
- type
- function
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/WebSearchServerTool'
- $ref: '#/components/schemas/WebSearchShorthand'
description: Tool definition for function calling (regular function or OpenRouter built-in server tool)
example:
type: function
function:
@@ -12137,6 +12775,19 @@ components:
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required:
- id
- type: object
properties:
id:
type: string
enum:
- context-compression
enabled:
type: boolean
description: Set to false to disable the context-compression plugin for this request. Defaults to true.
engine:
$ref: '#/components/schemas/ContextCompressionEngine'
required:
- id
description: Plugins you want to enable for this request, including their settings.
route:
type: string
@@ -13310,6 +13961,40 @@ components:
p75: 38.5
p90: 28.3
p99: 15.1
ConflictResponseErrorData:
type: object
properties:
code:
type: integer
message:
type: string
metadata:
type: object
nullable: true
additionalProperties:
nullable: true
required:
- code
- message
description: Error data for ConflictResponse
example:
code: 409
message: Resource conflict. Please try again later.
ConflictResponse:
type: object
properties:
error:
$ref: '#/components/schemas/ConflictResponseErrorData'
user_id:
type: string
nullable: true
required:
- error
description: Conflict - Resource conflict or concurrent modification
example:
error:
code: 409
message: Resource conflict. Please try again later.
parameters: {}
securitySchemes:
apiKey:
@@ -14679,7 +15364,7 @@ paths:
description: >-
Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio,
embeddings) or "all" to include all models. Defaults to "text".
name: output_modality
name: output_modalities
in: query
responses:
'200':
@@ -14689,7 +15374,7 @@ paths:
schema:
$ref: '#/components/schemas/ModelsCountResponse'
'400':
description: Bad Request - Invalid output_modality value
description: Bad Request - Invalid output_modalities value
content:
application/json:
schema:
@@ -14744,7 +15429,7 @@ paths:
description: >-
Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio,
embeddings) or "all" to include all models. Defaults to "text".
name: output_modality
name: output_modalities
in: query
- schema:
type: string
@@ -17846,6 +18531,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedResponse'
'409':
description: Conflict - App upsert conflict during auth code creation
content:
application/json:
schema:
$ref: '#/components/schemas/ConflictResponse'
'500':
description: Internal Server Error - Unexpected server error
content:
+712 -52
View File
@@ -591,6 +591,32 @@ components:
id: imagegen-abc123
result: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
status: completed
ResponsesServerToolOutput:
type: object
properties:
type:
type: string
pattern: '^openrouter:'
description: Server tool type (e.g. openrouter:datetime, openrouter:web_search)
id:
type: string
status:
type: string
enum:
- completed
- in_progress
- incomplete
x-speakeasy-unknown-values: allow
required:
- type
- status
additionalProperties:
nullable: true
description: A generic OpenRouter server tool output item
example:
type: openrouter:web_search
id: ws_tmp_abc123
status: completed
ResponsesOutputItem:
anyOf:
- $ref: '#/components/schemas/ResponsesOutputMessage'
@@ -599,6 +625,7 @@ components:
- $ref: '#/components/schemas/ResponsesWebSearchCallOutput'
- $ref: '#/components/schemas/ResponsesOutputItemFileSearchCall'
- $ref: '#/components/schemas/ResponsesImageGenerationCall'
- $ref: '#/components/schemas/ResponsesServerToolOutput'
description: An output item from the response
example:
id: msg-abc123
@@ -1070,6 +1097,37 @@ components:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/WebSearchPreviewToolUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
filters:
type: object
nullable: true
properties:
allowed_domains:
type: array
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
required:
- type
description: Web search preview tool configuration
@@ -1086,6 +1144,37 @@ components:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/WebSearchPreviewToolUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
filters:
type: object
nullable: true
properties:
allowed_domains:
type: array
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
required:
- type
description: Web search preview tool configuration (2025-03-11 version)
@@ -1134,15 +1223,38 @@ components:
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
search_context_size:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/ResponsesWebSearchUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
required:
- type
description: Web search tool configuration
example:
type: web_search
engine: auto
filters:
allowed_domains:
- example.com
@@ -1162,15 +1274,38 @@ components:
nullable: true
items:
type: string
excluded_domains:
type: array
nullable: true
items:
type: string
search_context_size:
$ref: '#/components/schemas/ResponsesSearchContextSize'
user_location:
$ref: '#/components/schemas/ResponsesWebSearchUserLocation'
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
required:
- type
description: Web search tool configuration (2025-08-26 version)
example:
type: web_search_2025_08_26
engine: auto
filters:
allowed_domains:
- example.com
@@ -3001,6 +3136,93 @@ components:
output_index: 0
sequence_number: 4
item_id: call-123
OpenAIResponsesWebSearchCallInProgress:
type: object
properties:
type:
type: string
enum:
- response.web_search_call.in_progress
item_id:
type: string
output_index:
type: number
sequence_number:
type: number
required:
- type
- item_id
- output_index
- sequence_number
OpenResponsesWebSearchCallInProgress:
allOf:
- $ref: '#/components/schemas/OpenAIResponsesWebSearchCallInProgress'
- type: object
properties: {}
description: Web search call in progress
example:
type: response.web_search_call.in_progress
output_index: 0
sequence_number: 1
item_id: ws-123
OpenAIResponsesWebSearchCallSearching:
type: object
properties:
type:
type: string
enum:
- response.web_search_call.searching
item_id:
type: string
output_index:
type: number
sequence_number:
type: number
required:
- type
- item_id
- output_index
- sequence_number
OpenResponsesWebSearchCallSearching:
allOf:
- $ref: '#/components/schemas/OpenAIResponsesWebSearchCallSearching'
- type: object
properties: {}
description: Web search call is searching
example:
type: response.web_search_call.searching
output_index: 0
sequence_number: 2
item_id: ws-123
OpenAIResponsesSearchCompleted:
type: object
properties:
type:
type: string
enum:
- response.web_search_call.completed
item_id:
type: string
output_index:
type: number
sequence_number:
type: number
required:
- type
- item_id
- output_index
- sequence_number
OpenResponsesWebSearchCallCompleted:
allOf:
- $ref: '#/components/schemas/OpenAIResponsesSearchCompleted'
- type: object
properties: {}
description: Web search call completed
example:
type: response.web_search_call.completed
output_index: 0
sequence_number: 3
item_id: ws-123
OpenResponsesStreamEvent:
oneOf:
- allOf:
@@ -3388,6 +3610,9 @@ components:
- $ref: '#/components/schemas/OpenResponsesImageGenCallGenerating'
- $ref: '#/components/schemas/OpenResponsesImageGenCallPartialImage'
- $ref: '#/components/schemas/OpenResponsesImageGenCallCompleted'
- $ref: '#/components/schemas/OpenResponsesWebSearchCallInProgress'
- $ref: '#/components/schemas/OpenResponsesWebSearchCallSearching'
- $ref: '#/components/schemas/OpenResponsesWebSearchCallCompleted'
description: Union of all possible event types emitted during response streaming
example:
type: response.created
@@ -4127,10 +4352,40 @@ components:
- $ref: '#/components/schemas/ResponsesWebSearchCallOutput'
- $ref: '#/components/schemas/ResponsesOutputItemFileSearchCall'
- $ref: '#/components/schemas/ResponsesImageGenerationCall'
- $ref: '#/components/schemas/ResponsesServerToolOutput'
description: Input for a response request - can be a string or array of items
example:
- role: user
content: What is the weather today?
ResponsesWebSearchServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:web_search
parameters:
type: object
properties:
max_results:
type: number
minimum: 1
maximum: 25
description: Maximum number of search results to return per search call. Defaults to 5.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results.
example: 20
required:
- type
description: 'OpenRouter built-in server tool: searches the web for current information'
example:
type: openrouter:web_search
parameters:
max_results: 5
OpenResponsesResponseText:
allOf:
- $ref: '#/components/schemas/ResponseTextConfig'
@@ -4408,6 +4663,11 @@ components:
engine:
$ref: '#/components/schemas/PDFParserEngine'
description: Options for PDF parsing.
ContextCompressionEngine:
type: string
enum:
- middle-out
description: The compression engine to use. Defaults to "middle-out".
OpenResponsesRequest:
type: object
properties:
@@ -4421,7 +4681,7 @@ components:
tools:
type: array
items:
oneOf:
anyOf:
- allOf:
- $ref: '#/components/schemas/OpenResponsesFunctionTool'
- type: object
@@ -4458,6 +4718,8 @@ components:
- $ref: '#/components/schemas/OpenResponsesFunctionShellTool'
- $ref: '#/components/schemas/OpenResponsesApplyPatchTool'
- $ref: '#/components/schemas/OpenResponsesCustomTool'
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/ResponsesWebSearchServerTool'
tool_choice:
$ref: '#/components/schemas/OpenAIResponsesToolChoice'
parallel_tool_calls:
@@ -4755,6 +5017,19 @@ components:
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required:
- id
- type: object
properties:
id:
type: string
enum:
- context-compression
enabled:
type: boolean
description: Set to false to disable the context-compression plugin for this request. Defaults to true.
engine:
$ref: '#/components/schemas/ContextCompressionEngine'
required:
- id
description: Plugins you want to enable for this request, including their settings.
route:
type: string
@@ -9784,6 +10059,83 @@ components:
- role
- content
description: Anthropic message with OpenRouter extensions
AnthropicWebSearchServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:web_search
parameters:
type: object
properties:
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search.
x-speakeasy-unknown-values: allow
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search.
required:
- type
description: 'OpenRouter built-in server tool: searches the web for current information'
example:
type: openrouter:web_search
parameters:
max_results: 5
AnthropicOutputConfig:
type: object
properties:
@@ -10004,7 +10356,7 @@ components:
tools:
type: array
items:
oneOf:
anyOf:
- type: object
properties:
name:
@@ -10167,6 +10519,8 @@ components:
required:
- type
- name
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/AnthropicWebSearchServerTool'
tool_choice:
oneOf:
- type: object
@@ -10597,6 +10951,19 @@ components:
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required:
- id
- type: object
properties:
id:
type: string
enum:
- context-compression
enabled:
type: boolean
description: Set to false to disable the context-compression plugin for this request. Defaults to true.
engine:
$ref: '#/components/schemas/ContextCompressionEngine'
required:
- id
description: Plugins you want to enable for this request, including their settings.
route:
type: string
@@ -11890,63 +12257,303 @@ components:
- $ref: '#/components/schemas/NamedToolChoice'
description: Tool choice configuration
example: auto
ToolDefinitionJson:
DatetimeServerTool:
type: object
properties:
type:
type: string
enum:
- function
function:
- openrouter:datetime
parameters:
type: object
properties:
name:
timezone:
type: string
maxLength: 64
description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)
example: get_weather
description:
type: string
description: Function description for the model
example: Get the current weather for a location
parameters:
type: object
additionalProperties:
nullable: true
description: Function parameters as JSON Schema object
example:
type: object
properties:
location:
type: string
description: City name
required:
- location
strict:
type: boolean
nullable: true
description: Enable strict schema adherence
example: false
required:
- name
description: Function definition for tool calling
example:
name: get_weather
description: Get the current weather for a location
parameters:
type: object
properties:
location:
type: string
description: City name
required:
- location
cache_control:
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
description: IANA timezone name (e.g. "America/New_York"). Defaults to UTC.
example: America/New_York
required:
- type
- function
description: Tool definition for function calling
description: 'OpenRouter built-in server tool: returns the current date and time'
example:
type: openrouter:datetime
parameters:
timezone: America/New_York
WebSearchServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:web_search
parameters:
type: object
properties:
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search.
x-speakeasy-unknown-values: allow
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search.
required:
- type
description: 'OpenRouter built-in server tool: searches the web for current information'
example:
type: openrouter:web_search
parameters:
engine: auto
max_results: 5
WebSearchShorthand:
type: object
properties:
type:
type: string
enum:
- web_search
- web_search_preview
- web_search_preview_2025_03_11
- web_search_2025_08_26
x-speakeasy-unknown-values: allow
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search.
x-speakeasy-unknown-values: allow
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search.
parameters:
type: object
properties:
engine:
type: string
enum:
- auto
- native
- exa
description: >-
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
example: auto
x-speakeasy-unknown-values: allow
max_results:
type: number
minimum: 1
maximum: 25
description: >-
Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search.
example: 5
max_total_results:
type: number
minimum: 1
description: >-
Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops.
example: 20
search_context_size:
type: string
enum:
- low
- medium
- high
description: >-
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search.
x-speakeasy-unknown-values: allow
user_location:
type: object
properties:
type:
type: string
enum:
- approximate
city:
type: string
region:
type: string
country:
type: string
timezone:
type: string
description: Approximate user location for location-biased results.
allowed_domains:
type: array
items:
type: string
description: >-
Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search.
excluded_domains:
type: array
items:
type: string
description: >-
Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search.
required:
- type
description: Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search.
ToolDefinitionJson:
anyOf:
- type: object
properties:
type:
type: string
enum:
- function
function:
type: object
properties:
name:
type: string
maxLength: 64
description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)
example: get_weather
description:
type: string
description: Function description for the model
example: Get the current weather for a location
parameters:
type: object
additionalProperties:
nullable: true
description: Function parameters as JSON Schema object
example:
type: object
properties:
location:
type: string
description: City name
required:
- location
strict:
type: boolean
nullable: true
description: Enable strict schema adherence
example: false
required:
- name
description: Function definition for tool calling
example:
name: get_weather
description: Get the current weather for a location
parameters:
type: object
properties:
location:
type: string
description: City name
required:
- location
cache_control:
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
required:
- type
- function
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/WebSearchServerTool'
- $ref: '#/components/schemas/WebSearchShorthand'
description: Tool definition for function calling (regular function or OpenRouter built-in server tool)
example:
type: function
function:
@@ -12178,6 +12785,19 @@ components:
description: Set to false to disable the response-healing plugin for this request. Defaults to true.
required:
- id
- type: object
properties:
id:
type: string
enum:
- context-compression
enabled:
type: boolean
description: Set to false to disable the context-compression plugin for this request. Defaults to true.
engine:
$ref: '#/components/schemas/ContextCompressionEngine'
required:
- id
description: Plugins you want to enable for this request, including their settings.
route:
type: string
@@ -13343,6 +13963,40 @@ components:
p75: 38.5
p90: 28.3
p99: 15.1
ConflictResponseErrorData:
type: object
properties:
code:
type: integer
message:
type: string
metadata:
type: object
nullable: true
additionalProperties:
nullable: true
required:
- code
- message
description: Error data for ConflictResponse
example:
code: 409
message: Resource conflict. Please try again later.
ConflictResponse:
type: object
properties:
error:
$ref: '#/components/schemas/ConflictResponseErrorData'
user_id:
type: string
nullable: true
required:
- error
description: Conflict - Resource conflict or concurrent modification
example:
error:
code: 409
message: Resource conflict. Please try again later.
parameters: {AppIdentifier: {name: HTTP-Referer, in: header, schema: {type: string}, description: "The app identifier should be your app's URL and is used as the primary identifier for rankings.\nThis is used to track API usage per application.\n"}, AppDisplayName: {name: X-OpenRouter-Title, in: header, schema: {type: string}, description: "The app display name allows you to customize how your app appears in OpenRouter's dashboard.\n"}, AppCategories: {name: X-OpenRouter-Categories, in: header, schema: {type: string}, description: "Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.\n"}}
securitySchemes:
apiKey:
@@ -14745,7 +15399,7 @@ paths:
required: false
description: >-
Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text".
name: output_modality
name: output_modalities
in: query
responses:
'200':
@@ -14755,7 +15409,7 @@ paths:
schema:
$ref: '#/components/schemas/ModelsCountResponse'
'400':
description: Bad Request - Invalid output_modality value
description: Bad Request - Invalid output_modalities value
content:
application/json:
schema:
@@ -14813,7 +15467,7 @@ paths:
required: false
description: >-
Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text".
name: output_modality
name: output_modalities
in: query
responses:
'200':
@@ -17961,6 +18615,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedResponse'
'409':
description: Conflict - App upsert conflict during auth code creation
content:
application/json:
schema:
$ref: '#/components/schemas/ConflictResponse'
'500':
description: Internal Server Error - Unexpected server error
content:
+5 -5
View File
@@ -8,8 +8,8 @@ sources:
- latest
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:2fa3ed22056b6be20af56e6548a094381d1d32359ecdfec536c73556fc9717aa
sourceBlobDigest: sha256:f445d8b8c9319ec5f7ab85c2b6194692070cc259047254a08a6b1c127cef09dd
sourceRevisionDigest: sha256:33bc86b7a9b24082a410a8b5cbdd05ee359c9be2c88a2947893942d6bca20dca
sourceBlobDigest: sha256:63c840be5dfe448c1d3f6ec9c15e1d92d117b35cccd134b1e736e1fb563d013d
tags:
- latest
- main
@@ -18,10 +18,10 @@ targets:
open-router:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:2fa3ed22056b6be20af56e6548a094381d1d32359ecdfec536c73556fc9717aa
sourceBlobDigest: sha256:f445d8b8c9319ec5f7ab85c2b6194692070cc259047254a08a6b1c127cef09dd
sourceRevisionDigest: sha256:33bc86b7a9b24082a410a8b5cbdd05ee359c9be2c88a2947893942d6bca20dca
sourceBlobDigest: sha256:63c840be5dfe448c1d3f6ec9c15e1d92d117b35cccd134b1e736e1fb563d013d
codeSamplesNamespace: open-router-python-code-samples
codeSamplesRevisionDigest: sha256:8c9d4cec31e4cfe341de1c43b2f557a838837aad7923f86a2eb62ae3c95d09a9
codeSamplesRevisionDigest: sha256:b23dcc24419d8d006315e89e7a2fe131e28d72f19edb4fa920c97658e9e78073
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.666.0
@@ -0,0 +1,8 @@
# ChatGenerationParamsIDContextCompression
## Values
| Name | Value |
| --------------------- | --------------------- |
| `CONTEXT_COMPRESSION` | context-compression |
@@ -0,0 +1,10 @@
# ChatGenerationParamsPluginContextCompression
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `id` | [components.ChatGenerationParamsIDContextCompression](../components/chatgenerationparamsidcontextcompression.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the context-compression plugin for this request. Defaults to true. |
| `engine` | [Optional[components.ContextCompressionEngine]](../components/contextcompressionengine.md) | :heavy_minus_sign: | The compression engine to use. Defaults to "middle-out". |
@@ -33,3 +33,9 @@ value: components.ChatGenerationParamsPluginFileParser = /* values here */
value: components.ChatGenerationParamsPluginResponseHealing = /* values here */
```
### `components.ChatGenerationParamsPluginContextCompression`
```python
value: components.ChatGenerationParamsPluginContextCompression = /* values here */
```
@@ -0,0 +1,12 @@
# ConflictResponseErrorData
Error data for ConflictResponse
## Fields
| Field | Type | Required | Description |
| -------------------------- | -------------------------- | -------------------------- | -------------------------- |
| `code` | *int* | :heavy_check_mark: | N/A |
| `message` | *str* | :heavy_check_mark: | N/A |
| `metadata` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
@@ -0,0 +1,10 @@
# ContextCompressionEngine
The compression engine to use. Defaults to "middle-out".
## Values
| Name | Value |
| ------------ | ------------ |
| `MIDDLE_OUT` | middle-out |
+11
View File
@@ -0,0 +1,11 @@
# DatetimeServerTool
OpenRouter built-in server tool: returns the current date and time
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `type` | [components.DatetimeServerToolType](../components/datetimeservertooltype.md) | :heavy_check_mark: | N/A |
| `parameters` | [Optional[components.DatetimeServerToolParameters]](../components/datetimeservertoolparameters.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,8 @@
# DatetimeServerToolParameters
## Fields
| Field | Type | Required | Description | Example |
| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- |
| `timezone` | *Optional[str]* | :heavy_minus_sign: | IANA timezone name (e.g. "America/New_York"). Defaults to UTC. | America/New_York |
@@ -0,0 +1,8 @@
# DatetimeServerToolType
## Values
| Name | Value |
| --------------------- | --------------------- |
| `OPENROUTER_DATETIME` | openrouter:datetime |
@@ -69,3 +69,9 @@ value: components.ResponsesOutputItemFileSearchCall = /* values here */
value: components.ResponsesImageGenerationCall = /* values here */
```
### `components.ResponsesServerToolOutput`
```python
value: components.ResponsesServerToolOutput = /* values here */
```
@@ -0,0 +1,8 @@
# OpenResponsesRequestIDContextCompression
## Values
| Name | Value |
| --------------------- | --------------------- |
| `CONTEXT_COMPRESSION` | context-compression |
@@ -0,0 +1,10 @@
# OpenResponsesRequestPluginContextCompression
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `id` | [components.OpenResponsesRequestIDContextCompression](../components/openresponsesrequestidcontextcompression.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the context-compression plugin for this request. Defaults to true. |
| `engine` | [Optional[components.ContextCompressionEngine]](../components/contextcompressionengine.md) | :heavy_minus_sign: | The compression engine to use. Defaults to "middle-out". |
@@ -33,3 +33,9 @@ value: components.OpenResponsesRequestPluginFileParser = /* values here */
value: components.OpenResponsesRequestPluginResponseHealing = /* values here */
```
### `components.OpenResponsesRequestPluginContextCompression`
```python
value: components.OpenResponsesRequestPluginContextCompression = /* values here */
```
@@ -87,3 +87,15 @@ value: components.OpenResponsesApplyPatchTool = /* values here */
value: components.OpenResponsesCustomTool = /* values here */
```
### `components.DatetimeServerTool`
```python
value: components.DatetimeServerTool = /* values here */
```
### `components.ResponsesWebSearchServerTool`
```python
value: components.ResponsesWebSearchServerTool = /* values here */
```
@@ -167,3 +167,21 @@ value: components.OpenResponsesImageGenCallPartialImage = /* values here */
value: components.OpenResponsesImageGenCallCompleted = /* values here */
```
### `components.OpenResponsesWebSearchCallInProgress`
```python
value: components.OpenResponsesWebSearchCallInProgress = /* values here */
```
### `components.OpenResponsesWebSearchCallSearching`
```python
value: components.OpenResponsesWebSearchCallSearching = /* values here */
```
### `components.OpenResponsesWebSearchCallCompleted`
```python
value: components.OpenResponsesWebSearchCallCompleted = /* values here */
```
@@ -5,9 +5,11 @@ Web search tool configuration (2025-08-26 version)
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| `type` | [components.OpenResponsesWebSearch20250826ToolType](../components/openresponseswebsearch20250826tooltype.md) | :heavy_check_mark: | N/A | |
| `filters` | [OptionalNullable[components.OpenResponsesWebSearch20250826ToolFilters]](../components/openresponseswebsearch20250826toolfilters.md) | :heavy_minus_sign: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.ResponsesWebSearchUserLocation]](../components/responseswebsearchuserlocation.md) | :heavy_minus_sign: | User location information for web search | {<br/>"type": "approximate",<br/>"city": "San Francisco",<br/>"country": "USA",<br/>"region": "California",<br/>"timezone": "America/Los_Angeles"<br/>} |
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearch20250826ToolType](../components/openresponseswebsearch20250826tooltype.md) | :heavy_check_mark: | N/A | |
| `filters` | [OptionalNullable[components.OpenResponsesWebSearch20250826ToolFilters]](../components/openresponseswebsearch20250826toolfilters.md) | :heavy_minus_sign: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.ResponsesWebSearchUserLocation]](../components/responseswebsearchuserlocation.md) | :heavy_minus_sign: | User location information for web search | {<br/>"type": "approximate",<br/>"city": "San Francisco",<br/>"country": "USA",<br/>"region": "California",<br/>"timezone": "America/Los_Angeles"<br/>} |
| `engine` | [Optional[components.OpenResponsesWebSearch20250826ToolEngine]](../components/openresponseswebsearch20250826toolengine.md) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API. | auto |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search. | 5 |
@@ -0,0 +1,12 @@
# OpenResponsesWebSearch20250826ToolEngine
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
## Values
| Name | Value |
| -------- | -------- |
| `AUTO` | auto |
| `NATIVE` | native |
| `EXA` | exa |
@@ -5,4 +5,5 @@
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | N/A |
@@ -0,0 +1,13 @@
# OpenResponsesWebSearchCallCompleted
Web search call completed
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchCallCompletedType](../components/openresponseswebsearchcallcompletedtype.md) | :heavy_check_mark: | N/A |
| `item_id` | *str* | :heavy_check_mark: | N/A |
| `output_index` | *float* | :heavy_check_mark: | N/A |
| `sequence_number` | *float* | :heavy_check_mark: | N/A |
@@ -0,0 +1,8 @@
# OpenResponsesWebSearchCallCompletedType
## Values
| Name | Value |
| ------------------------------------ | ------------------------------------ |
| `RESPONSE_WEB_SEARCH_CALL_COMPLETED` | response.web_search_call.completed |
@@ -0,0 +1,13 @@
# OpenResponsesWebSearchCallInProgress
Web search call in progress
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchCallInProgressType](../components/openresponseswebsearchcallinprogresstype.md) | :heavy_check_mark: | N/A |
| `item_id` | *str* | :heavy_check_mark: | N/A |
| `output_index` | *float* | :heavy_check_mark: | N/A |
| `sequence_number` | *float* | :heavy_check_mark: | N/A |
@@ -0,0 +1,8 @@
# OpenResponsesWebSearchCallInProgressType
## Values
| Name | Value |
| -------------------------------------- | -------------------------------------- |
| `RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS` | response.web_search_call.in_progress |
@@ -0,0 +1,13 @@
# OpenResponsesWebSearchCallSearching
Web search call is searching
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchCallSearchingType](../components/openresponseswebsearchcallsearchingtype.md) | :heavy_check_mark: | N/A |
| `item_id` | *str* | :heavy_check_mark: | N/A |
| `output_index` | *float* | :heavy_check_mark: | N/A |
| `sequence_number` | *float* | :heavy_check_mark: | N/A |
@@ -0,0 +1,8 @@
# OpenResponsesWebSearchCallSearchingType
## Values
| Name | Value |
| ------------------------------------ | ------------------------------------ |
| `RESPONSE_WEB_SEARCH_CALL_SEARCHING` | response.web_search_call.searching |
@@ -5,8 +5,11 @@ Web search preview tool configuration (2025-03-11 version)
## Fields
| Field | Type | Required | Description | Example |
| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchPreview20250311ToolType](../components/openresponseswebsearchpreview20250311tooltype.md) | :heavy_check_mark: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.WebSearchPreviewToolUserLocation]](../components/websearchpreviewtooluserlocation.md) | :heavy_minus_sign: | N/A | |
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchPreview20250311ToolType](../components/openresponseswebsearchpreview20250311tooltype.md) | :heavy_check_mark: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.WebSearchPreviewToolUserLocation]](../components/websearchpreviewtooluserlocation.md) | :heavy_minus_sign: | N/A | |
| `engine` | [Optional[components.OpenResponsesWebSearchPreview20250311ToolEngine]](../components/openresponseswebsearchpreview20250311toolengine.md) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API. | auto |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search. | 5 |
| `filters` | [OptionalNullable[components.OpenResponsesWebSearchPreview20250311ToolFilters]](../components/openresponseswebsearchpreview20250311toolfilters.md) | :heavy_minus_sign: | N/A | |
@@ -0,0 +1,12 @@
# OpenResponsesWebSearchPreview20250311ToolEngine
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
## Values
| Name | Value |
| -------- | -------- |
| `AUTO` | auto |
| `NATIVE` | native |
| `EXA` | exa |
@@ -0,0 +1,9 @@
# OpenResponsesWebSearchPreview20250311ToolFilters
## Fields
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | N/A |
@@ -5,8 +5,11 @@ Web search preview tool configuration
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `type` | [components.OpenResponsesWebSearchPreviewToolType](../components/openresponseswebsearchpreviewtooltype.md) | :heavy_check_mark: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.WebSearchPreviewToolUserLocation]](../components/websearchpreviewtooluserlocation.md) | :heavy_minus_sign: | N/A | |
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchPreviewToolType](../components/openresponseswebsearchpreviewtooltype.md) | :heavy_check_mark: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.WebSearchPreviewToolUserLocation]](../components/websearchpreviewtooluserlocation.md) | :heavy_minus_sign: | N/A | |
| `engine` | [Optional[components.OpenResponsesWebSearchPreviewToolEngine]](../components/openresponseswebsearchpreviewtoolengine.md) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API. | auto |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search. | 5 |
| `filters` | [OptionalNullable[components.OpenResponsesWebSearchPreviewToolFilters]](../components/openresponseswebsearchpreviewtoolfilters.md) | :heavy_minus_sign: | N/A | |
@@ -0,0 +1,12 @@
# OpenResponsesWebSearchPreviewToolEngine
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
## Values
| Name | Value |
| -------- | -------- |
| `AUTO` | auto |
| `NATIVE` | native |
| `EXA` | exa |
@@ -0,0 +1,9 @@
# OpenResponsesWebSearchPreviewToolFilters
## Fields
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | N/A |
@@ -5,9 +5,11 @@ Web search tool configuration
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchToolType](../components/openresponseswebsearchtooltype.md) | :heavy_check_mark: | N/A | |
| `filters` | [OptionalNullable[components.OpenResponsesWebSearchToolFilters]](../components/openresponseswebsearchtoolfilters.md) | :heavy_minus_sign: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.ResponsesWebSearchUserLocation]](../components/responseswebsearchuserlocation.md) | :heavy_minus_sign: | User location information for web search | {<br/>"type": "approximate",<br/>"city": "San Francisco",<br/>"country": "USA",<br/>"region": "California",<br/>"timezone": "America/Los_Angeles"<br/>} |
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.OpenResponsesWebSearchToolType](../components/openresponseswebsearchtooltype.md) | :heavy_check_mark: | N/A | |
| `filters` | [OptionalNullable[components.OpenResponsesWebSearchToolFilters]](../components/openresponseswebsearchtoolfilters.md) | :heavy_minus_sign: | N/A | |
| `search_context_size` | [Optional[components.ResponsesSearchContextSize]](../components/responsessearchcontextsize.md) | :heavy_minus_sign: | Size of the search context for web search tools | medium |
| `user_location` | [OptionalNullable[components.ResponsesWebSearchUserLocation]](../components/responseswebsearchuserlocation.md) | :heavy_minus_sign: | User location information for web search | {<br/>"type": "approximate",<br/>"city": "San Francisco",<br/>"country": "USA",<br/>"region": "California",<br/>"timezone": "America/Los_Angeles"<br/>} |
| `engine` | [Optional[components.OpenResponsesWebSearchToolEngine]](../components/openresponseswebsearchtoolengine.md) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API. | auto |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search. | 5 |
@@ -0,0 +1,12 @@
# OpenResponsesWebSearchToolEngine
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
## Values
| Name | Value |
| -------- | -------- |
| `AUTO` | auto |
| `NATIVE` | native |
| `EXA` | exa |
@@ -5,4 +5,5 @@
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | N/A |
+6
View File
@@ -41,3 +41,9 @@ value: components.ResponsesOutputItemFileSearchCall = /* values here */
value: components.ResponsesImageGenerationCall = /* values here */
```
### `components.ResponsesServerToolOutput`
```python
value: components.ResponsesServerToolOutput = /* values here */
```
@@ -0,0 +1,13 @@
# ResponsesServerToolOutput
A generic OpenRouter server tool output item
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `type` | *str* | :heavy_check_mark: | Server tool type (e.g. openrouter:datetime, openrouter:web_search) | |
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | |
| `status` | [components.ResponsesServerToolOutputStatus](../components/responsesservertooloutputstatus.md) | :heavy_check_mark: | N/A | |
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | {<br/>"type": "openrouter:web_search",<br/>"id": "ws_tmp_abc123",<br/>"status": "completed"<br/>} |
@@ -0,0 +1,10 @@
# ResponsesServerToolOutputStatus
## Values
| Name | Value |
| ------------- | ------------- |
| `COMPLETED` | completed |
| `IN_PROGRESS` | in_progress |
| `INCOMPLETE` | incomplete |
@@ -0,0 +1,11 @@
# ResponsesWebSearchServerTool
OpenRouter built-in server tool: searches the web for current information
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.ResponsesWebSearchServerToolType](../components/responseswebsearchservertooltype.md) | :heavy_check_mark: | N/A |
| `parameters` | [Optional[components.ResponsesWebSearchServerToolParameters]](../components/responseswebsearchservertoolparameters.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,9 @@
# ResponsesWebSearchServerToolParameters
## Fields
| Field | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. | 5 |
| `max_total_results` | *Optional[float]* | :heavy_minus_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. | 20 |
@@ -0,0 +1,8 @@
# ResponsesWebSearchServerToolType
## Values
| Name | Value |
| ----------------------- | ----------------------- |
| `OPENROUTER_WEB_SEARCH` | openrouter:web_search |
+44 -7
View File
@@ -1,12 +1,49 @@
# ToolDefinitionJSON
Tool definition for function calling
Tool definition for function calling (regular function or OpenRouter built-in server tool)
## Fields
## Supported Types
### `components.ToolDefinitionJSONFunction`
```python
value: components.ToolDefinitionJSONFunction = /* values here */
```
### `components.DatetimeServerTool`
```python
value: components.DatetimeServerTool = /* values here */
```
### `components.WebSearchServerTool`
```python
value: components.WebSearchServerTool = /* values here */
```
### `components.WebSearchShorthand`
```python
value: components.WebSearchShorthand = /* values here */
```
### `components.WebSearchShorthand`
```python
value: components.WebSearchShorthand = /* values here */
```
### `components.WebSearchShorthand`
```python
value: components.WebSearchShorthand = /* values here */
```
### `components.WebSearchShorthand`
```python
value: components.WebSearchShorthand = /* values here */
```
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.ToolDefinitionJSONType](../components/tooldefinitionjsontype.md) | :heavy_check_mark: | N/A | |
| `function` | [components.ToolDefinitionJSONFunction](../components/tooldefinitionjsonfunction.md) | :heavy_check_mark: | Function definition for tool calling | {<br/>"name": "get_weather",<br/>"description": "Get the current weather for a location",<br/>"parameters": {<br/>"type": "object",<br/>"properties": {<br/>"location": {<br/>"type": "string",<br/>"description": "City name"<br/>}<br/>},<br/>"required": [<br/>"location"<br/>]<br/>}<br/>} |
| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | Cache control for the content part | {<br/>"type": "ephemeral",<br/>"ttl": "5m"<br/>} |
@@ -1,13 +1,10 @@
# ToolDefinitionJSONFunction
Function definition for tool calling
## Fields
| Field | Type | Required | Description | Example |
| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `name` | *str* | :heavy_check_mark: | Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) | get_weather |
| `description` | *Optional[str]* | :heavy_minus_sign: | Function description for the model | Get the current weather for a location |
| `parameters` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Function parameters as JSON Schema object | {<br/>"type": "object",<br/>"properties": {<br/>"location": {<br/>"type": "string",<br/>"description": "City name"<br/>}<br/>},<br/>"required": [<br/>"location"<br/>]<br/>} |
| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable strict schema adherence | false |
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.ToolDefinitionJSONType](../components/tooldefinitionjsontype.md) | :heavy_check_mark: | N/A | |
| `function` | [components.ToolDefinitionJSONFunctionFunction](../components/tooldefinitionjsonfunctionfunction.md) | :heavy_check_mark: | Function definition for tool calling | {<br/>"name": "get_weather",<br/>"description": "Get the current weather for a location",<br/>"parameters": {<br/>"type": "object",<br/>"properties": {<br/>"location": {<br/>"type": "string",<br/>"description": "City name"<br/>}<br/>},<br/>"required": [<br/>"location"<br/>]<br/>}<br/>} |
| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | Cache control for the content part | {<br/>"type": "ephemeral",<br/>"ttl": "5m"<br/>} |
@@ -0,0 +1,13 @@
# ToolDefinitionJSONFunctionFunction
Function definition for tool calling
## Fields
| Field | Type | Required | Description | Example |
| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `name` | *str* | :heavy_check_mark: | Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) | get_weather |
| `description` | *Optional[str]* | :heavy_minus_sign: | Function description for the model | Get the current weather for a location |
| `parameters` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Function parameters as JSON Schema object | {<br/>"type": "object",<br/>"properties": {<br/>"location": {<br/>"type": "string",<br/>"description": "City name"<br/>}<br/>},<br/>"required": [<br/>"location"<br/>]<br/>} |
| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable strict schema adherence | false |
+11
View File
@@ -0,0 +1,11 @@
# WebSearchServerTool
OpenRouter built-in server tool: searches the web for current information
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.WebSearchServerToolTypeOpenrouterWebSearch](../components/websearchservertooltypeopenrouterwebsearch.md) | :heavy_check_mark: | N/A |
| `parameters` | [Optional[components.WebSearchServerToolParameters]](../components/websearchservertoolparameters.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,12 @@
# WebSearchServerToolEngine
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
## Values
| Name | Value |
| -------- | -------- |
| `AUTO` | auto |
| `NATIVE` | native |
| `EXA` | exa |
@@ -0,0 +1,14 @@
# WebSearchServerToolParameters
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `engine` | [Optional[components.WebSearchServerToolEngine]](../components/websearchservertoolengine.md) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API. | auto |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search. | 5 |
| `max_total_results` | *Optional[float]* | :heavy_minus_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. | 20 |
| `search_context_size` | [Optional[components.WebSearchServerToolSearchContextSize]](../components/websearchservertoolsearchcontextsize.md) | :heavy_minus_sign: | How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search. | |
| `user_location` | [Optional[components.WebSearchServerToolUserLocation]](../components/websearchservertooluserlocation.md) | :heavy_minus_sign: | Approximate user location for location-biased results. | |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search. | |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search. | |
@@ -0,0 +1,8 @@
# WebSearchServerToolParametersType
## Values
| Name | Value |
| ------------- | ------------- |
| `APPROXIMATE` | approximate |
@@ -0,0 +1,12 @@
# WebSearchServerToolSearchContextSize
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search.
## Values
| Name | Value |
| -------- | -------- |
| `LOW` | low |
| `MEDIUM` | medium |
| `HIGH` | high |
@@ -0,0 +1,8 @@
# WebSearchServerToolTypeOpenrouterWebSearch
## Values
| Name | Value |
| ----------------------- | ----------------------- |
| `OPENROUTER_WEB_SEARCH` | openrouter:web_search |
@@ -0,0 +1,14 @@
# WebSearchServerToolUserLocation
Approximate user location for location-biased results.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `type` | [Optional[components.WebSearchServerToolParametersType]](../components/websearchservertoolparameterstype.md) | :heavy_minus_sign: | N/A |
| `city` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `region` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `country` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `timezone` | *Optional[str]* | :heavy_minus_sign: | N/A |
+18
View File
@@ -0,0 +1,18 @@
# WebSearchShorthand
Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search.
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type` | [components.WebSearchShorthandType](../components/websearchshorthandtype.md) | :heavy_check_mark: | N/A | |
| `engine` | [Optional[components.WebSearchShorthandEngine]](../components/websearchshorthandengine.md) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API. | auto |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search. | 5 |
| `max_total_results` | *Optional[float]* | :heavy_minus_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. | 20 |
| `search_context_size` | [Optional[components.WebSearchShorthandSearchContextSize]](../components/websearchshorthandsearchcontextsize.md) | :heavy_minus_sign: | How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search. | |
| `user_location` | [Optional[components.WebSearchShorthandUserLocation]](../components/websearchshorthanduserlocation.md) | :heavy_minus_sign: | Approximate user location for location-biased results. | |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search. | |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search. | |
| `parameters` | [Optional[components.WebSearchShorthandParameters]](../components/websearchshorthandparameters.md) | :heavy_minus_sign: | N/A | |
@@ -0,0 +1,12 @@
# WebSearchShorthandEngine
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
## Values
| Name | Value |
| -------- | -------- |
| `AUTO` | auto |
| `NATIVE` | native |
| `EXA` | exa |
@@ -0,0 +1,14 @@
# WebSearchShorthandParameters
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `engine` | [Optional[components.WebSearchShorthandParametersEngine]](../components/websearchshorthandparametersengine.md) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API. | auto |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search. | 5 |
| `max_total_results` | *Optional[float]* | :heavy_minus_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. | 20 |
| `search_context_size` | [Optional[components.WebSearchShorthandParametersSearchContextSize]](../components/websearchshorthandparameterssearchcontextsize.md) | :heavy_minus_sign: | How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search. | |
| `user_location` | [Optional[components.WebSearchShorthandParametersUserLocation]](../components/websearchshorthandparametersuserlocation.md) | :heavy_minus_sign: | Approximate user location for location-biased results. | |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search. | |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search. | |
@@ -0,0 +1,12 @@
# WebSearchShorthandParametersEngine
Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). "exa" forces the Exa search API.
## Values
| Name | Value |
| -------- | -------- |
| `AUTO` | auto |
| `NATIVE` | native |
| `EXA` | exa |
@@ -0,0 +1,12 @@
# WebSearchShorthandParametersSearchContextSize
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search.
## Values
| Name | Value |
| -------- | -------- |
| `LOW` | low |
| `MEDIUM` | medium |
| `HIGH` | high |
@@ -0,0 +1,8 @@
# WebSearchShorthandParametersType
## Values
| Name | Value |
| ------------- | ------------- |
| `APPROXIMATE` | approximate |
@@ -0,0 +1,14 @@
# WebSearchShorthandParametersUserLocation
Approximate user location for location-biased results.
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `type` | [Optional[components.WebSearchShorthandParametersType]](../components/websearchshorthandparameterstype.md) | :heavy_minus_sign: | N/A |
| `city` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `region` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `country` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `timezone` | *Optional[str]* | :heavy_minus_sign: | N/A |
@@ -0,0 +1,12 @@
# WebSearchShorthandSearchContextSize
How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search.
## Values
| Name | Value |
| -------- | -------- |
| `LOW` | low |
| `MEDIUM` | medium |
| `HIGH` | high |
+11
View File
@@ -0,0 +1,11 @@
# WebSearchShorthandType
## Values
| Name | Value |
| ------------------------------- | ------------------------------- |
| `WEB_SEARCH` | web_search |
| `WEB_SEARCH_PREVIEW` | web_search_preview |
| `WEB_SEARCH_PREVIEW_2025_03_11` | web_search_preview_2025_03_11 |
| `WEB_SEARCH_2025_08_26` | web_search_2025_08_26 |
@@ -0,0 +1,8 @@
# WebSearchShorthandTypeApproximate
## Values
| Name | Value |
| ------------- | ------------- |
| `APPROXIMATE` | approximate |
@@ -0,0 +1,14 @@
# WebSearchShorthandUserLocation
Approximate user location for location-biased results.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `type` | [Optional[components.WebSearchShorthandTypeApproximate]](../components/websearchshorthandtypeapproximate.md) | :heavy_minus_sign: | N/A |
| `city` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `region` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `country` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `timezone` | *Optional[str]* | :heavy_minus_sign: | N/A |
+11
View File
@@ -0,0 +1,11 @@
# ConflictResponseError
Conflict - Resource conflict or concurrent modification
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `error` | [components.ConflictResponseErrorData](../components/conflictresponseerrordata.md) | :heavy_check_mark: | Error data for ConflictResponse | {<br/>"code": 409,<br/>"message": "Resource conflict. Please try again later."<br/>} |
| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
+1 -1
View File
@@ -10,4 +10,4 @@
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
| `category` | [Optional[operations.Category]](../operations/category.md) | :heavy_minus_sign: | Filter models by use case category | programming |
| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | N/A | |
| `output_modality` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
+1 -1
View File
@@ -8,4 +8,4 @@
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> | |
| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | |
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
| `output_modality` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
+2 -2
View File
@@ -44,7 +44,7 @@ with OpenRouter(
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> | |
| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | |
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
| `output_modality` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response
@@ -94,7 +94,7 @@ with OpenRouter(
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
| `category` | [Optional[operations.Category]](../../operations/category.md) | :heavy_minus_sign: | Filter models by use case category | programming |
| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | N/A | |
| `output_modality` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response
+1
View File
@@ -113,5 +113,6 @@ with OpenRouter(
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "openrouter"
version = "0.8.0"
version = "0.9.0"
description = "Official Python Client SDK for OpenRouter."
authors = [{ name = "OpenRouter" },]
readme = "README-PYPI.md"
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata
__title__: str = "openrouter"
__version__: str = "0.8.0"
__version__: str = "0.9.0"
__openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.8.0 2.768.0 1.0.0 openrouter"
__user_agent__: str = "speakeasy-sdk/python 0.9.0 2.768.0 1.0.0 openrouter"
try:
if __package__ is not None:
+216
View File
@@ -39,6 +39,7 @@ if TYPE_CHECKING:
ChatGenerationParams,
ChatGenerationParamsBy,
ChatGenerationParamsIDAutoRouter,
ChatGenerationParamsIDContextCompression,
ChatGenerationParamsIDFileParser,
ChatGenerationParamsIDModeration,
ChatGenerationParamsIDResponseHealing,
@@ -56,6 +57,8 @@ if TYPE_CHECKING:
ChatGenerationParamsPartition,
ChatGenerationParamsPluginAutoRouter,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginContextCompression,
ChatGenerationParamsPluginContextCompressionTypedDict,
ChatGenerationParamsPluginFileParser,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginModeration,
@@ -193,12 +196,24 @@ if TYPE_CHECKING:
CompoundFilterType,
CompoundFilterTypedDict,
)
from .conflictresponseerrordata import (
ConflictResponseErrorData,
ConflictResponseErrorDataTypedDict,
)
from .contextcompressionengine import ContextCompressionEngine
from .createchargerequest import (
ChainID,
CreateChargeRequest,
CreateChargeRequestTypedDict,
)
from .datacollection import DataCollection
from .datetimeservertool import (
DatetimeServerTool,
DatetimeServerToolParameters,
DatetimeServerToolParametersTypedDict,
DatetimeServerToolType,
DatetimeServerToolTypedDict,
)
from .debugoptions import DebugOptions, DebugOptionsTypedDict
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
from .developermessage import (
@@ -608,6 +623,7 @@ if TYPE_CHECKING:
from .openresponsesrequest import (
OpenResponsesRequest,
OpenResponsesRequestIDAutoRouter,
OpenResponsesRequestIDContextCompression,
OpenResponsesRequestIDFileParser,
OpenResponsesRequestIDModeration,
OpenResponsesRequestIDResponseHealing,
@@ -624,6 +640,8 @@ if TYPE_CHECKING:
OpenResponsesRequestOrderTypedDict,
OpenResponsesRequestPluginAutoRouter,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginContextCompression,
OpenResponsesRequestPluginContextCompressionTypedDict,
OpenResponsesRequestPluginFileParser,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginModeration,
@@ -733,23 +751,46 @@ if TYPE_CHECKING:
)
from .openresponseswebsearch20250826tool import (
OpenResponsesWebSearch20250826Tool,
OpenResponsesWebSearch20250826ToolEngine,
OpenResponsesWebSearch20250826ToolFilters,
OpenResponsesWebSearch20250826ToolFiltersTypedDict,
OpenResponsesWebSearch20250826ToolType,
OpenResponsesWebSearch20250826ToolTypedDict,
)
from .openresponseswebsearchcallcompleted import (
OpenResponsesWebSearchCallCompleted,
OpenResponsesWebSearchCallCompletedType,
OpenResponsesWebSearchCallCompletedTypedDict,
)
from .openresponseswebsearchcallinprogress import (
OpenResponsesWebSearchCallInProgress,
OpenResponsesWebSearchCallInProgressType,
OpenResponsesWebSearchCallInProgressTypedDict,
)
from .openresponseswebsearchcallsearching import (
OpenResponsesWebSearchCallSearching,
OpenResponsesWebSearchCallSearchingType,
OpenResponsesWebSearchCallSearchingTypedDict,
)
from .openresponseswebsearchpreview20250311tool import (
OpenResponsesWebSearchPreview20250311Tool,
OpenResponsesWebSearchPreview20250311ToolEngine,
OpenResponsesWebSearchPreview20250311ToolFilters,
OpenResponsesWebSearchPreview20250311ToolFiltersTypedDict,
OpenResponsesWebSearchPreview20250311ToolType,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
)
from .openresponseswebsearchpreviewtool import (
OpenResponsesWebSearchPreviewTool,
OpenResponsesWebSearchPreviewToolEngine,
OpenResponsesWebSearchPreviewToolFilters,
OpenResponsesWebSearchPreviewToolFiltersTypedDict,
OpenResponsesWebSearchPreviewToolType,
OpenResponsesWebSearchPreviewToolTypedDict,
)
from .openresponseswebsearchtool import (
OpenResponsesWebSearchTool,
OpenResponsesWebSearchToolEngine,
OpenResponsesWebSearchToolFilters,
OpenResponsesWebSearchToolFiltersTypedDict,
OpenResponsesWebSearchToolType,
@@ -1018,6 +1059,11 @@ if TYPE_CHECKING:
)
from .responsesoutputmodality import ResponsesOutputModality
from .responsessearchcontextsize import ResponsesSearchContextSize
from .responsesservertooloutput import (
ResponsesServerToolOutput,
ResponsesServerToolOutputStatus,
ResponsesServerToolOutputTypedDict,
)
from .responseswebsearchcalloutput import (
Action,
ActionFindInPage,
@@ -1037,6 +1083,13 @@ if TYPE_CHECKING:
TypeURL,
TypeWebSearchCall,
)
from .responseswebsearchservertool import (
ResponsesWebSearchServerTool,
ResponsesWebSearchServerToolParameters,
ResponsesWebSearchServerToolParametersTypedDict,
ResponsesWebSearchServerToolType,
ResponsesWebSearchServerToolTypedDict,
)
from .responseswebsearchuserlocation import (
ResponsesWebSearchUserLocation,
ResponsesWebSearchUserLocationType,
@@ -1070,6 +1123,8 @@ if TYPE_CHECKING:
from .tooldefinitionjson import (
ToolDefinitionJSON,
ToolDefinitionJSONFunction,
ToolDefinitionJSONFunctionFunction,
ToolDefinitionJSONFunctionFunctionTypedDict,
ToolDefinitionJSONFunctionTypedDict,
ToolDefinitionJSONType,
ToolDefinitionJSONTypedDict,
@@ -1109,6 +1164,35 @@ if TYPE_CHECKING:
WebSearchPreviewToolUserLocationType,
WebSearchPreviewToolUserLocationTypedDict,
)
from .websearchservertool import (
WebSearchServerTool,
WebSearchServerToolEngine,
WebSearchServerToolParameters,
WebSearchServerToolParametersType,
WebSearchServerToolParametersTypedDict,
WebSearchServerToolSearchContextSize,
WebSearchServerToolTypeOpenrouterWebSearch,
WebSearchServerToolTypedDict,
WebSearchServerToolUserLocation,
WebSearchServerToolUserLocationTypedDict,
)
from .websearchshorthand import (
WebSearchShorthand,
WebSearchShorthandEngine,
WebSearchShorthandParameters,
WebSearchShorthandParametersEngine,
WebSearchShorthandParametersSearchContextSize,
WebSearchShorthandParametersType,
WebSearchShorthandParametersTypedDict,
WebSearchShorthandParametersUserLocation,
WebSearchShorthandParametersUserLocationTypedDict,
WebSearchShorthandSearchContextSize,
WebSearchShorthandType,
WebSearchShorthandTypeApproximate,
WebSearchShorthandTypedDict,
WebSearchShorthandUserLocation,
WebSearchShorthandUserLocationTypedDict,
)
from .websearchstatus import WebSearchStatus
__all__ = [
@@ -1152,6 +1236,7 @@ __all__ = [
"ChatGenerationParams",
"ChatGenerationParamsBy",
"ChatGenerationParamsIDAutoRouter",
"ChatGenerationParamsIDContextCompression",
"ChatGenerationParamsIDFileParser",
"ChatGenerationParamsIDModeration",
"ChatGenerationParamsIDResponseHealing",
@@ -1169,6 +1254,8 @@ __all__ = [
"ChatGenerationParamsPartition",
"ChatGenerationParamsPluginAutoRouter",
"ChatGenerationParamsPluginAutoRouterTypedDict",
"ChatGenerationParamsPluginContextCompression",
"ChatGenerationParamsPluginContextCompressionTypedDict",
"ChatGenerationParamsPluginFileParser",
"ChatGenerationParamsPluginFileParserTypedDict",
"ChatGenerationParamsPluginModeration",
@@ -1265,12 +1352,15 @@ __all__ = [
"CompoundFilter",
"CompoundFilterType",
"CompoundFilterTypedDict",
"ConflictResponseErrorData",
"ConflictResponseErrorDataTypedDict",
"ConnectorID",
"Container",
"ContainerAuto",
"ContainerAutoTypedDict",
"ContainerType",
"ContainerTypedDict",
"ContextCompressionEngine",
"CostDetails",
"CostDetailsTypedDict",
"CreateChargeRequest",
@@ -1278,6 +1368,11 @@ __all__ = [
"Data",
"DataCollection",
"DataTypedDict",
"DatetimeServerTool",
"DatetimeServerToolParameters",
"DatetimeServerToolParametersTypedDict",
"DatetimeServerToolType",
"DatetimeServerToolTypedDict",
"DebugOptions",
"DebugOptionsTypedDict",
"DefaultParameters",
@@ -1576,6 +1671,7 @@ __all__ = [
"OpenResponsesReasoningTypedDict",
"OpenResponsesRequest",
"OpenResponsesRequestIDAutoRouter",
"OpenResponsesRequestIDContextCompression",
"OpenResponsesRequestIDFileParser",
"OpenResponsesRequestIDModeration",
"OpenResponsesRequestIDResponseHealing",
@@ -1592,6 +1688,8 @@ __all__ = [
"OpenResponsesRequestOrderTypedDict",
"OpenResponsesRequestPluginAutoRouter",
"OpenResponsesRequestPluginAutoRouterTypedDict",
"OpenResponsesRequestPluginContextCompression",
"OpenResponsesRequestPluginContextCompressionTypedDict",
"OpenResponsesRequestPluginFileParser",
"OpenResponsesRequestPluginFileParserTypedDict",
"OpenResponsesRequestPluginModeration",
@@ -1664,17 +1762,34 @@ __all__ = [
"OpenResponsesUsage",
"OpenResponsesUsageTypedDict",
"OpenResponsesWebSearch20250826Tool",
"OpenResponsesWebSearch20250826ToolEngine",
"OpenResponsesWebSearch20250826ToolFilters",
"OpenResponsesWebSearch20250826ToolFiltersTypedDict",
"OpenResponsesWebSearch20250826ToolType",
"OpenResponsesWebSearch20250826ToolTypedDict",
"OpenResponsesWebSearchCallCompleted",
"OpenResponsesWebSearchCallCompletedType",
"OpenResponsesWebSearchCallCompletedTypedDict",
"OpenResponsesWebSearchCallInProgress",
"OpenResponsesWebSearchCallInProgressType",
"OpenResponsesWebSearchCallInProgressTypedDict",
"OpenResponsesWebSearchCallSearching",
"OpenResponsesWebSearchCallSearchingType",
"OpenResponsesWebSearchCallSearchingTypedDict",
"OpenResponsesWebSearchPreview20250311Tool",
"OpenResponsesWebSearchPreview20250311ToolEngine",
"OpenResponsesWebSearchPreview20250311ToolFilters",
"OpenResponsesWebSearchPreview20250311ToolFiltersTypedDict",
"OpenResponsesWebSearchPreview20250311ToolType",
"OpenResponsesWebSearchPreview20250311ToolTypedDict",
"OpenResponsesWebSearchPreviewTool",
"OpenResponsesWebSearchPreviewToolEngine",
"OpenResponsesWebSearchPreviewToolFilters",
"OpenResponsesWebSearchPreviewToolFiltersTypedDict",
"OpenResponsesWebSearchPreviewToolType",
"OpenResponsesWebSearchPreviewToolTypedDict",
"OpenResponsesWebSearchTool",
"OpenResponsesWebSearchToolEngine",
"OpenResponsesWebSearchToolFilters",
"OpenResponsesWebSearchToolFiltersTypedDict",
"OpenResponsesWebSearchToolType",
@@ -1898,8 +2013,16 @@ __all__ = [
"ResponsesOutputMessageTypedDict",
"ResponsesOutputModality",
"ResponsesSearchContextSize",
"ResponsesServerToolOutput",
"ResponsesServerToolOutputStatus",
"ResponsesServerToolOutputTypedDict",
"ResponsesWebSearchCallOutput",
"ResponsesWebSearchCallOutputTypedDict",
"ResponsesWebSearchServerTool",
"ResponsesWebSearchServerToolParameters",
"ResponsesWebSearchServerToolParametersTypedDict",
"ResponsesWebSearchServerToolType",
"ResponsesWebSearchServerToolTypedDict",
"ResponsesWebSearchUserLocation",
"ResponsesWebSearchUserLocationType",
"ResponsesWebSearchUserLocationTypedDict",
@@ -1930,6 +2053,8 @@ __all__ = [
"ToolChoiceOptionTypedDict",
"ToolDefinitionJSON",
"ToolDefinitionJSONFunction",
"ToolDefinitionJSONFunctionFunction",
"ToolDefinitionJSONFunctionFunctionTypedDict",
"ToolDefinitionJSONFunctionTypedDict",
"ToolDefinitionJSONType",
"ToolDefinitionJSONTypedDict",
@@ -1992,6 +2117,31 @@ __all__ = [
"WebSearchPreviewToolUserLocation",
"WebSearchPreviewToolUserLocationType",
"WebSearchPreviewToolUserLocationTypedDict",
"WebSearchServerTool",
"WebSearchServerToolEngine",
"WebSearchServerToolParameters",
"WebSearchServerToolParametersType",
"WebSearchServerToolParametersTypedDict",
"WebSearchServerToolSearchContextSize",
"WebSearchServerToolTypeOpenrouterWebSearch",
"WebSearchServerToolTypedDict",
"WebSearchServerToolUserLocation",
"WebSearchServerToolUserLocationTypedDict",
"WebSearchShorthand",
"WebSearchShorthandEngine",
"WebSearchShorthandParameters",
"WebSearchShorthandParametersEngine",
"WebSearchShorthandParametersSearchContextSize",
"WebSearchShorthandParametersType",
"WebSearchShorthandParametersTypedDict",
"WebSearchShorthandParametersUserLocation",
"WebSearchShorthandParametersUserLocationTypedDict",
"WebSearchShorthandSearchContextSize",
"WebSearchShorthandType",
"WebSearchShorthandTypeApproximate",
"WebSearchShorthandTypedDict",
"WebSearchShorthandUserLocation",
"WebSearchShorthandUserLocationTypedDict",
"WebSearchStatus",
]
@@ -2019,6 +2169,7 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParams": ".chatgenerationparams",
"ChatGenerationParamsBy": ".chatgenerationparams",
"ChatGenerationParamsIDAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsIDContextCompression": ".chatgenerationparams",
"ChatGenerationParamsIDFileParser": ".chatgenerationparams",
"ChatGenerationParamsIDModeration": ".chatgenerationparams",
"ChatGenerationParamsIDResponseHealing": ".chatgenerationparams",
@@ -2036,6 +2187,8 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsPartition": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginContextCompression": ".chatgenerationparams",
"ChatGenerationParamsPluginContextCompressionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
@@ -2145,10 +2298,18 @@ _dynamic_imports: dict[str, str] = {
"CompoundFilter": ".compoundfilter",
"CompoundFilterType": ".compoundfilter",
"CompoundFilterTypedDict": ".compoundfilter",
"ConflictResponseErrorData": ".conflictresponseerrordata",
"ConflictResponseErrorDataTypedDict": ".conflictresponseerrordata",
"ContextCompressionEngine": ".contextcompressionengine",
"ChainID": ".createchargerequest",
"CreateChargeRequest": ".createchargerequest",
"CreateChargeRequestTypedDict": ".createchargerequest",
"DataCollection": ".datacollection",
"DatetimeServerTool": ".datetimeservertool",
"DatetimeServerToolParameters": ".datetimeservertool",
"DatetimeServerToolParametersTypedDict": ".datetimeservertool",
"DatetimeServerToolType": ".datetimeservertool",
"DatetimeServerToolTypedDict": ".datetimeservertool",
"DebugOptions": ".debugoptions",
"DebugOptionsTypedDict": ".debugoptions",
"DefaultParameters": ".defaultparameters",
@@ -2481,6 +2642,7 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesRequest": ".openresponsesrequest",
"OpenResponsesRequestIDAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestIDContextCompression": ".openresponsesrequest",
"OpenResponsesRequestIDFileParser": ".openresponsesrequest",
"OpenResponsesRequestIDModeration": ".openresponsesrequest",
"OpenResponsesRequestIDResponseHealing": ".openresponsesrequest",
@@ -2497,6 +2659,8 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequestOrderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginContextCompression": ".openresponsesrequest",
"OpenResponsesRequestPluginContextCompressionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParser": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginModeration": ".openresponsesrequest",
@@ -2598,17 +2762,34 @@ _dynamic_imports: dict[str, str] = {
"OutputTokensDetails": ".openresponsesusage",
"OutputTokensDetailsTypedDict": ".openresponsesusage",
"OpenResponsesWebSearch20250826Tool": ".openresponseswebsearch20250826tool",
"OpenResponsesWebSearch20250826ToolEngine": ".openresponseswebsearch20250826tool",
"OpenResponsesWebSearch20250826ToolFilters": ".openresponseswebsearch20250826tool",
"OpenResponsesWebSearch20250826ToolFiltersTypedDict": ".openresponseswebsearch20250826tool",
"OpenResponsesWebSearch20250826ToolType": ".openresponseswebsearch20250826tool",
"OpenResponsesWebSearch20250826ToolTypedDict": ".openresponseswebsearch20250826tool",
"OpenResponsesWebSearchCallCompleted": ".openresponseswebsearchcallcompleted",
"OpenResponsesWebSearchCallCompletedType": ".openresponseswebsearchcallcompleted",
"OpenResponsesWebSearchCallCompletedTypedDict": ".openresponseswebsearchcallcompleted",
"OpenResponsesWebSearchCallInProgress": ".openresponseswebsearchcallinprogress",
"OpenResponsesWebSearchCallInProgressType": ".openresponseswebsearchcallinprogress",
"OpenResponsesWebSearchCallInProgressTypedDict": ".openresponseswebsearchcallinprogress",
"OpenResponsesWebSearchCallSearching": ".openresponseswebsearchcallsearching",
"OpenResponsesWebSearchCallSearchingType": ".openresponseswebsearchcallsearching",
"OpenResponsesWebSearchCallSearchingTypedDict": ".openresponseswebsearchcallsearching",
"OpenResponsesWebSearchPreview20250311Tool": ".openresponseswebsearchpreview20250311tool",
"OpenResponsesWebSearchPreview20250311ToolEngine": ".openresponseswebsearchpreview20250311tool",
"OpenResponsesWebSearchPreview20250311ToolFilters": ".openresponseswebsearchpreview20250311tool",
"OpenResponsesWebSearchPreview20250311ToolFiltersTypedDict": ".openresponseswebsearchpreview20250311tool",
"OpenResponsesWebSearchPreview20250311ToolType": ".openresponseswebsearchpreview20250311tool",
"OpenResponsesWebSearchPreview20250311ToolTypedDict": ".openresponseswebsearchpreview20250311tool",
"OpenResponsesWebSearchPreviewTool": ".openresponseswebsearchpreviewtool",
"OpenResponsesWebSearchPreviewToolEngine": ".openresponseswebsearchpreviewtool",
"OpenResponsesWebSearchPreviewToolFilters": ".openresponseswebsearchpreviewtool",
"OpenResponsesWebSearchPreviewToolFiltersTypedDict": ".openresponseswebsearchpreviewtool",
"OpenResponsesWebSearchPreviewToolType": ".openresponseswebsearchpreviewtool",
"OpenResponsesWebSearchPreviewToolTypedDict": ".openresponseswebsearchpreviewtool",
"OpenResponsesWebSearchTool": ".openresponseswebsearchtool",
"OpenResponsesWebSearchToolEngine": ".openresponseswebsearchtool",
"OpenResponsesWebSearchToolFilters": ".openresponseswebsearchtool",
"OpenResponsesWebSearchToolFiltersTypedDict": ".openresponseswebsearchtool",
"OpenResponsesWebSearchToolType": ".openresponseswebsearchtool",
@@ -2806,6 +2987,9 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputMessageTypedDict": ".responsesoutputmessage",
"ResponsesOutputModality": ".responsesoutputmodality",
"ResponsesSearchContextSize": ".responsessearchcontextsize",
"ResponsesServerToolOutput": ".responsesservertooloutput",
"ResponsesServerToolOutputStatus": ".responsesservertooloutput",
"ResponsesServerToolOutputTypedDict": ".responsesservertooloutput",
"Action": ".responseswebsearchcalloutput",
"ActionFindInPage": ".responseswebsearchcalloutput",
"ActionFindInPageTypedDict": ".responseswebsearchcalloutput",
@@ -2823,6 +3007,11 @@ _dynamic_imports: dict[str, str] = {
"TypeSearch": ".responseswebsearchcalloutput",
"TypeURL": ".responseswebsearchcalloutput",
"TypeWebSearchCall": ".responseswebsearchcalloutput",
"ResponsesWebSearchServerTool": ".responseswebsearchservertool",
"ResponsesWebSearchServerToolParameters": ".responseswebsearchservertool",
"ResponsesWebSearchServerToolParametersTypedDict": ".responseswebsearchservertool",
"ResponsesWebSearchServerToolType": ".responseswebsearchservertool",
"ResponsesWebSearchServerToolTypedDict": ".responseswebsearchservertool",
"ResponsesWebSearchUserLocation": ".responseswebsearchuserlocation",
"ResponsesWebSearchUserLocationType": ".responseswebsearchuserlocation",
"ResponsesWebSearchUserLocationTypedDict": ".responseswebsearchuserlocation",
@@ -2846,6 +3035,8 @@ _dynamic_imports: dict[str, str] = {
"ToolChoiceOptionTypedDict": ".toolchoiceoption",
"ToolDefinitionJSON": ".tooldefinitionjson",
"ToolDefinitionJSONFunction": ".tooldefinitionjson",
"ToolDefinitionJSONFunctionFunction": ".tooldefinitionjson",
"ToolDefinitionJSONFunctionFunctionTypedDict": ".tooldefinitionjson",
"ToolDefinitionJSONFunctionTypedDict": ".tooldefinitionjson",
"ToolDefinitionJSONType": ".tooldefinitionjson",
"ToolDefinitionJSONTypedDict": ".tooldefinitionjson",
@@ -2876,6 +3067,31 @@ _dynamic_imports: dict[str, str] = {
"WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationTypedDict": ".websearchpreviewtooluserlocation",
"WebSearchServerTool": ".websearchservertool",
"WebSearchServerToolEngine": ".websearchservertool",
"WebSearchServerToolParameters": ".websearchservertool",
"WebSearchServerToolParametersType": ".websearchservertool",
"WebSearchServerToolParametersTypedDict": ".websearchservertool",
"WebSearchServerToolSearchContextSize": ".websearchservertool",
"WebSearchServerToolTypeOpenrouterWebSearch": ".websearchservertool",
"WebSearchServerToolTypedDict": ".websearchservertool",
"WebSearchServerToolUserLocation": ".websearchservertool",
"WebSearchServerToolUserLocationTypedDict": ".websearchservertool",
"WebSearchShorthand": ".websearchshorthand",
"WebSearchShorthandEngine": ".websearchshorthand",
"WebSearchShorthandParameters": ".websearchshorthand",
"WebSearchShorthandParametersEngine": ".websearchshorthand",
"WebSearchShorthandParametersSearchContextSize": ".websearchshorthand",
"WebSearchShorthandParametersType": ".websearchshorthand",
"WebSearchShorthandParametersTypedDict": ".websearchshorthand",
"WebSearchShorthandParametersUserLocation": ".websearchshorthand",
"WebSearchShorthandParametersUserLocationTypedDict": ".websearchshorthand",
"WebSearchShorthandSearchContextSize": ".websearchshorthand",
"WebSearchShorthandType": ".websearchshorthand",
"WebSearchShorthandTypeApproximate": ".websearchshorthand",
"WebSearchShorthandTypedDict": ".websearchshorthand",
"WebSearchShorthandUserLocation": ".websearchshorthand",
"WebSearchShorthandUserLocationTypedDict": ".websearchshorthand",
"WebSearchStatus": ".websearchstatus",
}
@@ -2,6 +2,7 @@
from __future__ import annotations
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
from .contextcompressionengine import ContextCompressionEngine
from .datacollection import DataCollection
from .debugoptions import DebugOptions, DebugOptionsTypedDict
from .message import Message, MessageTypedDict
@@ -405,6 +406,27 @@ class ChatGenerationParamsProvider(BaseModel):
return m
ChatGenerationParamsIDContextCompression = Literal["context-compression",]
class ChatGenerationParamsPluginContextCompressionTypedDict(TypedDict):
id: ChatGenerationParamsIDContextCompression
enabled: NotRequired[bool]
r"""Set to false to disable the context-compression plugin for this request. Defaults to true."""
engine: NotRequired[ContextCompressionEngine]
r"""The compression engine to use. Defaults to \"middle-out\"."""
class ChatGenerationParamsPluginContextCompression(BaseModel):
id: ChatGenerationParamsIDContextCompression
enabled: Optional[bool] = None
r"""Set to false to disable the context-compression plugin for this request. Defaults to true."""
engine: Optional[ContextCompressionEngine] = None
r"""The compression engine to use. Defaults to \"middle-out\"."""
ChatGenerationParamsIDResponseHealing = Literal["response-healing",]
@@ -520,6 +542,7 @@ ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginContextCompressionTypedDict,
ChatGenerationParamsPluginWebTypedDict,
],
)
@@ -532,6 +555,9 @@ ChatGenerationParamsPluginUnion = Annotated[
Annotated[ChatGenerationParamsPluginWeb, Tag("web")],
Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")],
Annotated[ChatGenerationParamsPluginResponseHealing, Tag("response-healing")],
Annotated[
ChatGenerationParamsPluginContextCompression, Tag("context-compression")
],
],
Discriminator(lambda m: get_discriminator(m, "id", "id")),
]
@@ -0,0 +1,61 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict
from typing_extensions import NotRequired, TypedDict
class ConflictResponseErrorDataTypedDict(TypedDict):
r"""Error data for ConflictResponse"""
code: int
message: str
metadata: NotRequired[Nullable[Dict[str, Nullable[Any]]]]
class ConflictResponseErrorData(BaseModel):
r"""Error data for ConflictResponse"""
code: int
message: str
metadata: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["metadata"]
nullable_fields = ["metadata"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from typing import Literal
ContextCompressionEngine = Literal["middle-out",]
r"""The compression engine to use. Defaults to \"middle-out\"."""
@@ -0,0 +1,34 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
DatetimeServerToolType = Literal["openrouter:datetime",]
class DatetimeServerToolParametersTypedDict(TypedDict):
timezone: NotRequired[str]
r"""IANA timezone name (e.g. \"America/New_York\"). Defaults to UTC."""
class DatetimeServerToolParameters(BaseModel):
timezone: Optional[str] = None
r"""IANA timezone name (e.g. \"America/New_York\"). Defaults to UTC."""
class DatetimeServerToolTypedDict(TypedDict):
r"""OpenRouter built-in server tool: returns the current date and time"""
type: DatetimeServerToolType
parameters: NotRequired[DatetimeServerToolParametersTypedDict]
class DatetimeServerTool(BaseModel):
r"""OpenRouter built-in server tool: returns the current date and time"""
type: DatetimeServerToolType
parameters: Optional[DatetimeServerToolParameters] = None
@@ -40,6 +40,10 @@ from .responsesoutputitemfunctioncall import (
ResponsesOutputItemFunctionCall,
ResponsesOutputItemFunctionCallTypedDict,
)
from .responsesservertooloutput import (
ResponsesServerToolOutput,
ResponsesServerToolOutputTypedDict,
)
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
ResponsesWebSearchCallOutputTypedDict,
@@ -339,6 +343,7 @@ OpenResponsesInputUnion1TypedDict = TypeAliasType(
ResponsesWebSearchCallOutputTypedDict,
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
ResponsesServerToolOutputTypedDict,
OpenResponsesFunctionCallOutputTypedDict,
OpenResponsesFunctionToolCallTypedDict,
OpenResponsesInputMessageTypedDict,
@@ -357,6 +362,7 @@ OpenResponsesInputUnion1 = TypeAliasType(
ResponsesWebSearchCallOutput,
ResponsesOutputItemFileSearchCall,
ResponsesImageGenerationCall,
ResponsesServerToolOutput,
OpenResponsesFunctionCallOutput,
OpenResponsesFunctionToolCall,
OpenResponsesInputMessage,
@@ -151,18 +151,18 @@ class OpenResponsesNonStreamingResponseToolFunction(BaseModel):
OpenResponsesNonStreamingResponseToolUnionTypedDict = TypeAliasType(
"OpenResponsesNonStreamingResponseToolUnionTypedDict",
Union[
OpenResponsesLocalShellToolTypedDict,
OpenResponsesApplyPatchToolTypedDict,
OpenResponsesFunctionShellToolTypedDict,
OpenResponsesLocalShellToolTypedDict,
OpenResponsesCodeInterpreterToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesCustomToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesNonStreamingResponseToolFunctionTypedDict,
OpenResponsesFileSearchToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesMcpToolTypedDict,
OpenResponsesImageGenerationToolTypedDict,
],
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .contextcompressionengine import ContextCompressionEngine
from .datacollection import DataCollection
from .datetimeservertool import DatetimeServerTool, DatetimeServerToolTypedDict
from .openairesponsesincludable import OpenAIResponsesIncludable
from .openairesponsesprompt import OpenAIResponsesPrompt, OpenAIResponsesPromptTypedDict
from .openairesponsestoolchoice_union import (
@@ -80,6 +82,10 @@ from .providersort import ProviderSort
from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict
from .quantization import Quantization
from .responsesoutputmodality import ResponsesOutputModality
from .responseswebsearchservertool import (
ResponsesWebSearchServerTool,
ResponsesWebSearchServerToolTypedDict,
)
from .websearchengine import WebSearchEngine
from openrouter.types import (
BaseModel,
@@ -157,18 +163,20 @@ class OpenResponsesRequestToolFunction(BaseModel):
OpenResponsesRequestToolUnionTypedDict = TypeAliasType(
"OpenResponsesRequestToolUnionTypedDict",
Union[
OpenResponsesLocalShellToolTypedDict,
OpenResponsesApplyPatchToolTypedDict,
OpenResponsesFunctionShellToolTypedDict,
OpenResponsesLocalShellToolTypedDict,
ResponsesWebSearchServerToolTypedDict,
DatetimeServerToolTypedDict,
OpenResponsesCodeInterpreterToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesCustomToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesRequestToolFunctionTypedDict,
OpenResponsesFileSearchToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesMcpToolTypedDict,
OpenResponsesImageGenerationToolTypedDict,
],
@@ -194,6 +202,8 @@ OpenResponsesRequestToolUnion = Annotated[
Annotated[OpenResponsesFunctionShellTool, Tag("shell")],
Annotated[OpenResponsesApplyPatchTool, Tag("apply_patch")],
Annotated[OpenResponsesCustomTool, Tag("custom")],
Annotated[DatetimeServerTool, Tag("openrouter:datetime")],
Annotated[ResponsesWebSearchServerTool, Tag("openrouter:web_search")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
@@ -449,6 +459,27 @@ class OpenResponsesRequestProvider(BaseModel):
return m
OpenResponsesRequestIDContextCompression = Literal["context-compression",]
class OpenResponsesRequestPluginContextCompressionTypedDict(TypedDict):
id: OpenResponsesRequestIDContextCompression
enabled: NotRequired[bool]
r"""Set to false to disable the context-compression plugin for this request. Defaults to true."""
engine: NotRequired[ContextCompressionEngine]
r"""The compression engine to use. Defaults to \"middle-out\"."""
class OpenResponsesRequestPluginContextCompression(BaseModel):
id: OpenResponsesRequestIDContextCompression
enabled: Optional[bool] = None
r"""Set to false to disable the context-compression plugin for this request. Defaults to true."""
engine: Optional[ContextCompressionEngine] = None
r"""The compression engine to use. Defaults to \"middle-out\"."""
OpenResponsesRequestIDResponseHealing = Literal["response-healing",]
@@ -564,6 +595,7 @@ OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
OpenResponsesRequestPluginResponseHealingTypedDict,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginContextCompressionTypedDict,
OpenResponsesRequestPluginWebTypedDict,
],
)
@@ -576,6 +608,9 @@ OpenResponsesRequestPluginUnion = Annotated[
Annotated[OpenResponsesRequestPluginWeb, Tag("web")],
Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")],
Annotated[OpenResponsesRequestPluginResponseHealing, Tag("response-healing")],
Annotated[
OpenResponsesRequestPluginContextCompression, Tag("context-compression")
],
],
Discriminator(lambda m: get_discriminator(m, "id", "id")),
]
@@ -53,6 +53,18 @@ from .openresponsesreasoningsummarytextdoneevent import (
OpenResponsesReasoningSummaryTextDoneEvent,
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
)
from .openresponseswebsearchcallcompleted import (
OpenResponsesWebSearchCallCompleted,
OpenResponsesWebSearchCallCompletedTypedDict,
)
from .openresponseswebsearchcallinprogress import (
OpenResponsesWebSearchCallInProgress,
OpenResponsesWebSearchCallInProgressTypedDict,
)
from .openresponseswebsearchcallsearching import (
OpenResponsesWebSearchCallSearching,
OpenResponsesWebSearchCallSearchingTypedDict,
)
from .reasoningsummarytext import ReasoningSummaryText, ReasoningSummaryTextTypedDict
from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentTypedDict
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
@@ -672,22 +684,25 @@ OpenResponsesStreamEventTypedDict = TypeAliasType(
OpenResponsesStreamEventResponseFailedTypedDict,
OpenResponsesStreamEventResponseOutputItemAddedTypedDict,
OpenResponsesStreamEventResponseOutputItemDoneTypedDict,
OpenResponsesWebSearchCallCompletedTypedDict,
OpenResponsesWebSearchCallSearchingTypedDict,
OpenResponsesWebSearchCallInProgressTypedDict,
OpenResponsesImageGenCallCompletedTypedDict,
OpenResponsesImageGenCallGeneratingTypedDict,
OpenResponsesImageGenCallInProgressTypedDict,
OpenResponsesErrorEventTypedDict,
OpenResponsesStreamEventResponseFunctionCallArgumentsDeltaTypedDict,
OpenResponsesStreamEventResponseRefusalDeltaTypedDict,
OpenResponsesReasoningSummaryPartAddedEventTypedDict,
OpenResponsesStreamEventResponseContentPartAddedTypedDict,
OpenResponsesImageGenCallPartialImageTypedDict,
OpenResponsesStreamEventResponseFunctionCallArgumentsDoneTypedDict,
OpenResponsesReasoningDeltaEventTypedDict,
OpenResponsesReasoningDoneEventTypedDict,
OpenResponsesStreamEventResponseRefusalDoneTypedDict,
OpenResponsesStreamEventResponseReasoningSummaryPartDoneTypedDict,
OpenResponsesErrorEventTypedDict,
OpenResponsesReasoningSummaryTextDeltaEventTypedDict,
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
OpenResponsesReasoningDeltaEventTypedDict,
OpenResponsesReasoningDoneEventTypedDict,
OpenResponsesReasoningSummaryPartAddedEventTypedDict,
OpenResponsesStreamEventResponseReasoningSummaryPartDoneTypedDict,
OpenResponsesStreamEventResponseContentPartAddedTypedDict,
OpenResponsesStreamEventResponseFunctionCallArgumentsDoneTypedDict,
OpenResponsesStreamEventResponseRefusalDoneTypedDict,
OpenResponsesStreamEventResponseRefusalDeltaTypedDict,
OpenResponsesImageGenCallPartialImageTypedDict,
OpenResponsesStreamEventResponseContentPartDoneTypedDict,
OpenResponsesStreamEventResponseOutputTextDeltaTypedDict,
OpenResponsesStreamEventResponseOutputTextDoneTypedDict,
@@ -787,6 +802,18 @@ OpenResponsesStreamEvent = Annotated[
OpenResponsesImageGenCallCompleted,
Tag("response.image_generation_call.completed"),
],
Annotated[
OpenResponsesWebSearchCallInProgress,
Tag("response.web_search_call.in_progress"),
],
Annotated[
OpenResponsesWebSearchCallSearching,
Tag("response.web_search_call.searching"),
],
Annotated[
OpenResponsesWebSearchCallCompleted,
Tag("response.web_search_call.completed"),
],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
@@ -12,11 +12,12 @@ from openrouter.types import (
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -25,15 +26,18 @@ OpenResponsesWebSearch20250826ToolType = Literal["web_search_2025_08_26",]
class OpenResponsesWebSearch20250826ToolFiltersTypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
excluded_domains: NotRequired[Nullable[List[str]]]
class OpenResponsesWebSearch20250826ToolFilters(BaseModel):
allowed_domains: OptionalNullable[List[str]] = UNSET
excluded_domains: OptionalNullable[List[str]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["allowed_domains"]
nullable_fields = ["allowed_domains"]
optional_fields = ["allowed_domains", "excluded_domains"]
nullable_fields = ["allowed_domains", "excluded_domains"]
null_default_fields = []
serialized = handler(self)
@@ -61,6 +65,17 @@ class OpenResponsesWebSearch20250826ToolFilters(BaseModel):
return m
OpenResponsesWebSearch20250826ToolEngine = Union[
Literal[
"auto",
"native",
"exa",
],
UnrecognizedStr,
]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
class OpenResponsesWebSearch20250826ToolTypedDict(TypedDict):
r"""Web search tool configuration (2025-08-26 version)"""
@@ -70,6 +85,10 @@ class OpenResponsesWebSearch20250826ToolTypedDict(TypedDict):
r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[ResponsesWebSearchUserLocationTypedDict]]
r"""User location information for web search"""
engine: NotRequired[OpenResponsesWebSearch20250826ToolEngine]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
class OpenResponsesWebSearch20250826Tool(BaseModel):
@@ -87,9 +106,24 @@ class OpenResponsesWebSearch20250826Tool(BaseModel):
user_location: OptionalNullable[ResponsesWebSearchUserLocation] = UNSET
r"""User location information for web search"""
engine: Annotated[
Optional[OpenResponsesWebSearch20250826ToolEngine],
PlainValidator(validate_open_enum(False)),
] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["filters", "search_context_size", "user_location"]
optional_fields = [
"filters",
"search_context_size",
"user_location",
"engine",
"max_results",
]
nullable_fields = ["filters", "user_location"]
null_default_fields = []
@@ -0,0 +1,30 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesWebSearchCallCompletedType = Literal["response.web_search_call.completed",]
class OpenResponsesWebSearchCallCompletedTypedDict(TypedDict):
r"""Web search call completed"""
type: OpenResponsesWebSearchCallCompletedType
item_id: str
output_index: float
sequence_number: float
class OpenResponsesWebSearchCallCompleted(BaseModel):
r"""Web search call completed"""
type: OpenResponsesWebSearchCallCompletedType
item_id: str
output_index: float
sequence_number: float
@@ -0,0 +1,32 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesWebSearchCallInProgressType = Literal[
"response.web_search_call.in_progress",
]
class OpenResponsesWebSearchCallInProgressTypedDict(TypedDict):
r"""Web search call in progress"""
type: OpenResponsesWebSearchCallInProgressType
item_id: str
output_index: float
sequence_number: float
class OpenResponsesWebSearchCallInProgress(BaseModel):
r"""Web search call in progress"""
type: OpenResponsesWebSearchCallInProgressType
item_id: str
output_index: float
sequence_number: float
@@ -0,0 +1,30 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
OpenResponsesWebSearchCallSearchingType = Literal["response.web_search_call.searching",]
class OpenResponsesWebSearchCallSearchingTypedDict(TypedDict):
r"""Web search call is searching"""
type: OpenResponsesWebSearchCallSearchingType
item_id: str
output_index: float
sequence_number: float
class OpenResponsesWebSearchCallSearching(BaseModel):
r"""Web search call is searching"""
type: OpenResponsesWebSearchCallSearchingType
item_id: str
output_index: float
sequence_number: float
@@ -12,11 +12,12 @@ from openrouter.types import (
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -25,31 +26,107 @@ OpenResponsesWebSearchPreview20250311ToolType = Literal[
]
class OpenResponsesWebSearchPreview20250311ToolTypedDict(TypedDict):
r"""Web search preview tool configuration (2025-03-11 version)"""
type: OpenResponsesWebSearchPreview20250311ToolType
search_context_size: NotRequired[ResponsesSearchContextSize]
r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[WebSearchPreviewToolUserLocationTypedDict]]
OpenResponsesWebSearchPreview20250311ToolEngine = Union[
Literal[
"auto",
"native",
"exa",
],
UnrecognizedStr,
]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
class OpenResponsesWebSearchPreview20250311Tool(BaseModel):
r"""Web search preview tool configuration (2025-03-11 version)"""
class OpenResponsesWebSearchPreview20250311ToolFiltersTypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
excluded_domains: NotRequired[Nullable[List[str]]]
type: OpenResponsesWebSearchPreview20250311ToolType
search_context_size: Annotated[
Optional[ResponsesSearchContextSize], PlainValidator(validate_open_enum(False))
] = None
r"""Size of the search context for web search tools"""
class OpenResponsesWebSearchPreview20250311ToolFilters(BaseModel):
allowed_domains: OptionalNullable[List[str]] = UNSET
user_location: OptionalNullable[WebSearchPreviewToolUserLocation] = UNSET
excluded_domains: OptionalNullable[List[str]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["search_context_size", "user_location"]
nullable_fields = ["user_location"]
optional_fields = ["allowed_domains", "excluded_domains"]
nullable_fields = ["allowed_domains", "excluded_domains"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class OpenResponsesWebSearchPreview20250311ToolTypedDict(TypedDict):
r"""Web search preview tool configuration (2025-03-11 version)"""
type: OpenResponsesWebSearchPreview20250311ToolType
search_context_size: NotRequired[ResponsesSearchContextSize]
r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[WebSearchPreviewToolUserLocationTypedDict]]
engine: NotRequired[OpenResponsesWebSearchPreview20250311ToolEngine]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
filters: NotRequired[
Nullable[OpenResponsesWebSearchPreview20250311ToolFiltersTypedDict]
]
class OpenResponsesWebSearchPreview20250311Tool(BaseModel):
r"""Web search preview tool configuration (2025-03-11 version)"""
type: OpenResponsesWebSearchPreview20250311ToolType
search_context_size: Annotated[
Optional[ResponsesSearchContextSize], PlainValidator(validate_open_enum(False))
] = None
r"""Size of the search context for web search tools"""
user_location: OptionalNullable[WebSearchPreviewToolUserLocation] = UNSET
engine: Annotated[
Optional[OpenResponsesWebSearchPreview20250311ToolEngine],
PlainValidator(validate_open_enum(False)),
] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
filters: OptionalNullable[OpenResponsesWebSearchPreview20250311ToolFilters] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"search_context_size",
"user_location",
"engine",
"max_results",
"filters",
]
nullable_fields = ["user_location", "filters"]
null_default_fields = []
serialized = handler(self)
@@ -12,42 +12,117 @@ from openrouter.types import (
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
OpenResponsesWebSearchPreviewToolType = Literal["web_search_preview",]
class OpenResponsesWebSearchPreviewToolTypedDict(TypedDict):
r"""Web search preview tool configuration"""
type: OpenResponsesWebSearchPreviewToolType
search_context_size: NotRequired[ResponsesSearchContextSize]
r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[WebSearchPreviewToolUserLocationTypedDict]]
OpenResponsesWebSearchPreviewToolEngine = Union[
Literal[
"auto",
"native",
"exa",
],
UnrecognizedStr,
]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
class OpenResponsesWebSearchPreviewTool(BaseModel):
r"""Web search preview tool configuration"""
class OpenResponsesWebSearchPreviewToolFiltersTypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
excluded_domains: NotRequired[Nullable[List[str]]]
type: OpenResponsesWebSearchPreviewToolType
search_context_size: Annotated[
Optional[ResponsesSearchContextSize], PlainValidator(validate_open_enum(False))
] = None
r"""Size of the search context for web search tools"""
class OpenResponsesWebSearchPreviewToolFilters(BaseModel):
allowed_domains: OptionalNullable[List[str]] = UNSET
user_location: OptionalNullable[WebSearchPreviewToolUserLocation] = UNSET
excluded_domains: OptionalNullable[List[str]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["search_context_size", "user_location"]
nullable_fields = ["user_location"]
optional_fields = ["allowed_domains", "excluded_domains"]
nullable_fields = ["allowed_domains", "excluded_domains"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class OpenResponsesWebSearchPreviewToolTypedDict(TypedDict):
r"""Web search preview tool configuration"""
type: OpenResponsesWebSearchPreviewToolType
search_context_size: NotRequired[ResponsesSearchContextSize]
r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[WebSearchPreviewToolUserLocationTypedDict]]
engine: NotRequired[OpenResponsesWebSearchPreviewToolEngine]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
filters: NotRequired[Nullable[OpenResponsesWebSearchPreviewToolFiltersTypedDict]]
class OpenResponsesWebSearchPreviewTool(BaseModel):
r"""Web search preview tool configuration"""
type: OpenResponsesWebSearchPreviewToolType
search_context_size: Annotated[
Optional[ResponsesSearchContextSize], PlainValidator(validate_open_enum(False))
] = None
r"""Size of the search context for web search tools"""
user_location: OptionalNullable[WebSearchPreviewToolUserLocation] = UNSET
engine: Annotated[
Optional[OpenResponsesWebSearchPreviewToolEngine],
PlainValidator(validate_open_enum(False)),
] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
filters: OptionalNullable[OpenResponsesWebSearchPreviewToolFilters] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"search_context_size",
"user_location",
"engine",
"max_results",
"filters",
]
nullable_fields = ["user_location", "filters"]
null_default_fields = []
serialized = handler(self)
@@ -12,11 +12,12 @@ from openrouter.types import (
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -25,15 +26,18 @@ OpenResponsesWebSearchToolType = Literal["web_search",]
class OpenResponsesWebSearchToolFiltersTypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
excluded_domains: NotRequired[Nullable[List[str]]]
class OpenResponsesWebSearchToolFilters(BaseModel):
allowed_domains: OptionalNullable[List[str]] = UNSET
excluded_domains: OptionalNullable[List[str]] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["allowed_domains"]
nullable_fields = ["allowed_domains"]
optional_fields = ["allowed_domains", "excluded_domains"]
nullable_fields = ["allowed_domains", "excluded_domains"]
null_default_fields = []
serialized = handler(self)
@@ -61,6 +65,17 @@ class OpenResponsesWebSearchToolFilters(BaseModel):
return m
OpenResponsesWebSearchToolEngine = Union[
Literal[
"auto",
"native",
"exa",
],
UnrecognizedStr,
]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
class OpenResponsesWebSearchToolTypedDict(TypedDict):
r"""Web search tool configuration"""
@@ -70,6 +85,10 @@ class OpenResponsesWebSearchToolTypedDict(TypedDict):
r"""Size of the search context for web search tools"""
user_location: NotRequired[Nullable[ResponsesWebSearchUserLocationTypedDict]]
r"""User location information for web search"""
engine: NotRequired[OpenResponsesWebSearchToolEngine]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
class OpenResponsesWebSearchTool(BaseModel):
@@ -87,9 +106,24 @@ class OpenResponsesWebSearchTool(BaseModel):
user_location: OptionalNullable[ResponsesWebSearchUserLocation] = UNSET
r"""User location information for web search"""
engine: Annotated[
Optional[OpenResponsesWebSearchToolEngine],
PlainValidator(validate_open_enum(False)),
] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["filters", "search_context_size", "user_location"]
optional_fields = [
"filters",
"search_context_size",
"user_location",
"engine",
"max_results",
]
nullable_fields = ["filters", "user_location"]
null_default_fields = []
@@ -21,14 +21,16 @@ from .responsesoutputmessage import (
ResponsesOutputMessage,
ResponsesOutputMessageTypedDict,
)
from .responsesservertooloutput import (
ResponsesServerToolOutput,
ResponsesServerToolOutputTypedDict,
)
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
ResponsesWebSearchCallOutputTypedDict,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType
from typing_extensions import TypeAliasType
ResponsesOutputItemTypedDict = TypeAliasType(
@@ -37,6 +39,7 @@ ResponsesOutputItemTypedDict = TypeAliasType(
ResponsesWebSearchCallOutputTypedDict,
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
ResponsesServerToolOutputTypedDict,
ResponsesOutputMessageTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
ResponsesOutputItemReasoningTypedDict,
@@ -45,15 +48,16 @@ ResponsesOutputItemTypedDict = TypeAliasType(
r"""An output item from the response"""
ResponsesOutputItem = Annotated[
ResponsesOutputItem = TypeAliasType(
"ResponsesOutputItem",
Union[
Annotated[ResponsesOutputMessage, Tag("message")],
Annotated[ResponsesOutputItemReasoning, Tag("reasoning")],
Annotated[ResponsesOutputItemFunctionCall, Tag("function_call")],
Annotated[ResponsesWebSearchCallOutput, Tag("web_search_call")],
Annotated[ResponsesOutputItemFileSearchCall, Tag("file_search_call")],
Annotated[ResponsesImageGenerationCall, Tag("image_generation_call")],
ResponsesWebSearchCallOutput,
ResponsesOutputItemFileSearchCall,
ResponsesImageGenerationCall,
ResponsesServerToolOutput,
ResponsesOutputMessage,
ResponsesOutputItemFunctionCall,
ResponsesOutputItemReasoning,
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
)
r"""An output item from the response"""
@@ -0,0 +1,55 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
from openrouter.utils import validate_open_enum
import pydantic
from pydantic import ConfigDict
from pydantic.functional_validators import PlainValidator
from typing import Any, Dict, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
ResponsesServerToolOutputStatus = Union[
Literal[
"completed",
"in_progress",
"incomplete",
],
UnrecognizedStr,
]
class ResponsesServerToolOutputTypedDict(TypedDict):
r"""A generic OpenRouter server tool output item"""
type: str
r"""Server tool type (e.g. openrouter:datetime, openrouter:web_search)"""
status: ResponsesServerToolOutputStatus
id: NotRequired[str]
class ResponsesServerToolOutput(BaseModel):
r"""A generic OpenRouter server tool output item"""
model_config = ConfigDict(
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
)
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
type: str
r"""Server tool type (e.g. openrouter:datetime, openrouter:web_search)"""
status: Annotated[
ResponsesServerToolOutputStatus, PlainValidator(validate_open_enum(False))
]
id: Optional[str] = None
@property
def additional_properties(self):
return self.__pydantic_extra__
@additional_properties.setter
def additional_properties(self, value):
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
@@ -0,0 +1,39 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict
ResponsesWebSearchServerToolType = Literal["openrouter:web_search",]
class ResponsesWebSearchServerToolParametersTypedDict(TypedDict):
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5."""
max_total_results: NotRequired[float]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results."""
class ResponsesWebSearchServerToolParameters(BaseModel):
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5."""
max_total_results: Optional[float] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results."""
class ResponsesWebSearchServerToolTypedDict(TypedDict):
r"""OpenRouter built-in server tool: searches the web for current information"""
type: ResponsesWebSearchServerToolType
parameters: NotRequired[ResponsesWebSearchServerToolParametersTypedDict]
class ResponsesWebSearchServerTool(BaseModel):
r"""OpenRouter built-in server tool: searches the web for current information"""
type: ResponsesWebSearchServerToolType
parameters: Optional[ResponsesWebSearchServerToolParameters] = None
+40 -13
View File
@@ -5,6 +5,9 @@ from .chatmessagecontentitemcachecontrol import (
ChatMessageContentItemCacheControl,
ChatMessageContentItemCacheControlTypedDict,
)
from .datetimeservertool import DatetimeServerTool, DatetimeServerToolTypedDict
from .websearchservertool import WebSearchServerTool, WebSearchServerToolTypedDict
from .websearchshorthand import WebSearchShorthand, WebSearchShorthandTypedDict
from openrouter.types import (
BaseModel,
Nullable,
@@ -12,15 +15,16 @@ from openrouter.types import (
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Any, Dict, Literal, Optional
from typing_extensions import NotRequired, TypedDict
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag, model_serializer
from typing import Any, Dict, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
ToolDefinitionJSONType = Literal["function",]
class ToolDefinitionJSONFunctionTypedDict(TypedDict):
class ToolDefinitionJSONFunctionFunctionTypedDict(TypedDict):
r"""Function definition for tool calling"""
name: str
@@ -33,7 +37,7 @@ class ToolDefinitionJSONFunctionTypedDict(TypedDict):
r"""Enable strict schema adherence"""
class ToolDefinitionJSONFunction(BaseModel):
class ToolDefinitionJSONFunctionFunction(BaseModel):
r"""Function definition for tool calling"""
name: str
@@ -79,23 +83,46 @@ class ToolDefinitionJSONFunction(BaseModel):
return m
class ToolDefinitionJSONTypedDict(TypedDict):
r"""Tool definition for function calling"""
class ToolDefinitionJSONFunctionTypedDict(TypedDict):
type: ToolDefinitionJSONType
function: ToolDefinitionJSONFunctionTypedDict
function: ToolDefinitionJSONFunctionFunctionTypedDict
r"""Function definition for tool calling"""
cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict]
r"""Cache control for the content part"""
class ToolDefinitionJSON(BaseModel):
r"""Tool definition for function calling"""
class ToolDefinitionJSONFunction(BaseModel):
type: ToolDefinitionJSONType
function: ToolDefinitionJSONFunction
function: ToolDefinitionJSONFunctionFunction
r"""Function definition for tool calling"""
cache_control: Optional[ChatMessageContentItemCacheControl] = None
r"""Cache control for the content part"""
ToolDefinitionJSONTypedDict = TypeAliasType(
"ToolDefinitionJSONTypedDict",
Union[
DatetimeServerToolTypedDict,
WebSearchServerToolTypedDict,
ToolDefinitionJSONFunctionTypedDict,
WebSearchShorthandTypedDict,
],
)
r"""Tool definition for function calling (regular function or OpenRouter built-in server tool)"""
ToolDefinitionJSON = Annotated[
Union[
Annotated[ToolDefinitionJSONFunction, Tag("function")],
Annotated[DatetimeServerTool, Tag("openrouter:datetime")],
Annotated[WebSearchServerTool, Tag("openrouter:web_search")],
Annotated[WebSearchShorthand, Tag("web_search")],
Annotated[WebSearchShorthand, Tag("web_search_preview")],
Annotated[WebSearchShorthand, Tag("web_search_preview_2025_03_11")],
Annotated[WebSearchShorthand, Tag("web_search_2025_08_26")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
r"""Tool definition for function calling (regular function or OpenRouter built-in server tool)"""
@@ -0,0 +1,120 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
WebSearchServerToolTypeOpenrouterWebSearch = Literal["openrouter:web_search",]
WebSearchServerToolEngine = Union[
Literal[
"auto",
"native",
"exa",
],
UnrecognizedStr,
]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
WebSearchServerToolSearchContextSize = Union[
Literal[
"low",
"medium",
"high",
],
UnrecognizedStr,
]
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
WebSearchServerToolParametersType = Literal["approximate",]
class WebSearchServerToolUserLocationTypedDict(TypedDict):
r"""Approximate user location for location-biased results."""
type: NotRequired[WebSearchServerToolParametersType]
city: NotRequired[str]
region: NotRequired[str]
country: NotRequired[str]
timezone: NotRequired[str]
class WebSearchServerToolUserLocation(BaseModel):
r"""Approximate user location for location-biased results."""
type: Optional[WebSearchServerToolParametersType] = None
city: Optional[str] = None
region: Optional[str] = None
country: Optional[str] = None
timezone: Optional[str] = None
class WebSearchServerToolParametersTypedDict(TypedDict):
engine: NotRequired[WebSearchServerToolEngine]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
max_total_results: NotRequired[float]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
search_context_size: NotRequired[WebSearchServerToolSearchContextSize]
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
user_location: NotRequired[WebSearchServerToolUserLocationTypedDict]
r"""Approximate user location for location-biased results."""
allowed_domains: NotRequired[List[str]]
r"""Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search."""
excluded_domains: NotRequired[List[str]]
r"""Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search."""
class WebSearchServerToolParameters(BaseModel):
engine: Annotated[
Optional[WebSearchServerToolEngine], PlainValidator(validate_open_enum(False))
] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
max_total_results: Optional[float] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
search_context_size: Annotated[
Optional[WebSearchServerToolSearchContextSize],
PlainValidator(validate_open_enum(False)),
] = None
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
user_location: Optional[WebSearchServerToolUserLocation] = None
r"""Approximate user location for location-biased results."""
allowed_domains: Optional[List[str]] = None
r"""Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search."""
excluded_domains: Optional[List[str]] = None
r"""Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search."""
class WebSearchServerToolTypedDict(TypedDict):
r"""OpenRouter built-in server tool: searches the web for current information"""
type: WebSearchServerToolTypeOpenrouterWebSearch
parameters: NotRequired[WebSearchServerToolParametersTypedDict]
class WebSearchServerTool(BaseModel):
r"""OpenRouter built-in server tool: searches the web for current information"""
type: WebSearchServerToolTypeOpenrouterWebSearch
parameters: Optional[WebSearchServerToolParameters] = None
@@ -0,0 +1,218 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
WebSearchShorthandType = Union[
Literal[
"web_search",
"web_search_preview",
"web_search_preview_2025_03_11",
"web_search_2025_08_26",
],
UnrecognizedStr,
]
WebSearchShorthandEngine = Union[
Literal[
"auto",
"native",
"exa",
],
UnrecognizedStr,
]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
WebSearchShorthandSearchContextSize = Union[
Literal[
"low",
"medium",
"high",
],
UnrecognizedStr,
]
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
WebSearchShorthandTypeApproximate = Literal["approximate",]
class WebSearchShorthandUserLocationTypedDict(TypedDict):
r"""Approximate user location for location-biased results."""
type: NotRequired[WebSearchShorthandTypeApproximate]
city: NotRequired[str]
region: NotRequired[str]
country: NotRequired[str]
timezone: NotRequired[str]
class WebSearchShorthandUserLocation(BaseModel):
r"""Approximate user location for location-biased results."""
type: Optional[WebSearchShorthandTypeApproximate] = None
city: Optional[str] = None
region: Optional[str] = None
country: Optional[str] = None
timezone: Optional[str] = None
WebSearchShorthandParametersEngine = Union[
Literal[
"auto",
"native",
"exa",
],
UnrecognizedStr,
]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
WebSearchShorthandParametersSearchContextSize = Union[
Literal[
"low",
"medium",
"high",
],
UnrecognizedStr,
]
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
WebSearchShorthandParametersType = Literal["approximate",]
class WebSearchShorthandParametersUserLocationTypedDict(TypedDict):
r"""Approximate user location for location-biased results."""
type: NotRequired[WebSearchShorthandParametersType]
city: NotRequired[str]
region: NotRequired[str]
country: NotRequired[str]
timezone: NotRequired[str]
class WebSearchShorthandParametersUserLocation(BaseModel):
r"""Approximate user location for location-biased results."""
type: Optional[WebSearchShorthandParametersType] = None
city: Optional[str] = None
region: Optional[str] = None
country: Optional[str] = None
timezone: Optional[str] = None
class WebSearchShorthandParametersTypedDict(TypedDict):
engine: NotRequired[WebSearchShorthandParametersEngine]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
max_total_results: NotRequired[float]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
search_context_size: NotRequired[WebSearchShorthandParametersSearchContextSize]
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
user_location: NotRequired[WebSearchShorthandParametersUserLocationTypedDict]
r"""Approximate user location for location-biased results."""
allowed_domains: NotRequired[List[str]]
r"""Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search."""
excluded_domains: NotRequired[List[str]]
r"""Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search."""
class WebSearchShorthandParameters(BaseModel):
engine: Annotated[
Optional[WebSearchShorthandParametersEngine],
PlainValidator(validate_open_enum(False)),
] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
max_total_results: Optional[float] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
search_context_size: Annotated[
Optional[WebSearchShorthandParametersSearchContextSize],
PlainValidator(validate_open_enum(False)),
] = None
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
user_location: Optional[WebSearchShorthandParametersUserLocation] = None
r"""Approximate user location for location-biased results."""
allowed_domains: Optional[List[str]] = None
r"""Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search."""
excluded_domains: Optional[List[str]] = None
r"""Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search."""
class WebSearchShorthandTypedDict(TypedDict):
r"""Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search."""
type: WebSearchShorthandType
engine: NotRequired[WebSearchShorthandEngine]
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: NotRequired[float]
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
max_total_results: NotRequired[float]
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
search_context_size: NotRequired[WebSearchShorthandSearchContextSize]
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
user_location: NotRequired[WebSearchShorthandUserLocationTypedDict]
r"""Approximate user location for location-biased results."""
allowed_domains: NotRequired[List[str]]
r"""Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search."""
excluded_domains: NotRequired[List[str]]
r"""Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search."""
parameters: NotRequired[WebSearchShorthandParametersTypedDict]
class WebSearchShorthand(BaseModel):
r"""Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search."""
type: Annotated[WebSearchShorthandType, PlainValidator(validate_open_enum(False))]
engine: Annotated[
Optional[WebSearchShorthandEngine], PlainValidator(validate_open_enum(False))
] = None
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search (parameters like max_results, search_context_size, and domain filters are not forwarded to the provider). \"exa\" forces the Exa search API."""
max_results: Optional[float] = None
r"""Maximum number of search results to return per search call. Defaults to 5. Only applies when using the Exa engine; ignored with native provider search."""
max_total_results: Optional[float] = None
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops."""
search_context_size: Annotated[
Optional[WebSearchShorthandSearchContextSize],
PlainValidator(validate_open_enum(False)),
] = None
r"""How much context to retrieve per result. Defaults to medium (15000 chars). Only applies when using the Exa engine; ignored with native provider search."""
user_location: Optional[WebSearchShorthandUserLocation] = None
r"""Approximate user location for location-biased results."""
allowed_domains: Optional[List[str]] = None
r"""Limit search results to these domains. Only applies when using the Exa engine; ignored with native provider search."""
excluded_domains: Optional[List[str]] = None
r"""Exclude search results from these domains. Only applies when using the Exa engine; ignored with native provider search."""
parameters: Optional[WebSearchShorthandParameters] = None
+5
View File
@@ -15,6 +15,7 @@ if TYPE_CHECKING:
BadRequestResponseError,
BadRequestResponseErrorData,
)
from .conflictresponse_error import ConflictResponseError, ConflictResponseErrorData
from .edgenetworktimeoutresponse_error import (
EdgeNetworkTimeoutResponseError,
EdgeNetworkTimeoutResponseErrorData,
@@ -69,6 +70,8 @@ __all__ = [
"BadGatewayResponseErrorData",
"BadRequestResponseError",
"BadRequestResponseErrorData",
"ConflictResponseError",
"ConflictResponseErrorData",
"EdgeNetworkTimeoutResponseError",
"EdgeNetworkTimeoutResponseErrorData",
"ForbiddenResponseError",
@@ -104,6 +107,8 @@ _dynamic_imports: dict[str, str] = {
"BadGatewayResponseErrorData": ".badgatewayresponse_error",
"BadRequestResponseError": ".badrequestresponse_error",
"BadRequestResponseErrorData": ".badrequestresponse_error",
"ConflictResponseError": ".conflictresponse_error",
"ConflictResponseErrorData": ".conflictresponse_error",
"EdgeNetworkTimeoutResponseError": ".edgenetworktimeoutresponse_error",
"EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponse_error",
"ForbiddenResponseError": ".forbiddenresponse_error",
@@ -0,0 +1,36 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from openrouter.components import (
conflictresponseerrordata as components_conflictresponseerrordata,
)
from openrouter.errors import OpenRouterError
from openrouter.types import BaseModel, OptionalNullable, UNSET
from typing import Optional
class ConflictResponseErrorData(BaseModel):
error: components_conflictresponseerrordata.ConflictResponseErrorData
r"""Error data for ConflictResponse"""
user_id: OptionalNullable[str] = UNSET
@dataclass(unsafe_hash=True)
class ConflictResponseError(OpenRouterError):
r"""Conflict - Resource conflict or concurrent modification"""
data: ConflictResponseErrorData = field(hash=False)
def __init__(
self,
data: ConflictResponseErrorData,
raw_response: httpx.Response,
body: Optional[str] = None,
):
fallback = body or raw_response.text
message = str(data.error.message) or fallback
super().__init__(message, raw_response, body)
object.__setattr__(self, "data", data)
+12 -12
View File
@@ -18,7 +18,7 @@ class Models(BaseSDK):
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
output_modality: Optional[str] = None,
output_modalities: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -33,7 +33,7 @@ class Models(BaseSDK):
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param output_modality: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -53,7 +53,7 @@ class Models(BaseSDK):
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
output_modality=output_modality,
output_modalities=output_modalities,
)
req = self._build_request(
@@ -133,7 +133,7 @@ class Models(BaseSDK):
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
output_modality: Optional[str] = None,
output_modalities: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -148,7 +148,7 @@ class Models(BaseSDK):
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param output_modality: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -168,7 +168,7 @@ class Models(BaseSDK):
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
output_modality=output_modality,
output_modalities=output_modalities,
)
req = self._build_request_async(
@@ -250,7 +250,7 @@ class Models(BaseSDK):
x_open_router_categories: Optional[str] = None,
category: Optional[operations.Category] = None,
supported_parameters: Optional[str] = None,
output_modality: Optional[str] = None,
output_modalities: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -267,7 +267,7 @@ class Models(BaseSDK):
:param category: Filter models by use case category
:param supported_parameters:
:param output_modality: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -289,7 +289,7 @@ class Models(BaseSDK):
x_open_router_categories=x_open_router_categories,
category=category,
supported_parameters=supported_parameters,
output_modality=output_modality,
output_modalities=output_modalities,
)
req = self._build_request(
@@ -371,7 +371,7 @@ class Models(BaseSDK):
x_open_router_categories: Optional[str] = None,
category: Optional[operations.Category] = None,
supported_parameters: Optional[str] = None,
output_modality: Optional[str] = None,
output_modalities: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -388,7 +388,7 @@ class Models(BaseSDK):
:param category: Filter models by use case category
:param supported_parameters:
:param output_modality: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -410,7 +410,7 @@ class Models(BaseSDK):
x_open_router_categories=x_open_router_categories,
category=category,
supported_parameters=supported_parameters,
output_modality=output_modality,
output_modalities=output_modalities,
)
req = self._build_request_async(
+12 -2
View File
@@ -411,7 +411,7 @@ class OAuth(BaseSDK):
),
),
request=req,
error_status_codes=["400", "401", "4XX", "500", "5XX"],
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"],
retry_config=retry_config,
)
@@ -430,6 +430,11 @@ class OAuth(BaseSDK):
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "409", "application/json"):
response_data = unmarshal_json_response(
errors.ConflictResponseErrorData, http_res
)
raise errors.ConflictResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
@@ -564,7 +569,7 @@ class OAuth(BaseSDK):
),
),
request=req,
error_status_codes=["400", "401", "4XX", "500", "5XX"],
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"],
retry_config=retry_config,
)
@@ -583,6 +588,11 @@ class OAuth(BaseSDK):
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "409", "application/json"):
response_data = unmarshal_json_response(
errors.ConflictResponseErrorData, http_res
)
raise errors.ConflictResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
+2 -2
View File
@@ -97,7 +97,7 @@ class GetModelsRequestTypedDict(TypedDict):
category: NotRequired[Category]
r"""Filter models by use case category"""
supported_parameters: NotRequired[str]
output_modality: NotRequired[str]
output_modalities: NotRequired[str]
r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\"."""
@@ -141,7 +141,7 @@ class GetModelsRequest(BaseModel):
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
output_modality: Annotated[
output_modalities: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
+2 -2
View File
@@ -68,7 +68,7 @@ class ListModelsCountRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
output_modality: NotRequired[str]
output_modalities: NotRequired[str]
r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\"."""
@@ -101,7 +101,7 @@ class ListModelsCountRequest(BaseModel):
"""
output_modality: Annotated[
output_modalities: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
Generated
+1 -1
View File
@@ -211,7 +211,7 @@ wheels = [
[[package]]
name = "openrouter"
version = "0.8.0"
version = "0.9.0"
source = { editable = "." }
dependencies = [
{ name = "httpcore" },