Compare commits

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

GitOrigin-RevId: 50539a3577b5a7e925b756f6bb87744052701215
2026-03-12 15:49:53 +00:00
100 changed files with 245 additions and 3498 deletions
+4 -63
View File
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
management:
docChecksum: fff8b3c28663df858db3a222b1f62d40
docChecksum: 74d4d2140677e899c1489f39198ea464
docVersion: 1.0.0
speakeasyVersion: 1.666.0
generationVersion: 2.768.0
releaseVersion: 0.9.0
configChecksum: e6f61aeb6e1587fb2f6f67ef3b5217c5
releaseVersion: 0.8.0
configChecksum: fd866e0d9d3fef2d1d0ef2a52689a406
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true
@@ -74,7 +74,6 @@ 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
@@ -86,7 +85,6 @@ 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
@@ -145,19 +143,14 @@ 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
@@ -357,7 +350,6 @@ 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
@@ -368,7 +360,6 @@ 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
@@ -406,25 +397,13 @@ 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
@@ -571,12 +550,7 @@ 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
@@ -599,7 +573,6 @@ 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
@@ -647,28 +620,9 @@ 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
@@ -907,11 +861,8 @@ 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
@@ -978,9 +929,6 @@ 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
@@ -1037,9 +985,7 @@ 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
@@ -1058,8 +1004,6 @@ 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
@@ -1067,7 +1011,6 @@ 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
@@ -1159,7 +1102,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": [{"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}
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}
"400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"401":
@@ -1477,8 +1420,6 @@ 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.9.0
version: 0.8.0
additionalDependencies:
dev: {}
main: {}
+55 -746
View File
@@ -589,31 +589,6 @@ 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'
@@ -622,7 +597,6 @@ 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
@@ -1088,39 +1062,6 @@ 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
@@ -1137,39 +1078,6 @@ 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)
@@ -1218,40 +1126,15 @@ 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
@@ -1271,40 +1154,15 @@ 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
@@ -3115,93 +2973,6 @@ 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:
@@ -3589,9 +3360,6 @@ 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
@@ -4332,41 +4100,10 @@ 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'
@@ -4642,11 +4379,6 @@ 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:
@@ -4660,7 +4392,7 @@ components:
tools:
type: array
items:
anyOf:
oneOf:
- allOf:
- $ref: '#/components/schemas/OpenResponsesFunctionTool'
- type: object
@@ -4696,8 +4428,6 @@ 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:
@@ -5010,19 +4740,6 @@ 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
@@ -10003,89 +9720,6 @@ 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:
@@ -10306,7 +9940,7 @@ components:
tools:
type: array
items:
anyOf:
oneOf:
- type: object
properties:
name:
@@ -10465,8 +10099,6 @@ components:
required:
- type
- name
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/AnthropicWebSearchServerTool'
tool_choice:
oneOf:
- type: object
@@ -10909,19 +10541,6 @@ 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
@@ -12216,320 +11835,63 @@ components:
- $ref: '#/components/schemas/NamedToolChoice'
description: Tool choice configuration
example: auto
DatetimeServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:datetime
parameters:
type: object
properties:
timezone:
type: string
description: IANA timezone name (e.g. "America/New_York"). Defaults to UTC.
example: America/New_York
required:
- type
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
type: object
properties:
type:
type: string
enum:
- function
function:
type: object
properties:
type:
name:
type: string
enum:
- function
function:
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:
name:
location:
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
description: City name
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)
- location
cache_control:
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
required:
- type
- function
description: Tool definition for function calling
example:
type: function
function:
@@ -12775,19 +12137,6 @@ 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
@@ -13961,40 +13310,6 @@ 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:
@@ -15364,7 +14679,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_modalities
name: output_modality
in: query
responses:
'200':
@@ -15374,7 +14689,7 @@ paths:
schema:
$ref: '#/components/schemas/ModelsCountResponse'
'400':
description: Bad Request - Invalid output_modalities value
description: Bad Request - Invalid output_modality value
content:
application/json:
schema:
@@ -15429,7 +14744,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_modalities
name: output_modality
in: query
- schema:
type: string
@@ -18531,12 +17846,6 @@ 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:
+55 -715
View File
@@ -591,32 +591,6 @@ 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'
@@ -625,7 +599,6 @@ 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
@@ -1097,37 +1070,6 @@ 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
@@ -1144,37 +1086,6 @@ 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)
@@ -1223,38 +1134,15 @@ 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
@@ -1274,38 +1162,15 @@ 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
@@ -3136,93 +3001,6 @@ 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:
@@ -3610,9 +3388,6 @@ 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
@@ -4352,40 +4127,10 @@ 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'
@@ -4663,11 +4408,6 @@ 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:
@@ -4681,7 +4421,7 @@ components:
tools:
type: array
items:
anyOf:
oneOf:
- allOf:
- $ref: '#/components/schemas/OpenResponsesFunctionTool'
- type: object
@@ -4718,8 +4458,6 @@ 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:
@@ -5017,19 +4755,6 @@ 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
@@ -10059,83 +9784,6 @@ 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:
@@ -10356,7 +10004,7 @@ components:
tools:
type: array
items:
anyOf:
oneOf:
- type: object
properties:
name:
@@ -10519,8 +10167,6 @@ components:
required:
- type
- name
- $ref: '#/components/schemas/DatetimeServerTool'
- $ref: '#/components/schemas/AnthropicWebSearchServerTool'
tool_choice:
oneOf:
- type: object
@@ -10951,19 +10597,6 @@ 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
@@ -12257,303 +11890,63 @@ components:
- $ref: '#/components/schemas/NamedToolChoice'
description: Tool choice configuration
example: auto
DatetimeServerTool:
type: object
properties:
type:
type: string
enum:
- openrouter:datetime
parameters:
type: object
properties:
timezone:
type: string
description: IANA timezone name (e.g. "America/New_York"). Defaults to UTC.
example: America/New_York
required:
- type
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
type: object
properties:
type:
type: string
enum:
- function
function:
type: object
properties:
type:
name:
type: string
enum:
- function
function:
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:
name:
location:
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
description: City name
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)
- location
cache_control:
$ref: '#/components/schemas/ChatMessageContentItemCacheControl'
required:
- type
- function
description: Tool definition for function calling
example:
type: function
function:
@@ -12785,19 +12178,6 @@ 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
@@ -13963,40 +13343,6 @@ 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:
@@ -15399,7 +14745,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_modalities
name: output_modality
in: query
responses:
'200':
@@ -15409,7 +14755,7 @@ paths:
schema:
$ref: '#/components/schemas/ModelsCountResponse'
'400':
description: Bad Request - Invalid output_modalities value
description: Bad Request - Invalid output_modality value
content:
application/json:
schema:
@@ -15467,7 +14813,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_modalities
name: output_modality
in: query
responses:
'200':
@@ -18615,12 +17961,6 @@ 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:33bc86b7a9b24082a410a8b5cbdd05ee359c9be2c88a2947893942d6bca20dca
sourceBlobDigest: sha256:63c840be5dfe448c1d3f6ec9c15e1d92d117b35cccd134b1e736e1fb563d013d
sourceRevisionDigest: sha256:2fa3ed22056b6be20af56e6548a094381d1d32359ecdfec536c73556fc9717aa
sourceBlobDigest: sha256:f445d8b8c9319ec5f7ab85c2b6194692070cc259047254a08a6b1c127cef09dd
tags:
- latest
- main
@@ -18,10 +18,10 @@ targets:
open-router:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:33bc86b7a9b24082a410a8b5cbdd05ee359c9be2c88a2947893942d6bca20dca
sourceBlobDigest: sha256:63c840be5dfe448c1d3f6ec9c15e1d92d117b35cccd134b1e736e1fb563d013d
sourceRevisionDigest: sha256:2fa3ed22056b6be20af56e6548a094381d1d32359ecdfec536c73556fc9717aa
sourceBlobDigest: sha256:f445d8b8c9319ec5f7ab85c2b6194692070cc259047254a08a6b1c127cef09dd
codeSamplesNamespace: open-router-python-code-samples
codeSamplesRevisionDigest: sha256:b23dcc24419d8d006315e89e7a2fe131e28d72f19edb4fa920c97658e9e78073
codeSamplesRevisionDigest: sha256:8c9d4cec31e4cfe341de1c43b2f557a838837aad7923f86a2eb62ae3c95d09a9
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.666.0
@@ -1,8 +0,0 @@
# ChatGenerationParamsIDContextCompression
## Values
| Name | Value |
| --------------------- | --------------------- |
| `CONTEXT_COMPRESSION` | context-compression |
@@ -1,10 +0,0 @@
# 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,9 +33,3 @@ value: components.ChatGenerationParamsPluginFileParser = /* values here */
value: components.ChatGenerationParamsPluginResponseHealing = /* values here */
```
### `components.ChatGenerationParamsPluginContextCompression`
```python
value: components.ChatGenerationParamsPluginContextCompression = /* values here */
```
@@ -1,12 +0,0 @@
# 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 |
@@ -1,10 +0,0 @@
# ContextCompressionEngine
The compression engine to use. Defaults to "middle-out".
## Values
| Name | Value |
| ------------ | ------------ |
| `MIDDLE_OUT` | middle-out |
-11
View File
@@ -1,11 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# DatetimeServerToolType
## Values
| Name | Value |
| --------------------- | --------------------- |
| `OPENROUTER_DATETIME` | openrouter:datetime |
@@ -69,9 +69,3 @@ value: components.ResponsesOutputItemFileSearchCall = /* values here */
value: components.ResponsesImageGenerationCall = /* values here */
```
### `components.ResponsesServerToolOutput`
```python
value: components.ResponsesServerToolOutput = /* values here */
```
@@ -1,8 +0,0 @@
# OpenResponsesRequestIDContextCompression
## Values
| Name | Value |
| --------------------- | --------------------- |
| `CONTEXT_COMPRESSION` | context-compression |
@@ -1,10 +0,0 @@
# 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,9 +33,3 @@ value: components.OpenResponsesRequestPluginFileParser = /* values here */
value: components.OpenResponsesRequestPluginResponseHealing = /* values here */
```
### `components.OpenResponsesRequestPluginContextCompression`
```python
value: components.OpenResponsesRequestPluginContextCompression = /* values here */
```
@@ -87,15 +87,3 @@ 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,21 +167,3 @@ 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,11 +5,9 @@ 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/>} |
| `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 |
| 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/>} |
@@ -1,12 +0,0 @@
# 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,5 +5,4 @@
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
@@ -1,13 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# OpenResponsesWebSearchCallCompletedType
## Values
| Name | Value |
| ------------------------------------ | ------------------------------------ |
| `RESPONSE_WEB_SEARCH_CALL_COMPLETED` | response.web_search_call.completed |
@@ -1,13 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# OpenResponsesWebSearchCallInProgressType
## Values
| Name | Value |
| -------------------------------------- | -------------------------------------- |
| `RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS` | response.web_search_call.in_progress |
@@ -1,13 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# OpenResponsesWebSearchCallSearchingType
## Values
| Name | Value |
| ------------------------------------ | ------------------------------------ |
| `RESPONSE_WEB_SEARCH_CALL_SEARCHING` | response.web_search_call.searching |
@@ -5,11 +5,8 @@ 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 | |
| `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 | |
| 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 | |
@@ -1,12 +0,0 @@
# 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 |
@@ -1,9 +0,0 @@
# 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,11 +5,8 @@ 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 | |
| `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 | |
| 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 | |
@@ -1,12 +0,0 @@
# 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 |
@@ -1,9 +0,0 @@
# 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,11 +5,9 @@ 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/>} |
| `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 |
| 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/>} |
@@ -1,12 +0,0 @@
# 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,5 +5,4 @@
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `excluded_domains` | List[*str*] | :heavy_minus_sign: | N/A |
| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A |
-6
View File
@@ -41,9 +41,3 @@ value: components.ResponsesOutputItemFileSearchCall = /* values here */
value: components.ResponsesImageGenerationCall = /* values here */
```
### `components.ResponsesServerToolOutput`
```python
value: components.ResponsesServerToolOutput = /* values here */
```
@@ -1,13 +0,0 @@
# 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/>} |
@@ -1,10 +0,0 @@
# ResponsesServerToolOutputStatus
## Values
| Name | Value |
| ------------- | ------------- |
| `COMPLETED` | completed |
| `IN_PROGRESS` | in_progress |
| `INCOMPLETE` | incomplete |
@@ -1,11 +0,0 @@
# 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 |
@@ -1,9 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# ResponsesWebSearchServerToolType
## Values
| Name | Value |
| ----------------------- | ----------------------- |
| `OPENROUTER_WEB_SEARCH` | openrouter:web_search |
+7 -44
View File
@@ -1,49 +1,12 @@
# ToolDefinitionJSON
Tool definition for function calling (regular function or OpenRouter built-in server tool)
Tool definition for function calling
## 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 */
```
## Fields
| 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,10 +1,13 @@
# ToolDefinitionJSONFunction
Function definition for tool calling
## Fields
| 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/>} |
| 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 |
@@ -1,13 +0,0 @@
# 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
@@ -1,11 +0,0 @@
# 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 |
@@ -1,12 +0,0 @@
# 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 |
@@ -1,14 +0,0 @@
# 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. | |
@@ -1,8 +0,0 @@
# WebSearchServerToolParametersType
## Values
| Name | Value |
| ------------- | ------------- |
| `APPROXIMATE` | approximate |
@@ -1,12 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# WebSearchServerToolTypeOpenrouterWebSearch
## Values
| Name | Value |
| ----------------------- | ----------------------- |
| `OPENROUTER_WEB_SEARCH` | openrouter:web_search |
@@ -1,14 +0,0 @@
# 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
@@ -1,18 +0,0 @@
# 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 | |
@@ -1,12 +0,0 @@
# 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 |
@@ -1,14 +0,0 @@
# 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. | |
@@ -1,12 +0,0 @@
# 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 |
@@ -1,12 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# WebSearchShorthandParametersType
## Values
| Name | Value |
| ------------- | ------------- |
| `APPROXIMATE` | approximate |
@@ -1,14 +0,0 @@
# 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 |
@@ -1,12 +0,0 @@
# 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
@@ -1,11 +0,0 @@
# 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 |
@@ -1,8 +0,0 @@
# WebSearchShorthandTypeApproximate
## Values
| Name | Value |
| ------------- | ------------- |
| `APPROXIMATE` | approximate |
@@ -1,14 +0,0 @@
# 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
@@ -1,11 +0,0 @@
# 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_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 |
| `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 |
+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_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 |
| `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 |
+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_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 |
| `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 |
| `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_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 |
| `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 |
| `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,6 +113,5 @@ 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.9.0"
version = "0.8.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.9.0"
__version__: str = "0.8.0"
__openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.9.0 2.768.0 1.0.0 openrouter"
__user_agent__: str = "speakeasy-sdk/python 0.8.0 2.768.0 1.0.0 openrouter"
try:
if __package__ is not None:
-216
View File
@@ -39,7 +39,6 @@ if TYPE_CHECKING:
ChatGenerationParams,
ChatGenerationParamsBy,
ChatGenerationParamsIDAutoRouter,
ChatGenerationParamsIDContextCompression,
ChatGenerationParamsIDFileParser,
ChatGenerationParamsIDModeration,
ChatGenerationParamsIDResponseHealing,
@@ -57,8 +56,6 @@ if TYPE_CHECKING:
ChatGenerationParamsPartition,
ChatGenerationParamsPluginAutoRouter,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginContextCompression,
ChatGenerationParamsPluginContextCompressionTypedDict,
ChatGenerationParamsPluginFileParser,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginModeration,
@@ -196,24 +193,12 @@ 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 (
@@ -623,7 +608,6 @@ if TYPE_CHECKING:
from .openresponsesrequest import (
OpenResponsesRequest,
OpenResponsesRequestIDAutoRouter,
OpenResponsesRequestIDContextCompression,
OpenResponsesRequestIDFileParser,
OpenResponsesRequestIDModeration,
OpenResponsesRequestIDResponseHealing,
@@ -640,8 +624,6 @@ if TYPE_CHECKING:
OpenResponsesRequestOrderTypedDict,
OpenResponsesRequestPluginAutoRouter,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginContextCompression,
OpenResponsesRequestPluginContextCompressionTypedDict,
OpenResponsesRequestPluginFileParser,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginModeration,
@@ -751,46 +733,23 @@ 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,
@@ -1059,11 +1018,6 @@ if TYPE_CHECKING:
)
from .responsesoutputmodality import ResponsesOutputModality
from .responsessearchcontextsize import ResponsesSearchContextSize
from .responsesservertooloutput import (
ResponsesServerToolOutput,
ResponsesServerToolOutputStatus,
ResponsesServerToolOutputTypedDict,
)
from .responseswebsearchcalloutput import (
Action,
ActionFindInPage,
@@ -1083,13 +1037,6 @@ if TYPE_CHECKING:
TypeURL,
TypeWebSearchCall,
)
from .responseswebsearchservertool import (
ResponsesWebSearchServerTool,
ResponsesWebSearchServerToolParameters,
ResponsesWebSearchServerToolParametersTypedDict,
ResponsesWebSearchServerToolType,
ResponsesWebSearchServerToolTypedDict,
)
from .responseswebsearchuserlocation import (
ResponsesWebSearchUserLocation,
ResponsesWebSearchUserLocationType,
@@ -1123,8 +1070,6 @@ if TYPE_CHECKING:
from .tooldefinitionjson import (
ToolDefinitionJSON,
ToolDefinitionJSONFunction,
ToolDefinitionJSONFunctionFunction,
ToolDefinitionJSONFunctionFunctionTypedDict,
ToolDefinitionJSONFunctionTypedDict,
ToolDefinitionJSONType,
ToolDefinitionJSONTypedDict,
@@ -1164,35 +1109,6 @@ 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__ = [
@@ -1236,7 +1152,6 @@ __all__ = [
"ChatGenerationParams",
"ChatGenerationParamsBy",
"ChatGenerationParamsIDAutoRouter",
"ChatGenerationParamsIDContextCompression",
"ChatGenerationParamsIDFileParser",
"ChatGenerationParamsIDModeration",
"ChatGenerationParamsIDResponseHealing",
@@ -1254,8 +1169,6 @@ __all__ = [
"ChatGenerationParamsPartition",
"ChatGenerationParamsPluginAutoRouter",
"ChatGenerationParamsPluginAutoRouterTypedDict",
"ChatGenerationParamsPluginContextCompression",
"ChatGenerationParamsPluginContextCompressionTypedDict",
"ChatGenerationParamsPluginFileParser",
"ChatGenerationParamsPluginFileParserTypedDict",
"ChatGenerationParamsPluginModeration",
@@ -1352,15 +1265,12 @@ __all__ = [
"CompoundFilter",
"CompoundFilterType",
"CompoundFilterTypedDict",
"ConflictResponseErrorData",
"ConflictResponseErrorDataTypedDict",
"ConnectorID",
"Container",
"ContainerAuto",
"ContainerAutoTypedDict",
"ContainerType",
"ContainerTypedDict",
"ContextCompressionEngine",
"CostDetails",
"CostDetailsTypedDict",
"CreateChargeRequest",
@@ -1368,11 +1278,6 @@ __all__ = [
"Data",
"DataCollection",
"DataTypedDict",
"DatetimeServerTool",
"DatetimeServerToolParameters",
"DatetimeServerToolParametersTypedDict",
"DatetimeServerToolType",
"DatetimeServerToolTypedDict",
"DebugOptions",
"DebugOptionsTypedDict",
"DefaultParameters",
@@ -1671,7 +1576,6 @@ __all__ = [
"OpenResponsesReasoningTypedDict",
"OpenResponsesRequest",
"OpenResponsesRequestIDAutoRouter",
"OpenResponsesRequestIDContextCompression",
"OpenResponsesRequestIDFileParser",
"OpenResponsesRequestIDModeration",
"OpenResponsesRequestIDResponseHealing",
@@ -1688,8 +1592,6 @@ __all__ = [
"OpenResponsesRequestOrderTypedDict",
"OpenResponsesRequestPluginAutoRouter",
"OpenResponsesRequestPluginAutoRouterTypedDict",
"OpenResponsesRequestPluginContextCompression",
"OpenResponsesRequestPluginContextCompressionTypedDict",
"OpenResponsesRequestPluginFileParser",
"OpenResponsesRequestPluginFileParserTypedDict",
"OpenResponsesRequestPluginModeration",
@@ -1762,34 +1664,17 @@ __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",
@@ -2013,16 +1898,8 @@ __all__ = [
"ResponsesOutputMessageTypedDict",
"ResponsesOutputModality",
"ResponsesSearchContextSize",
"ResponsesServerToolOutput",
"ResponsesServerToolOutputStatus",
"ResponsesServerToolOutputTypedDict",
"ResponsesWebSearchCallOutput",
"ResponsesWebSearchCallOutputTypedDict",
"ResponsesWebSearchServerTool",
"ResponsesWebSearchServerToolParameters",
"ResponsesWebSearchServerToolParametersTypedDict",
"ResponsesWebSearchServerToolType",
"ResponsesWebSearchServerToolTypedDict",
"ResponsesWebSearchUserLocation",
"ResponsesWebSearchUserLocationType",
"ResponsesWebSearchUserLocationTypedDict",
@@ -2053,8 +1930,6 @@ __all__ = [
"ToolChoiceOptionTypedDict",
"ToolDefinitionJSON",
"ToolDefinitionJSONFunction",
"ToolDefinitionJSONFunctionFunction",
"ToolDefinitionJSONFunctionFunctionTypedDict",
"ToolDefinitionJSONFunctionTypedDict",
"ToolDefinitionJSONType",
"ToolDefinitionJSONTypedDict",
@@ -2117,31 +1992,6 @@ __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",
]
@@ -2169,7 +2019,6 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParams": ".chatgenerationparams",
"ChatGenerationParamsBy": ".chatgenerationparams",
"ChatGenerationParamsIDAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsIDContextCompression": ".chatgenerationparams",
"ChatGenerationParamsIDFileParser": ".chatgenerationparams",
"ChatGenerationParamsIDModeration": ".chatgenerationparams",
"ChatGenerationParamsIDResponseHealing": ".chatgenerationparams",
@@ -2187,8 +2036,6 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsPartition": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginContextCompression": ".chatgenerationparams",
"ChatGenerationParamsPluginContextCompressionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
@@ -2298,18 +2145,10 @@ _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",
@@ -2642,7 +2481,6 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesRequest": ".openresponsesrequest",
"OpenResponsesRequestIDAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestIDContextCompression": ".openresponsesrequest",
"OpenResponsesRequestIDFileParser": ".openresponsesrequest",
"OpenResponsesRequestIDModeration": ".openresponsesrequest",
"OpenResponsesRequestIDResponseHealing": ".openresponsesrequest",
@@ -2659,8 +2497,6 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequestOrderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginContextCompression": ".openresponsesrequest",
"OpenResponsesRequestPluginContextCompressionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParser": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginModeration": ".openresponsesrequest",
@@ -2762,34 +2598,17 @@ _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",
@@ -2987,9 +2806,6 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputMessageTypedDict": ".responsesoutputmessage",
"ResponsesOutputModality": ".responsesoutputmodality",
"ResponsesSearchContextSize": ".responsessearchcontextsize",
"ResponsesServerToolOutput": ".responsesservertooloutput",
"ResponsesServerToolOutputStatus": ".responsesservertooloutput",
"ResponsesServerToolOutputTypedDict": ".responsesservertooloutput",
"Action": ".responseswebsearchcalloutput",
"ActionFindInPage": ".responseswebsearchcalloutput",
"ActionFindInPageTypedDict": ".responseswebsearchcalloutput",
@@ -3007,11 +2823,6 @@ _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",
@@ -3035,8 +2846,6 @@ _dynamic_imports: dict[str, str] = {
"ToolChoiceOptionTypedDict": ".toolchoiceoption",
"ToolDefinitionJSON": ".tooldefinitionjson",
"ToolDefinitionJSONFunction": ".tooldefinitionjson",
"ToolDefinitionJSONFunctionFunction": ".tooldefinitionjson",
"ToolDefinitionJSONFunctionFunctionTypedDict": ".tooldefinitionjson",
"ToolDefinitionJSONFunctionTypedDict": ".tooldefinitionjson",
"ToolDefinitionJSONType": ".tooldefinitionjson",
"ToolDefinitionJSONTypedDict": ".tooldefinitionjson",
@@ -3067,31 +2876,6 @@ _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,7 +2,6 @@
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
@@ -406,27 +405,6 @@ 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",]
@@ -542,7 +520,6 @@ ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginContextCompressionTypedDict,
ChatGenerationParamsPluginWebTypedDict,
],
)
@@ -555,9 +532,6 @@ 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")),
]
@@ -1,61 +0,0 @@
"""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
@@ -1,8 +0,0 @@
"""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\"."""
@@ -1,34 +0,0 @@
"""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,10 +40,6 @@ from .responsesoutputitemfunctioncall import (
ResponsesOutputItemFunctionCall,
ResponsesOutputItemFunctionCallTypedDict,
)
from .responsesservertooloutput import (
ResponsesServerToolOutput,
ResponsesServerToolOutputTypedDict,
)
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
ResponsesWebSearchCallOutputTypedDict,
@@ -343,7 +339,6 @@ OpenResponsesInputUnion1TypedDict = TypeAliasType(
ResponsesWebSearchCallOutputTypedDict,
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
ResponsesServerToolOutputTypedDict,
OpenResponsesFunctionCallOutputTypedDict,
OpenResponsesFunctionToolCallTypedDict,
OpenResponsesInputMessageTypedDict,
@@ -362,7 +357,6 @@ 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,
OpenResponsesCustomToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesCustomToolTypedDict,
OpenResponsesNonStreamingResponseToolFunctionTypedDict,
OpenResponsesFileSearchToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesMcpToolTypedDict,
OpenResponsesImageGenerationToolTypedDict,
],
@@ -1,9 +1,7 @@
"""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 (
@@ -82,10 +80,6 @@ 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,
@@ -163,20 +157,18 @@ class OpenResponsesRequestToolFunction(BaseModel):
OpenResponsesRequestToolUnionTypedDict = TypeAliasType(
"OpenResponsesRequestToolUnionTypedDict",
Union[
OpenResponsesLocalShellToolTypedDict,
OpenResponsesApplyPatchToolTypedDict,
OpenResponsesFunctionShellToolTypedDict,
ResponsesWebSearchServerToolTypedDict,
DatetimeServerToolTypedDict,
OpenResponsesLocalShellToolTypedDict,
OpenResponsesCodeInterpreterToolTypedDict,
OpenResponsesCustomToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesComputerToolTypedDict,
OpenResponsesRequestToolFunctionTypedDict,
OpenResponsesFileSearchToolTypedDict,
OpenResponsesWebSearch20250826ToolTypedDict,
OpenResponsesWebSearchToolTypedDict,
OpenResponsesWebSearchPreview20250311ToolTypedDict,
OpenResponsesWebSearchPreviewToolTypedDict,
OpenResponsesCustomToolTypedDict,
OpenResponsesRequestToolFunctionTypedDict,
OpenResponsesFileSearchToolTypedDict,
OpenResponsesMcpToolTypedDict,
OpenResponsesImageGenerationToolTypedDict,
],
@@ -202,8 +194,6 @@ 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")),
]
@@ -459,27 +449,6 @@ 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",]
@@ -595,7 +564,6 @@ OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
OpenResponsesRequestPluginResponseHealingTypedDict,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginContextCompressionTypedDict,
OpenResponsesRequestPluginWebTypedDict,
],
)
@@ -608,9 +576,6 @@ 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,18 +53,6 @@ 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
@@ -684,25 +672,22 @@ OpenResponsesStreamEventTypedDict = TypeAliasType(
OpenResponsesStreamEventResponseFailedTypedDict,
OpenResponsesStreamEventResponseOutputItemAddedTypedDict,
OpenResponsesStreamEventResponseOutputItemDoneTypedDict,
OpenResponsesWebSearchCallCompletedTypedDict,
OpenResponsesWebSearchCallSearchingTypedDict,
OpenResponsesWebSearchCallInProgressTypedDict,
OpenResponsesImageGenCallCompletedTypedDict,
OpenResponsesImageGenCallGeneratingTypedDict,
OpenResponsesImageGenCallInProgressTypedDict,
OpenResponsesStreamEventResponseFunctionCallArgumentsDeltaTypedDict,
OpenResponsesErrorEventTypedDict,
OpenResponsesReasoningSummaryTextDeltaEventTypedDict,
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
OpenResponsesStreamEventResponseFunctionCallArgumentsDeltaTypedDict,
OpenResponsesStreamEventResponseRefusalDeltaTypedDict,
OpenResponsesReasoningSummaryPartAddedEventTypedDict,
OpenResponsesStreamEventResponseContentPartAddedTypedDict,
OpenResponsesImageGenCallPartialImageTypedDict,
OpenResponsesStreamEventResponseFunctionCallArgumentsDoneTypedDict,
OpenResponsesReasoningDeltaEventTypedDict,
OpenResponsesReasoningDoneEventTypedDict,
OpenResponsesReasoningSummaryPartAddedEventTypedDict,
OpenResponsesStreamEventResponseReasoningSummaryPartDoneTypedDict,
OpenResponsesStreamEventResponseContentPartAddedTypedDict,
OpenResponsesStreamEventResponseFunctionCallArgumentsDoneTypedDict,
OpenResponsesStreamEventResponseRefusalDoneTypedDict,
OpenResponsesStreamEventResponseRefusalDeltaTypedDict,
OpenResponsesImageGenCallPartialImageTypedDict,
OpenResponsesStreamEventResponseReasoningSummaryPartDoneTypedDict,
OpenResponsesReasoningSummaryTextDeltaEventTypedDict,
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
OpenResponsesStreamEventResponseContentPartDoneTypedDict,
OpenResponsesStreamEventResponseOutputTextDeltaTypedDict,
OpenResponsesStreamEventResponseOutputTextDoneTypedDict,
@@ -802,18 +787,6 @@ 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,12 +12,11 @@ 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, Union
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -26,18 +25,15 @@ 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", "excluded_domains"]
nullable_fields = ["allowed_domains", "excluded_domains"]
optional_fields = ["allowed_domains"]
nullable_fields = ["allowed_domains"]
null_default_fields = []
serialized = handler(self)
@@ -65,17 +61,6 @@ 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)"""
@@ -85,10 +70,6 @@ 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):
@@ -106,24 +87,9 @@ 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",
"engine",
"max_results",
]
optional_fields = ["filters", "search_context_size", "user_location"]
nullable_fields = ["filters", "user_location"]
null_default_fields = []
@@ -1,30 +0,0 @@
"""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
@@ -1,32 +0,0 @@
"""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
@@ -1,30 +0,0 @@
"""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,12 +12,11 @@ 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, Union
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -26,58 +25,6 @@ OpenResponsesWebSearchPreview20250311ToolType = Literal[
]
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 OpenResponsesWebSearchPreview20250311ToolFiltersTypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
excluded_domains: NotRequired[Nullable[List[str]]]
class OpenResponsesWebSearchPreview20250311ToolFilters(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", "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)"""
@@ -85,13 +32,6 @@ class OpenResponsesWebSearchPreview20250311ToolTypedDict(TypedDict):
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):
@@ -106,27 +46,10 @@ class OpenResponsesWebSearchPreview20250311Tool(BaseModel):
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"]
optional_fields = ["search_context_size", "user_location"]
nullable_fields = ["user_location"]
null_default_fields = []
serialized = handler(self)
@@ -12,70 +12,17 @@ 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, Union
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
OpenResponsesWebSearchPreviewToolType = Literal["web_search_preview",]
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 OpenResponsesWebSearchPreviewToolFiltersTypedDict(TypedDict):
allowed_domains: NotRequired[Nullable[List[str]]]
excluded_domains: NotRequired[Nullable[List[str]]]
class OpenResponsesWebSearchPreviewToolFilters(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", "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"""
@@ -83,11 +30,6 @@ class OpenResponsesWebSearchPreviewToolTypedDict(TypedDict):
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):
@@ -102,27 +44,10 @@ class OpenResponsesWebSearchPreviewTool(BaseModel):
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"]
optional_fields = ["search_context_size", "user_location"]
nullable_fields = ["user_location"]
null_default_fields = []
serialized = handler(self)
@@ -12,12 +12,11 @@ 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, Union
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -26,18 +25,15 @@ 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", "excluded_domains"]
nullable_fields = ["allowed_domains", "excluded_domains"]
optional_fields = ["allowed_domains"]
nullable_fields = ["allowed_domains"]
null_default_fields = []
serialized = handler(self)
@@ -65,17 +61,6 @@ 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"""
@@ -85,10 +70,6 @@ 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):
@@ -106,24 +87,9 @@ 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",
"engine",
"max_results",
]
optional_fields = ["filters", "search_context_size", "user_location"]
nullable_fields = ["filters", "user_location"]
null_default_fields = []
@@ -21,16 +21,14 @@ 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 TypeAliasType
from typing_extensions import Annotated, TypeAliasType
ResponsesOutputItemTypedDict = TypeAliasType(
@@ -39,7 +37,6 @@ ResponsesOutputItemTypedDict = TypeAliasType(
ResponsesWebSearchCallOutputTypedDict,
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
ResponsesServerToolOutputTypedDict,
ResponsesOutputMessageTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
ResponsesOutputItemReasoningTypedDict,
@@ -48,16 +45,15 @@ ResponsesOutputItemTypedDict = TypeAliasType(
r"""An output item from the response"""
ResponsesOutputItem = TypeAliasType(
"ResponsesOutputItem",
ResponsesOutputItem = Annotated[
Union[
ResponsesWebSearchCallOutput,
ResponsesOutputItemFileSearchCall,
ResponsesImageGenerationCall,
ResponsesServerToolOutput,
ResponsesOutputMessage,
ResponsesOutputItemFunctionCall,
ResponsesOutputItemReasoning,
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")],
],
)
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
r"""An output item from the response"""
@@ -1,55 +0,0 @@
"""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]
@@ -1,39 +0,0 @@
"""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
+13 -40
View File
@@ -5,9 +5,6 @@ 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,
@@ -15,16 +12,15 @@ from openrouter.types import (
UNSET,
UNSET_SENTINEL,
)
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
from pydantic import model_serializer
from typing import Any, Dict, Literal, Optional
from typing_extensions import NotRequired, TypedDict
ToolDefinitionJSONType = Literal["function",]
class ToolDefinitionJSONFunctionFunctionTypedDict(TypedDict):
class ToolDefinitionJSONFunctionTypedDict(TypedDict):
r"""Function definition for tool calling"""
name: str
@@ -37,7 +33,7 @@ class ToolDefinitionJSONFunctionFunctionTypedDict(TypedDict):
r"""Enable strict schema adherence"""
class ToolDefinitionJSONFunctionFunction(BaseModel):
class ToolDefinitionJSONFunction(BaseModel):
r"""Function definition for tool calling"""
name: str
@@ -83,46 +79,23 @@ class ToolDefinitionJSONFunctionFunction(BaseModel):
return m
class ToolDefinitionJSONFunctionTypedDict(TypedDict):
class ToolDefinitionJSONTypedDict(TypedDict):
r"""Tool definition for function calling"""
type: ToolDefinitionJSONType
function: ToolDefinitionJSONFunctionFunctionTypedDict
function: ToolDefinitionJSONFunctionTypedDict
r"""Function definition for tool calling"""
cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict]
r"""Cache control for the content part"""
class ToolDefinitionJSONFunction(BaseModel):
class ToolDefinitionJSON(BaseModel):
r"""Tool definition for function calling"""
type: ToolDefinitionJSONType
function: ToolDefinitionJSONFunctionFunction
function: ToolDefinitionJSONFunction
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)"""
@@ -1,120 +0,0 @@
"""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
@@ -1,218 +0,0 @@
"""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,7 +15,6 @@ if TYPE_CHECKING:
BadRequestResponseError,
BadRequestResponseErrorData,
)
from .conflictresponse_error import ConflictResponseError, ConflictResponseErrorData
from .edgenetworktimeoutresponse_error import (
EdgeNetworkTimeoutResponseError,
EdgeNetworkTimeoutResponseErrorData,
@@ -70,8 +69,6 @@ __all__ = [
"BadGatewayResponseErrorData",
"BadRequestResponseError",
"BadRequestResponseErrorData",
"ConflictResponseError",
"ConflictResponseErrorData",
"EdgeNetworkTimeoutResponseError",
"EdgeNetworkTimeoutResponseErrorData",
"ForbiddenResponseError",
@@ -107,8 +104,6 @@ _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",
@@ -1,36 +0,0 @@
"""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_modalities: Optional[str] = None,
output_modality: 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_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 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 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_modalities=output_modalities,
output_modality=output_modality,
)
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_modalities: Optional[str] = None,
output_modality: 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_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 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 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_modalities=output_modalities,
output_modality=output_modality,
)
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_modalities: Optional[str] = None,
output_modality: 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_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 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 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_modalities=output_modalities,
output_modality=output_modality,
)
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_modalities: Optional[str] = None,
output_modality: 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_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 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 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_modalities=output_modalities,
output_modality=output_modality,
)
req = self._build_request_async(
+2 -12
View File
@@ -411,7 +411,7 @@ class OAuth(BaseSDK):
),
),
request=req,
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"],
error_status_codes=["400", "401", "4XX", "500", "5XX"],
retry_config=retry_config,
)
@@ -430,11 +430,6 @@ 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
@@ -569,7 +564,7 @@ class OAuth(BaseSDK):
),
),
request=req,
error_status_codes=["400", "401", "409", "4XX", "500", "5XX"],
error_status_codes=["400", "401", "4XX", "500", "5XX"],
retry_config=retry_config,
)
@@ -588,11 +583,6 @@ 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_modalities: NotRequired[str]
output_modality: 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_modalities: Annotated[
output_modality: 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_modalities: NotRequired[str]
output_modality: 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_modalities: Annotated[
output_modality: 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.9.0"
version = "0.8.0"
source = { editable = "." }
dependencies = [
{ name = "httpcore" },