Project import generated by Copybara.

GitOrigin-RevId: 849282a42d3b2948d0ca0f7fd1427c31af709bbd
This commit is contained in:
OpenRouter Team
2026-01-09 19:20:21 +00:00
parent a35486030a
commit 9073d38dc1
123 changed files with 3734 additions and 1226 deletions
+3 -1
View File
@@ -1,7 +1,9 @@
{
"permissions": {
"allow": [
"Bash(python3:*)"
"Bash(python3:*)",
"Bash(git push:*)",
"Bash(gh pr create:*)"
],
"deny": [],
"ask": []
+67 -23
View File
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
management:
docChecksum: 775966841832e95cb8d37401c576b4b6
docChecksum: 772a7ec8092cfd6437e71806e7b19e28
docVersion: 1.0.0
speakeasyVersion: 1.666.0
generationVersion: 2.768.0
releaseVersion: 0.0.16
configChecksum: cd00e781b0ef78cfcb3fe812f51e93ff
releaseVersion: 0.0.17
configChecksum: 50ef18bf69272fc09c257e3562e1b0df
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true
@@ -29,6 +29,7 @@ features:
globalServerURLs: 3.2.0
globals: 3.0.0
groups: 3.0.1
ignores: 3.0.1
methodArguments: 1.0.2
methodSecurity: 3.0.1
nameOverrides: 3.0.1
@@ -59,21 +60,23 @@ generatedFiles:
- docs/components/chaterrorerror.md
- docs/components/chatgenerationparams.md
- docs/components/chatgenerationparamsdatacollection.md
- docs/components/chatgenerationparamsengine.md
- docs/components/chatgenerationparamsimageconfig.md
- docs/components/chatgenerationparamsmaxprice.md
- docs/components/chatgenerationparamspdf.md
- docs/components/chatgenerationparamspdfengine.md
- docs/components/chatgenerationparamspluginautorouter.md
- docs/components/chatgenerationparamspluginfileparser.md
- docs/components/chatgenerationparamspluginmoderation.md
- docs/components/chatgenerationparamspluginresponsehealing.md
- docs/components/chatgenerationparamspluginunion.md
- docs/components/chatgenerationparamspluginweb.md
- docs/components/chatgenerationparamspreferredmaxlatency.md
- docs/components/chatgenerationparamspreferredmaxlatencyunion.md
- docs/components/chatgenerationparamspreferredminthroughput.md
- docs/components/chatgenerationparamspreferredminthroughputunion.md
- docs/components/chatgenerationparamsprovider.md
- docs/components/chatgenerationparamsresponseformatjsonobject.md
- docs/components/chatgenerationparamsresponseformatpython.md
- docs/components/chatgenerationparamsresponseformattext.md
- docs/components/chatgenerationparamsresponseformatunion.md
- docs/components/chatgenerationparamsroute.md
- docs/components/chatgenerationparamsstop.md
- docs/components/chatgenerationtokenusage.md
- docs/components/chatmessagecontentitem.md
@@ -123,16 +126,17 @@ generatedFiles:
- docs/components/edgenetworktimeoutresponseerrordata.md
- docs/components/effort.md
- docs/components/endpointstatus.md
- docs/components/engine.md
- docs/components/filecitation.md
- docs/components/filecitationtype.md
- docs/components/filepath.md
- docs/components/filepathtype.md
- docs/components/forbiddenresponseerrordata.md
- docs/components/idautorouter.md
- docs/components/idfileparser.md
- docs/components/idmoderation.md
- docs/components/idresponsehealing.md
- docs/components/idweb.md
- docs/components/ignore.md
- docs/components/imagegenerationstatus.md
- docs/components/imageurl.md
- docs/components/inputmodality.md
@@ -144,6 +148,7 @@ generatedFiles:
- docs/components/message.md
- docs/components/messagecontent.md
- docs/components/messagedeveloper.md
- docs/components/modality.md
- docs/components/model.md
- docs/components/modelarchitecture.md
- docs/components/modelarchitectureinstructtype.md
@@ -155,7 +160,6 @@ generatedFiles:
- docs/components/namedtoolchoicefunction.md
- docs/components/notfoundresponseerrordata.md
- docs/components/object.md
- docs/components/only.md
- docs/components/openairesponsesannotation.md
- docs/components/openairesponsesincludable.md
- docs/components/openairesponsesincompletedetails.md
@@ -254,17 +258,19 @@ generatedFiles:
- docs/components/openresponsesreasoningsummarytextdoneeventtype.md
- docs/components/openresponsesreasoningtype.md
- docs/components/openresponsesrequest.md
- docs/components/openresponsesrequestengine.md
- docs/components/openresponsesrequestignore.md
- docs/components/openresponsesrequestimageconfig.md
- docs/components/openresponsesrequestmaxprice.md
- docs/components/openresponsesrequestpdf.md
- docs/components/openresponsesrequestpdfengine.md
- docs/components/openresponsesrequestonly.md
- docs/components/openresponsesrequestorder.md
- docs/components/openresponsesrequestpluginautorouter.md
- docs/components/openresponsesrequestpluginfileparser.md
- docs/components/openresponsesrequestpluginmoderation.md
- docs/components/openresponsesrequestpluginresponsehealing.md
- docs/components/openresponsesrequestpluginunion.md
- docs/components/openresponsesrequestpluginweb.md
- docs/components/openresponsesrequestprovider.md
- docs/components/openresponsesrequestroute.md
- docs/components/openresponsesrequestsort.md
- docs/components/openresponsesrequesttoolfunction.md
- docs/components/openresponsesrequesttoolunion.md
- docs/components/openresponsesrequesttype.md
@@ -300,7 +306,6 @@ generatedFiles:
- docs/components/openresponseswebsearchtool.md
- docs/components/openresponseswebsearchtoolfilters.md
- docs/components/openresponseswebsearchtooltype.md
- docs/components/order.md
- docs/components/outputitemimagegenerationcall.md
- docs/components/outputitemimagegenerationcalltype.md
- docs/components/outputmessage.md
@@ -316,15 +321,38 @@ generatedFiles:
- docs/components/parameter.md
- docs/components/part1.md
- docs/components/part2.md
- docs/components/partition.md
- docs/components/payloadtoolargeresponseerrordata.md
- docs/components/paymentrequiredresponseerrordata.md
- docs/components/pdf.md
- docs/components/pdfengine.md
- docs/components/pdfparserengine.md
- docs/components/pdfparseroptions.md
- docs/components/percentilelatencycutoffs.md
- docs/components/percentilestats.md
- docs/components/percentilethroughputcutoffs.md
- docs/components/perrequestlimits.md
- docs/components/preferredmaxlatency.md
- docs/components/preferredminthroughput.md
- docs/components/pricing.md
- docs/components/prompt.md
- docs/components/prompttokensdetails.md
- docs/components/providername.md
- docs/components/provideroverloadedresponseerrordata.md
- docs/components/providerpreferences.md
- docs/components/providerpreferencesignore.md
- docs/components/providerpreferencesmaxprice.md
- docs/components/providerpreferencesonly.md
- docs/components/providerpreferencesorder.md
- docs/components/providerpreferencespartition.md
- docs/components/providerpreferencesprovidersort.md
- docs/components/providerpreferencesprovidersortconfig.md
- docs/components/providerpreferencessortunion.md
- docs/components/providersort.md
- docs/components/providersortconfig.md
- docs/components/providersortconfigenum.md
- docs/components/providersortconfigunion.md
- docs/components/providersortunion.md
- docs/components/publicendpoint.md
- docs/components/publicendpointquantization.md
- docs/components/publicpricing.md
@@ -373,6 +401,7 @@ generatedFiles:
- docs/components/responsesoutputitemfunctioncallstatusunion.md
- docs/components/responsesoutputitemfunctioncalltype.md
- docs/components/responsesoutputitemreasoning.md
- docs/components/responsesoutputitemreasoningformat.md
- docs/components/responsesoutputitemreasoningstatuscompleted.md
- docs/components/responsesoutputitemreasoningstatusincomplete.md
- docs/components/responsesoutputitemreasoningstatusinprogress.md
@@ -386,6 +415,7 @@ generatedFiles:
- docs/components/responsesoutputmessagestatusinprogress.md
- docs/components/responsesoutputmessagestatusunion.md
- docs/components/responsesoutputmessagetype.md
- docs/components/responsesoutputmodality.md
- docs/components/responsessearchcontextsize.md
- docs/components/responseswebsearchcalloutput.md
- docs/components/responseswebsearchcalloutputtype.md
@@ -393,12 +423,18 @@ generatedFiles:
- docs/components/responseswebsearchuserlocationtype.md
- docs/components/responsetextconfig.md
- docs/components/responsetextconfigverbosity.md
- docs/components/route.md
- docs/components/schema0.md
- docs/components/schema0enum.md
- docs/components/schema3.md
- docs/components/schema3reasoningencrypted.md
- docs/components/schema3reasoningsummary.md
- docs/components/schema3reasoningtext.md
- docs/components/schema5.md
- docs/components/security.md
- docs/components/servicetier.md
- docs/components/serviceunavailableresponseerrordata.md
- docs/components/sort.md
- docs/components/sortenum.md
- docs/components/streamoptions.md
- docs/components/systemmessage.md
- docs/components/systemmessagecontent.md
@@ -440,6 +476,7 @@ generatedFiles:
- docs/components/variables.md
- docs/components/videourl1.md
- docs/components/videourl2.md
- docs/components/websearchengine.md
- docs/components/websearchpreviewtooluserlocation.md
- docs/components/websearchpreviewtooluserlocationtype.md
- docs/components/websearchstatus.md
@@ -473,7 +510,6 @@ generatedFiles:
- docs/operations/createcoinbasechargeresponse.md
- docs/operations/createcoinbasechargesecurity.md
- docs/operations/createembeddingsdata.md
- docs/operations/createembeddingsprovider.md
- docs/operations/createembeddingsrequest.md
- docs/operations/createembeddingsresponse.md
- docs/operations/createembeddingsresponsebody.md
@@ -502,13 +538,11 @@ generatedFiles:
- docs/operations/getkeyresponse.md
- docs/operations/getmodelsrequest.md
- docs/operations/getparametersdata.md
- docs/operations/getparametersprovider.md
- docs/operations/getparametersrequest.md
- docs/operations/getparametersresponse.md
- docs/operations/getparameterssecurity.md
- docs/operations/getuseractivityrequest.md
- docs/operations/getuseractivityresponse.md
- docs/operations/ignore.md
- docs/operations/imageurl.md
- docs/operations/input.md
- docs/operations/inputunion.md
@@ -521,12 +555,9 @@ generatedFiles:
- docs/operations/listprovidersresponse.md
- docs/operations/listrequest.md
- docs/operations/listresponse.md
- docs/operations/maxprice.md
- docs/operations/metadata.md
- docs/operations/object.md
- docs/operations/objectembedding.md
- docs/operations/only.md
- docs/operations/order.md
- docs/operations/ratelimit.md
- docs/operations/sendchatcompletionrequestresponse.md
- docs/operations/supportedparameter.md
@@ -570,6 +601,7 @@ generatedFiles:
- src/openrouter/completions.py
- src/openrouter/components/__init__.py
- src/openrouter/components/_schema0.py
- src/openrouter/components/_schema3.py
- src/openrouter/components/activityitem.py
- src/openrouter/components/assistantmessage.py
- src/openrouter/components/badgatewayresponseerrordata.py
@@ -667,10 +699,20 @@ generatedFiles:
- src/openrouter/components/parameter.py
- src/openrouter/components/payloadtoolargeresponseerrordata.py
- src/openrouter/components/paymentrequiredresponseerrordata.py
- src/openrouter/components/pdfparserengine.py
- src/openrouter/components/pdfparseroptions.py
- src/openrouter/components/percentilelatencycutoffs.py
- src/openrouter/components/percentilestats.py
- src/openrouter/components/percentilethroughputcutoffs.py
- src/openrouter/components/perrequestlimits.py
- src/openrouter/components/preferredmaxlatency.py
- src/openrouter/components/preferredminthroughput.py
- src/openrouter/components/providername.py
- src/openrouter/components/provideroverloadedresponseerrordata.py
- src/openrouter/components/providerpreferences.py
- src/openrouter/components/providersort.py
- src/openrouter/components/providersortconfig.py
- src/openrouter/components/providersortunion.py
- src/openrouter/components/publicendpoint.py
- src/openrouter/components/publicpricing.py
- src/openrouter/components/quantization.py
@@ -696,6 +738,7 @@ generatedFiles:
- src/openrouter/components/responsesoutputitemfunctioncall.py
- src/openrouter/components/responsesoutputitemreasoning.py
- src/openrouter/components/responsesoutputmessage.py
- src/openrouter/components/responsesoutputmodality.py
- src/openrouter/components/responsessearchcontextsize.py
- src/openrouter/components/responseswebsearchcalloutput.py
- src/openrouter/components/responseswebsearchuserlocation.py
@@ -712,6 +755,7 @@ generatedFiles:
- src/openrouter/components/unprocessableentityresponseerrordata.py
- src/openrouter/components/urlcitation.py
- src/openrouter/components/usermessage.py
- src/openrouter/components/websearchengine.py
- src/openrouter/components/websearchpreviewtooluserlocation.py
- src/openrouter/components/websearchstatus.py
- src/openrouter/credits.py
@@ -961,7 +1005,7 @@ examples:
slug: "<value>"
responses:
"200":
application/json: {"data": {"id": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "endpoints": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}}
application/json: {"data": {"id": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "endpoints": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "uptime_last_30m": 99.5, "supports_implicit_caching": true, "latency_last_30m": {"p50": 0.25, "p75": 0.35, "p90": 0.48, "p99": 0.85}, "throughput_last_30m": {"p50": 45.2, "p75": 38.5, "p90": 28.3, "p99": 15.1}}]}}
"404":
application/json: {"error": {"code": 404, "message": "Resource not found"}}
"500":
@@ -970,7 +1014,7 @@ examples:
speakeasy-default-list-endpoints-zdr:
responses:
"200":
application/json: {"data": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}
application/json: {"data": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "uptime_last_30m": 99.5, "supports_implicit_caching": true, "latency_last_30m": {"p50": 25.5, "p75": 35.2, "p90": 48.7, "p99": 85.3}, "throughput_last_30m": {"p50": 25.5, "p75": 35.2, "p90": 48.7, "p99": 85.3}}]}
"500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
getParameters:
+3 -1
View File
@@ -31,7 +31,7 @@ generation:
skipResponseBodyAssertions: false
preApplyUnionDiscriminators: true
python:
version: 0.0.16
version: 0.0.17
additionalDependencies:
dev: {}
main: {}
@@ -39,6 +39,8 @@ python:
- id
- object
- input
- models
- hash
asyncMode: both
authors:
- OpenRouter
+527 -236
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
lintVersion: 1.0.0
defaultRuleset: openrouter
rulesets:
openrouter:
rulesets:
- speakeasy-recommended
- speakeasy-generation
rules:
oas3-missing-example:
severity: "off"
+507 -221
View File
@@ -269,7 +269,25 @@ components:
allOf:
- $ref: '#/components/schemas/OutputItemReasoning'
- type: object
properties: {}
properties:
signature:
type: string
nullable: true
description: A signature for the reasoning content, used for verification
example: EvcBCkgIChABGAIqQKkSDbRuVEQUk9qN1odC098l9SEj...
format:
type: string
nullable: true
enum:
- unknown
- openai-responses-v1
- azure-openai-responses-v1
- xai-responses-v1
- anthropic-claude-v1
- google-gemini-v1
description: The format of the reasoning content
example: anthropic-claude-v1
x-speakeasy-unknown-values: allow
example:
id: reasoning-123
type: reasoning
@@ -280,6 +298,8 @@ components:
content:
- type: reasoning_text
text: First, we analyze the problem...
signature: EvcBCkgIChABGAIqQKkSDbRuVEQUk9qN1odC098l9SEj...
format: anthropic-claude-v1
description: An output item containing reasoning
OutputItemFunctionCall:
type: object
@@ -3239,6 +3259,7 @@ components:
enum:
- unknown
- openai-responses-v1
- azure-openai-responses-v1
- xai-responses-v1
- anthropic-claude-v1
- google-gemini-v1
@@ -3434,6 +3455,12 @@ components:
example:
summary: auto
enabled: true
ResponsesOutputModality:
type: string
enum:
- text
- image
x-speakeasy-unknown-values: allow
OpenAIResponsesIncludable:
type: string
enum:
@@ -3487,7 +3514,6 @@ components:
- Fireworks
- Friendli
- GMICloud
- GoPomelo
- Google
- Google AI Studio
- Groq
@@ -3517,13 +3543,14 @@ components:
- Phala
- Relace
- SambaNova
- Seed
- SiliconFlow
- Sourceful
- Stealth
- StreamLake
- Switchpoint
- Targon
- Together
- Upstage
- Venice
- WandB
- Xiaomi
@@ -3548,19 +3575,113 @@ components:
x-speakeasy-unknown-values: allow
ProviderSort:
type: string
nullable: true
enum:
- price
- throughput
- latency
description: >-
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
example: price
x-speakeasy-unknown-values: allow
ProviderSortConfig:
type: object
properties:
by:
anyOf:
- $ref: '#/components/schemas/ProviderSort'
- type: 'null'
partition:
anyOf:
- type: string
enum:
- model
- none
x-speakeasy-unknown-values: allow
- type: 'null'
BigNumberUnion:
type: string
description: A value in string format that is a large number
example: 1000
PercentileThroughputCutoffs:
type: object
properties:
p50:
type: number
nullable: true
description: Minimum p50 throughput (tokens/sec)
p75:
type: number
nullable: true
description: Minimum p75 throughput (tokens/sec)
p90:
type: number
nullable: true
description: Minimum p90 throughput (tokens/sec)
p99:
type: number
nullable: true
description: Minimum p99 throughput (tokens/sec)
description: Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
example:
p50: 100
p90: 50
PreferredMinThroughput:
anyOf:
- type: number
- $ref: '#/components/schemas/PercentileThroughputCutoffs'
- nullable: true
description: >-
Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
example: 100
PercentileLatencyCutoffs:
type: object
properties:
p50:
type: number
nullable: true
description: Maximum p50 latency (seconds)
p75:
type: number
nullable: true
description: Maximum p75 latency (seconds)
p90:
type: number
nullable: true
description: Maximum p90 latency (seconds)
p99:
type: number
nullable: true
description: Maximum p99 latency (seconds)
description: Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
example:
p50: 5
p90: 10
PreferredMaxLatency:
anyOf:
- type: number
- $ref: '#/components/schemas/PercentileLatencyCutoffs'
- nullable: true
description: >-
Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
example: 5
WebSearchEngine:
type: string
enum:
- native
- exa
description: The search engine to use for web search.
x-speakeasy-unknown-values: allow
PDFParserEngine:
type: string
enum:
- mistral-ocr
- pdf-text
- native
description: The engine to use for parsing PDF files.
x-speakeasy-unknown-values: allow
PDFParserOptions:
type: object
properties:
engine:
$ref: '#/components/schemas/PDFParserEngine'
description: Options for PDF parsing.
OpenResponsesRequest:
type: object
properties:
@@ -3631,6 +3752,24 @@ components:
minimum: 0
top_k:
type: number
image_config:
type: object
additionalProperties:
anyOf:
- type: string
- type: number
description: >-
Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details.
example:
aspect_ratio: '16:9'
modalities:
type: array
items:
$ref: '#/components/schemas/ResponsesOutputModality'
description: Output modalities for the response. Supported values are "text" and "image".
example:
- text
- image
prompt_cache_key:
type: string
nullable: true
@@ -3733,7 +3872,13 @@ components:
$ref: '#/components/schemas/Quantization'
description: A list of quantization levels to filter the provider by.
sort:
$ref: '#/components/schemas/ProviderSort'
anyOf:
- $ref: '#/components/schemas/ProviderSort'
- $ref: '#/components/schemas/ProviderSortConfig'
- nullable: true
description: >-
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
example: price
max_price:
type: object
properties:
@@ -3749,24 +3894,37 @@ components:
$ref: '#/components/schemas/BigNumberUnion'
description: >-
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
min_throughput:
type: number
nullable: true
example: 100
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
max_latency:
type: number
nullable: true
example: 5
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
preferred_min_throughput:
$ref: '#/components/schemas/PreferredMinThroughput'
preferred_max_latency:
$ref: '#/components/schemas/PreferredMaxLatency'
additionalProperties: false
description: When multiple model providers are available, optionally indicate your routing preference.
plugins:
type: array
items:
oneOf:
- type: object
properties:
id:
type: string
enum:
- auto-router
enabled:
type: boolean
description: Set to false to disable the auto-router plugin for this request. Defaults to true.
allowed_models:
type: array
items:
type: string
description: >-
List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list.
example:
- anthropic/*
- openai/gpt-4o
- google/*
required:
- id
- type: object
properties:
id:
@@ -3789,11 +3947,7 @@ components:
search_prompt:
type: string
engine:
type: string
enum:
- native
- exa
x-speakeasy-unknown-values: allow
$ref: '#/components/schemas/WebSearchEngine'
required:
- id
- type: object
@@ -3806,15 +3960,7 @@ components:
type: boolean
description: Set to false to disable the file-parser plugin for this request. Defaults to true.
pdf:
type: object
properties:
engine:
type: string
enum:
- mistral-ocr
- pdf-text
- native
x-speakeasy-unknown-values: allow
$ref: '#/components/schemas/PDFParserOptions'
required:
- id
- type: object
@@ -3835,8 +3981,12 @@ components:
enum:
- fallback
- sort
deprecated: true
description: >-
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
x-speakeasy-deprecation-message: Use providers.sort.partition instead.
x-speakeasy-ignore: true
x-fern-ignore: true
x-speakeasy-unknown-values: allow
user:
type: string
@@ -3994,6 +4144,100 @@ components:
amount: 100
sender: '0x1234567890123456789012345678901234567890'
chain_id: 1
ProviderPreferences:
type: object
properties:
allow_fallbacks:
type: boolean
nullable: true
description: >
Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
require_parameters:
type: boolean
nullable: true
description: >-
Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
data_collection:
$ref: '#/components/schemas/DataCollection'
zdr:
type: boolean
nullable: true
description: >-
Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
example: true
enforce_distillable_text:
type: boolean
nullable: true
description: >-
Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
example: true
order:
type: array
nullable: true
items:
anyOf:
- $ref: '#/components/schemas/ProviderName'
- type: string
description: >-
An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
only:
type: array
nullable: true
items:
anyOf:
- $ref: '#/components/schemas/ProviderName'
- type: string
description: >-
List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
ignore:
type: array
nullable: true
items:
anyOf:
- $ref: '#/components/schemas/ProviderName'
- type: string
description: >-
List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
quantizations:
type: array
nullable: true
items:
$ref: '#/components/schemas/Quantization'
description: A list of quantization levels to filter the provider by.
sort:
allOf:
- $ref: '#/components/schemas/ProviderSort'
- anyOf:
- $ref: '#/components/schemas/ProviderSort'
- $ref: '#/components/schemas/ProviderSortConfig'
- nullable: true
description: >-
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
max_price:
type: object
properties:
prompt:
$ref: '#/components/schemas/BigNumberUnion'
completion:
$ref: '#/components/schemas/BigNumberUnion'
image:
$ref: '#/components/schemas/BigNumberUnion'
audio:
$ref: '#/components/schemas/BigNumberUnion'
request:
$ref: '#/components/schemas/BigNumberUnion'
description: >-
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
preferred_min_throughput:
$ref: '#/components/schemas/PreferredMinThroughput'
preferred_max_latency:
$ref: '#/components/schemas/PreferredMaxLatency'
description: Provider routing preferences for the request.
PublicPricing:
type: object
properties:
@@ -4205,6 +4449,7 @@ components:
- parallel_tool_calls
- include_reasoning
- reasoning
- reasoning_effort
- web_search_options
- verbosity
example: temperature
@@ -4431,6 +4676,32 @@ components:
- -10
example: 0
x-speakeasy-unknown-values: allow
PercentileStats:
type: object
nullable: true
properties:
p50:
type: number
description: Median (50th percentile)
example: 25.5
p75:
type: number
description: 75th percentile
example: 35.2
p90:
type: number
description: 90th percentile
example: 48.7
p99:
type: number
description: 99th percentile
example: 85.3
required:
- p50
- p75
- p90
- p99
description: Latency percentiles in seconds over the last 30 minutes. Latency measures time to first token.
PublicEndpoint:
type: object
properties:
@@ -4498,6 +4769,13 @@ components:
nullable: true
supports_implicit_caching:
type: boolean
latency_last_30m:
$ref: '#/components/schemas/PercentileStats'
throughput_last_30m:
allOf:
- $ref: '#/components/schemas/PercentileStats'
- description: >-
Throughput percentiles in tokens per second over the last 30 minutes. Throughput measures output token generation speed.
required:
- name
- model_name
@@ -4511,6 +4789,8 @@ components:
- supported_parameters
- uptime_last_30m
- supports_implicit_caching
- latency_last_30m
- throughput_last_30m
description: Information about a specific model endpoint
example:
name: 'OpenAI: GPT-4'
@@ -4533,6 +4813,16 @@ components:
status: 0
uptime_last_30m: 99.5
supports_implicit_caching: true
latency_last_30m:
p50: 0.25
p75: 0.35
p90: 0.48
p99: 0.85
throughput_last_30m:
p50: 45.2
p75: 38.5
p90: 28.3
p99: 15.1
ListEndpointsResponse:
type: object
properties:
@@ -4636,6 +4926,16 @@ components:
status: default
uptime_last_30m: 99.5
supports_implicit_caching: true
latency_last_30m:
p50: 0.25
p75: 0.35
p90: 0.48
p99: 0.85
throughput_last_30m:
p50: 45.2
p75: 38.5
p90: 28.3
p99: 15.1
__schema0:
type: array
items:
@@ -4668,7 +4968,6 @@ components:
- Fireworks
- Friendli
- GMICloud
- GoPomelo
- Google
- Google AI Studio
- Groq
@@ -4698,13 +4997,14 @@ components:
- Phala
- Relace
- SambaNova
- Seed
- SiliconFlow
- Sourceful
- Stealth
- StreamLake
- Switchpoint
- Targon
- Together
- Upstage
- Venice
- WandB
- Xiaomi
@@ -4722,6 +5022,80 @@ components:
anyOf:
- $ref: '#/components/schemas/ChatCompletionFinishReason'
- type: 'null'
__schema3:
oneOf:
- type: object
properties:
type:
type: string
const: reasoning.summary
summary:
type: string
id:
$ref: '#/components/schemas/__schema4'
format:
$ref: '#/components/schemas/__schema5'
index:
$ref: '#/components/schemas/__schema6'
required:
- type
- summary
- type: object
properties:
type:
type: string
const: reasoning.encrypted
data:
type: string
id:
$ref: '#/components/schemas/__schema4'
format:
$ref: '#/components/schemas/__schema5'
index:
$ref: '#/components/schemas/__schema6'
required:
- type
- data
- type: object
properties:
type:
type: string
const: reasoning.text
text:
anyOf:
- type: string
- type: 'null'
signature:
anyOf:
- type: string
- type: 'null'
id:
$ref: '#/components/schemas/__schema4'
format:
$ref: '#/components/schemas/__schema5'
index:
$ref: '#/components/schemas/__schema6'
required:
- type
type: object
__schema4:
anyOf:
- type: string
- type: 'null'
__schema5:
anyOf:
- type: string
enum:
- unknown
- openai-responses-v1
- azure-openai-responses-v1
- xai-responses-v1
- anthropic-claude-v1
- google-gemini-v1
x-speakeasy-unknown-values: allow
- type: 'null'
__schema6:
type: number
ModelName:
type: string
ChatMessageContentItemText:
@@ -4940,6 +5314,8 @@ components:
properties:
cached_tokens:
type: number
cache_write_tokens:
type: number
audio_tokens:
type: number
video_tokens:
@@ -5264,12 +5640,7 @@ components:
description: >-
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
anyOf:
- type: string
enum:
- price
- throughput
- latency
x-speakeasy-unknown-values: allow
- $ref: '#/components/schemas/ProviderSortUnion'
- type: 'null'
max_price:
description: >-
@@ -5286,17 +5657,55 @@ components:
$ref: '#/components/schemas/__schema1'
request:
$ref: '#/components/schemas/__schema1'
min_throughput:
preferred_min_throughput:
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
anyOf:
- type: number
- anyOf:
- type: number
- type: object
properties:
p50:
anyOf:
- type: number
- type: 'null'
p75:
anyOf:
- type: number
- type: 'null'
p90:
anyOf:
- type: number
- type: 'null'
p99:
anyOf:
- type: number
- type: 'null'
- type: 'null'
max_latency:
preferred_max_latency:
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
anyOf:
- type: number
- anyOf:
- type: number
- type: object
properties:
p50:
anyOf:
- type: number
- type: 'null'
p75:
anyOf:
- type: number
- type: 'null'
p90:
anyOf:
- type: number
- type: 'null'
p99:
anyOf:
- type: number
- type: 'null'
- type: 'null'
additionalProperties: false
- type: 'null'
@@ -5305,6 +5714,19 @@ components:
type: array
items:
oneOf:
- type: object
properties:
id:
type: string
const: auto-router
enabled:
type: boolean
allowed_models:
type: array
items:
type: string
required:
- id
- type: object
properties:
id:
@@ -5361,8 +5783,6 @@ components:
- id
type: object
route:
description: >-
Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria.
anyOf:
- type: string
enum:
@@ -5441,12 +5861,12 @@ components:
anyOf:
- type: string
enum:
- none
- minimal
- low
- medium
- high
- xhigh
- high
- medium
- low
- minimal
- none
x-speakeasy-unknown-values: allow
- type: 'null'
summary:
@@ -5526,8 +5946,28 @@ components:
properties:
echo_upstream_body:
type: boolean
image_config:
type: object
propertyNames:
type: string
additionalProperties:
anyOf:
- type: string
- type: number
modalities:
type: array
items:
type: string
enum:
- text
- image
x-speakeasy-unknown-values: allow
required:
- messages
ProviderSortUnion:
anyOf:
- $ref: '#/components/schemas/ProviderSort'
- $ref: '#/components/schemas/ProviderSortConfig'
ChatResponseChoice:
type: object
properties:
@@ -5537,6 +5977,10 @@ components:
type: number
message:
$ref: '#/components/schemas/AssistantMessage'
reasoning_details:
type: array
items:
$ref: '#/components/schemas/__schema3'
logprobs:
anyOf:
- $ref: '#/components/schemas/ChatMessageTokenLogprobs'
@@ -5587,6 +6031,10 @@ components:
type: array
items:
$ref: '#/components/schemas/ChatStreamingMessageToolCall'
reasoning_details:
type: array
items:
$ref: '#/components/schemas/__schema3'
ChatStreamingChoice:
type: object
properties:
@@ -6413,99 +6861,7 @@ paths:
user:
type: string
provider:
type: object
properties:
allow_fallbacks:
type: boolean
nullable: true
description: >
Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
require_parameters:
type: boolean
nullable: true
description: >-
Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
data_collection:
$ref: '#/components/schemas/DataCollection'
zdr:
type: boolean
nullable: true
description: >-
Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
example: true
enforce_distillable_text:
type: boolean
nullable: true
description: >-
Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
example: true
order:
type: array
nullable: true
items:
anyOf:
- $ref: '#/components/schemas/ProviderName'
- type: string
description: >-
An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
only:
type: array
nullable: true
items:
anyOf:
- $ref: '#/components/schemas/ProviderName'
- type: string
description: >-
List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
ignore:
type: array
nullable: true
items:
anyOf:
- $ref: '#/components/schemas/ProviderName'
- type: string
description: >-
List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
quantizations:
type: array
nullable: true
items:
$ref: '#/components/schemas/Quantization'
description: A list of quantization levels to filter the provider by.
sort:
$ref: '#/components/schemas/ProviderSort'
max_price:
type: object
properties:
prompt:
$ref: '#/components/schemas/BigNumberUnion'
completion:
$ref: '#/components/schemas/BigNumberUnion'
image:
$ref: '#/components/schemas/BigNumberUnion'
audio:
$ref: '#/components/schemas/BigNumberUnion'
request:
$ref: '#/components/schemas/BigNumberUnion'
description: >-
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
min_throughput:
type: number
nullable: true
example: 100
description: >-
The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used.
max_latency:
type: number
nullable: true
example: 5
description: >-
The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used.
$ref: '#/components/schemas/ProviderPreferences'
input_type:
type: string
required:
@@ -7095,78 +7451,7 @@ paths:
name: slug
in: path
- schema:
type: string
enum:
- AI21
- AionLabs
- Alibaba
- Amazon Bedrock
- Amazon Nova
- Anthropic
- Arcee AI
- AtlasCloud
- Avian
- Azure
- BaseTen
- BytePlus
- Black Forest Labs
- Cerebras
- Chutes
- Cirrascale
- Clarifai
- Cloudflare
- Cohere
- Crusoe
- DeepInfra
- DeepSeek
- Featherless
- Fireworks
- Friendli
- GMICloud
- GoPomelo
- Google
- Google AI Studio
- Groq
- Hyperbolic
- Inception
- InferenceNet
- Infermatic
- Inflection
- Liquid
- Mara
- Mancer 2
- Minimax
- ModelRun
- Mistral
- Modular
- Moonshot AI
- Morph
- NCompass
- Nebius
- NextBit
- Novita
- Nvidia
- OpenAI
- OpenInference
- Parasail
- Perplexity
- Phala
- Relace
- SambaNova
- SiliconFlow
- Sourceful
- Stealth
- StreamLake
- Switchpoint
- Targon
- Together
- Venice
- WandB
- Xiaomi
- xAI
- Z.AI
- FakeProvider
x-speakeasy-unknown-values: allow
$ref: '#/components/schemas/ProviderName'
required: false
name: provider
in: query
@@ -7211,6 +7496,7 @@ paths:
- parallel_tool_calls
- include_reasoning
- reasoning
- reasoning_effort
- web_search_options
- verbosity
x-speakeasy-unknown-values: allow
+6 -5
View File
@@ -8,19 +8,20 @@ sources:
- latest
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:cfb565b0217763fa566062e31b6f01db05dfec6bdd0746b429f03b8600588989
sourceBlobDigest: sha256:b985c3342982a1c6e2163e6bb1ebc6066117f1d4c3dfc6fa219768cf6f7fc8d1
sourceRevisionDigest: sha256:fcc289022d99776aaf9434e14ccc3c9878a847384b300158c84391c9f4aed6ce
sourceBlobDigest: sha256:40c2ad7a48417d63a674f078aa75768dc7266885f38003ab3e5c00067d444fbe
tags:
- latest
- subtree-sync-import-python-sdk
- 1.0.0
targets:
open-router:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:cfb565b0217763fa566062e31b6f01db05dfec6bdd0746b429f03b8600588989
sourceBlobDigest: sha256:b985c3342982a1c6e2163e6bb1ebc6066117f1d4c3dfc6fa219768cf6f7fc8d1
sourceRevisionDigest: sha256:fcc289022d99776aaf9434e14ccc3c9878a847384b300158c84391c9f4aed6ce
sourceBlobDigest: sha256:40c2ad7a48417d63a674f078aa75768dc7266885f38003ab3e5c00067d444fbe
codeSamplesNamespace: open-router-python-code-samples
codeSamplesRevisionDigest: sha256:badb3333f4862c5024a05b0b8456c4491edca4c2e3511c10da240942fc5e5397
codeSamplesRevisionDigest: sha256:567674342c32a59ace54f464472abd2784897dbbe9e4bb6f953480ea84e03cf9
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.666.0
+4 -2
View File
@@ -7,7 +7,7 @@
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. |
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
| `route` | [OptionalNullable[components.ChatGenerationParamsRoute]](../components/chatgenerationparamsroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. |
| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. |
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
@@ -31,4 +31,6 @@
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A |
| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A |
@@ -0,0 +1,17 @@
# ChatGenerationParamsImageConfig
## Supported Types
### `str`
```python
value: str = /* values here */
```
### `float`
```python
value: float = /* values here */
```
@@ -0,0 +1,10 @@
# ChatGenerationParamsPluginAutoRouter
## Fields
| Field | Type | Required | Description |
| ------------------------ | ------------------------ | ------------------------ | ------------------------ |
| `id` | *Literal["auto-router"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `allowed_models` | List[*str*] | :heavy_minus_sign: | N/A |
@@ -3,8 +3,8 @@
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `id` | *Literal["file-parser"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[components.ChatGenerationParamsPdf]](../components/chatgenerationparamspdf.md) | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description |
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
| `id` | *Literal["file-parser"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `pdf` | [Optional[components.Pdf]](../components/pdf.md) | :heavy_minus_sign: | N/A |
@@ -3,6 +3,12 @@
## Supported Types
### `components.ChatGenerationParamsPluginAutoRouter`
```python
value: components.ChatGenerationParamsPluginAutoRouter = /* values here */
```
### `components.ChatGenerationParamsPluginModeration`
```python
@@ -3,10 +3,10 @@
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `id` | *Literal["web"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[components.ChatGenerationParamsEngine]](../components/chatgenerationparamsengine.md) | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description |
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
| `id` | *Literal["web"]* | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[components.Engine]](../components/engine.md) | :heavy_minus_sign: | N/A |
@@ -0,0 +1,11 @@
# ChatGenerationParamsPreferredMaxLatency
## Fields
| Field | Type | Required | Description |
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
@@ -0,0 +1,17 @@
# ChatGenerationParamsPreferredMaxLatencyUnion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `components.ChatGenerationParamsPreferredMaxLatency`
```python
value: components.ChatGenerationParamsPreferredMaxLatency = /* values here */
```
@@ -0,0 +1,11 @@
# ChatGenerationParamsPreferredMinThroughput
## Fields
| Field | Type | Required | Description |
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
@@ -0,0 +1,17 @@
# ChatGenerationParamsPreferredMinThroughputUnion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `components.ChatGenerationParamsPreferredMinThroughput`
```python
value: components.ChatGenerationParamsPreferredMinThroughput = /* values here */
```
+15 -15
View File
@@ -3,18 +3,18 @@
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. |
| `data_collection` | [OptionalNullable[components.ChatGenerationParamsDataCollection]](../components/chatgenerationparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `order` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. |
| `only` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. |
| `ignore` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. |
| `quantizations` | List[[components.Quantizations](../components/quantizations.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. |
| `sort` | [OptionalNullable[components.Sort]](../components/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. |
| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. |
| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. |
| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. |
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. |
| `data_collection` | [OptionalNullable[components.ChatGenerationParamsDataCollection]](../components/chatgenerationparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `order` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. |
| `only` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. |
| `ignore` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. |
| `quantizations` | List[[components.Quantizations](../components/quantizations.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. |
| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. |
| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. |
| `preferred_min_throughput` | [OptionalNullable[components.ChatGenerationParamsPreferredMinThroughputUnion]](../components/chatgenerationparamspreferredminthroughputunion.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. |
| `preferred_max_latency` | [OptionalNullable[components.ChatGenerationParamsPreferredMaxLatencyUnion]](../components/chatgenerationparamspreferredmaxlatencyunion.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. |
+1
View File
@@ -8,4 +8,5 @@
| `finish_reason` | [Nullable[components.ChatCompletionFinishReason]](../components/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A |
| `index` | *float* | :heavy_check_mark: | N/A |
| `message` | [components.AssistantMessage](../components/assistantmessage.md) | :heavy_check_mark: | N/A |
| `reasoning_details` | List[[components.Schema3](../components/schema3.md)] | :heavy_minus_sign: | N/A |
| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A |
+2 -1
View File
@@ -9,4 +9,5 @@
| `content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
| `reasoning_details` | List[[components.Schema3](../components/schema3.md)] | :heavy_minus_sign: | N/A |
+5 -5
View File
@@ -5,9 +5,9 @@
| Name | Value |
| --------- | --------- |
| `NONE` | none |
| `MINIMAL` | minimal |
| `LOW` | low |
| `MEDIUM` | medium |
| `XHIGH` | xhigh |
| `HIGH` | high |
| `XHIGH` | xhigh |
| `MEDIUM` | medium |
| `LOW` | low |
| `MINIMAL` | minimal |
| `NONE` | none |
+9
View File
@@ -0,0 +1,9 @@
# Engine
## Values
| Name | Value |
| -------- | -------- |
| `NATIVE` | native |
| `EXA` | exa |
+8
View File
@@ -0,0 +1,8 @@
# IDAutoRouter
## Values
| Name | Value |
| ------------- | ------------- |
| `AUTO_ROUTER` | auto-router |
+9
View File
@@ -0,0 +1,9 @@
# Modality
## Values
| Name | Value |
| ------- | ------- |
| `TEXT` | text |
| `IMAGE` | image |
@@ -3,10 +3,11 @@
## Values
| Name | Value |
| --------------------- | --------------------- |
| `UNKNOWN` | unknown |
| `OPENAI_RESPONSES_V1` | openai-responses-v1 |
| `XAI_RESPONSES_V1` | xai-responses-v1 |
| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 |
| `GOOGLE_GEMINI_V1` | google-gemini-v1 |
| Name | Value |
| --------------------------- | --------------------------- |
| `UNKNOWN` | unknown |
| `OPENAI_RESPONSES_V1` | openai-responses-v1 |
| `AZURE_OPENAI_RESPONSES_V1` | azure-openai-responses-v1 |
| `XAI_RESPONSES_V1` | xai-responses-v1 |
| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 |
| `GOOGLE_GEMINI_V1` | google-gemini-v1 |
+2 -1
View File
@@ -21,6 +21,8 @@ Request schema for Responses endpoint
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | |
| `top_k` | *Optional[float]* | :heavy_minus_sign: | N/A | |
| `image_config` | Dict[str, [components.OpenResponsesRequestImageConfig](../components/openresponsesrequestimageconfig.md)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details. | {<br/>"aspect_ratio": "16:9"<br/>} |
| `modalities` | List[[components.ResponsesOutputModality](../components/responsesoutputmodality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text" and "image". | [<br/>"text",<br/>"image"<br/>] |
| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
| `previous_response_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
| `prompt` | [OptionalNullable[components.OpenAIResponsesPrompt]](../components/openairesponsesprompt.md) | :heavy_minus_sign: | N/A | |
@@ -33,6 +35,5 @@ Request schema for Responses endpoint
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| `route` | [OptionalNullable[components.OpenResponsesRequestRoute]](../components/openresponsesrequestroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. | |
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
@@ -0,0 +1,17 @@
# OpenResponsesRequestIgnore
## Supported Types
### `components.ProviderName`
```python
value: components.ProviderName = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,17 @@
# OpenResponsesRequestImageConfig
## Supported Types
### `str`
```python
value: str = /* values here */
```
### `float`
```python
value: float = /* values here */
```
@@ -0,0 +1,17 @@
# OpenResponsesRequestOnly
## Supported Types
### `components.ProviderName`
```python
value: components.ProviderName = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,17 @@
# OpenResponsesRequestOrder
## Supported Types
### `components.ProviderName`
```python
value: components.ProviderName = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,10 @@
# OpenResponsesRequestPluginAutoRouter
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | [components.IDAutoRouter](../components/idautorouter.md) | :heavy_check_mark: | N/A | |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the auto-router plugin for this request. Defaults to true. | |
| `allowed_models` | List[*str*] | :heavy_minus_sign: | List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. | [<br/>"anthropic/*",<br/>"openai/gpt-4o",<br/>"google/*"<br/>] |
@@ -3,8 +3,8 @@
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `id` | [components.IDFileParser](../components/idfileparser.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. |
| `pdf` | [Optional[components.OpenResponsesRequestPdf]](../components/openresponsesrequestpdf.md) | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `id` | [components.IDFileParser](../components/idfileparser.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. |
| `pdf` | [Optional[components.PDFParserOptions]](../components/pdfparseroptions.md) | :heavy_minus_sign: | Options for PDF parsing. |
@@ -3,6 +3,12 @@
## Supported Types
### `components.OpenResponsesRequestPluginAutoRouter`
```python
value: components.OpenResponsesRequestPluginAutoRouter = /* values here */
```
### `components.OpenResponsesRequestPluginModeration`
```python
@@ -3,10 +3,10 @@
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `id` | [components.IDWeb](../components/idweb.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[components.OpenResponsesRequestEngine]](../components/openresponsesrequestengine.md) | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| `id` | [components.IDWeb](../components/idweb.md) | :heavy_check_mark: | N/A |
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. |
| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `engine` | [Optional[components.WebSearchEngine]](../components/websearchengine.md) | :heavy_minus_sign: | The search engine to use for web search. |
+15 -15
View File
@@ -5,18 +5,18 @@ When multiple model providers are available, optionally indicate your routing pr
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> | |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | |
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. | allow |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true |
| `order` | List[[components.Order](../components/order.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | |
| `only` | List[[components.Only](../components/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | |
| `ignore` | List[[components.Ignore](../components/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
| `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
| `max_price` | [Optional[components.OpenResponsesRequestMaxPrice]](../components/openresponsesrequestmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. | 100 |
| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. | 5 |
| Field | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> | |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | |
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. | allow |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true |
| `order` | List[[components.OpenResponsesRequestOrder](../components/openresponsesrequestorder.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | |
| `only` | List[[components.OpenResponsesRequestOnly](../components/openresponsesrequestonly.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | |
| `ignore` | List[[components.OpenResponsesRequestIgnore](../components/openresponsesrequestignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
| `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
| `sort` | [OptionalNullable[components.OpenResponsesRequestSort]](../components/openresponsesrequestsort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
| `max_price` | [Optional[components.OpenResponsesRequestMaxPrice]](../components/openresponsesrequestmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
| `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 |
| `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 |
@@ -0,0 +1,25 @@
# OpenResponsesRequestSort
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
## Supported Types
### `components.ProviderSort`
```python
value: components.ProviderSort = /* values here */
```
### `components.ProviderSortConfig`
```python
value: components.ProviderSortConfig = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
+1
View File
@@ -26,5 +26,6 @@
| `PARALLEL_TOOL_CALLS` | parallel_tool_calls |
| `INCLUDE_REASONING` | include_reasoning |
| `REASONING` | reasoning |
| `REASONING_EFFORT` | reasoning_effort |
| `WEB_SEARCH_OPTIONS` | web_search_options |
| `VERBOSITY` | verbosity |
+9
View File
@@ -0,0 +1,9 @@
# Partition
## Values
| Name | Value |
| ------- | ------- |
| `MODEL` | model |
| `NONE` | none |
+8
View File
@@ -0,0 +1,8 @@
# Pdf
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `engine` | [Optional[components.PdfEngine]](../components/pdfengine.md) | :heavy_minus_sign: | N/A |
+10
View File
@@ -0,0 +1,10 @@
# PdfEngine
## Values
| Name | Value |
| ------------- | ------------- |
| `MISTRAL_OCR` | mistral-ocr |
| `PDF_TEXT` | pdf-text |
| `NATIVE` | native |
+12
View File
@@ -0,0 +1,12 @@
# PDFParserEngine
The engine to use for parsing PDF files.
## Values
| Name | Value |
| ------------- | ------------- |
| `MISTRAL_OCR` | mistral-ocr |
| `PDF_TEXT` | pdf-text |
| `NATIVE` | native |
+10
View File
@@ -0,0 +1,10 @@
# PDFParserOptions
Options for PDF parsing.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `engine` | [Optional[components.PDFParserEngine]](../components/pdfparserengine.md) | :heavy_minus_sign: | The engine to use for parsing PDF files. |
@@ -0,0 +1,13 @@
# PercentileLatencyCutoffs
Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
## Fields
| Field | Type | Required | Description |
| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- |
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p50 latency (seconds) |
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p75 latency (seconds) |
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p90 latency (seconds) |
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum p99 latency (seconds) |
+13
View File
@@ -0,0 +1,13 @@
# PercentileStats
Latency percentiles in seconds over the last 30 minutes. Latency measures time to first token.
## Fields
| Field | Type | Required | Description | Example |
| ------------------------ | ------------------------ | ------------------------ | ------------------------ | ------------------------ |
| `p50` | *float* | :heavy_check_mark: | Median (50th percentile) | 25.5 |
| `p75` | *float* | :heavy_check_mark: | 75th percentile | 35.2 |
| `p90` | *float* | :heavy_check_mark: | 90th percentile | 48.7 |
| `p99` | *float* | :heavy_check_mark: | 99th percentile | 85.3 |
@@ -0,0 +1,13 @@
# PercentileThroughputCutoffs
Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
## Fields
| Field | Type | Required | Description |
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p50 throughput (tokens/sec) |
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p75 throughput (tokens/sec) |
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p90 throughput (tokens/sec) |
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum p99 throughput (tokens/sec) |
+25
View File
@@ -0,0 +1,25 @@
# PreferredMaxLatency
Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `components.PercentileLatencyCutoffs`
```python
value: components.PercentileLatencyCutoffs = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
+25
View File
@@ -0,0 +1,25 @@
# PreferredMinThroughput
Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `components.PercentileThroughputCutoffs`
```python
value: components.PercentileThroughputCutoffs = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
+6 -5
View File
@@ -3,8 +3,9 @@
## Fields
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `cached_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `audio_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `video_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description |
| -------------------- | -------------------- | -------------------- | -------------------- |
| `cached_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `cache_write_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `audio_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `video_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A |
+2 -2
View File
@@ -31,7 +31,6 @@
| `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud |
| `GO_POMELO` | GoPomelo |
| `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq |
@@ -61,13 +60,14 @@
| `PHALA` | Phala |
| `RELACE` | Relace |
| `SAMBA_NOVA` | SambaNova |
| `SEED` | Seed |
| `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon |
| `TOGETHER` | Together |
| `UPSTAGE` | Upstage |
| `VENICE` | Venice |
| `WAND_B` | WandB |
| `XIAOMI` | Xiaomi |
+22
View File
@@ -0,0 +1,22 @@
# ProviderPreferences
Provider routing preferences for the request.
## Fields
| Field | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> | |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | |
| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. | allow |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true |
| `order` | List[[components.ProviderPreferencesOrder](../components/providerpreferencesorder.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | |
| `only` | List[[components.ProviderPreferencesOnly](../components/providerpreferencesonly.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | |
| `ignore` | List[[components.ProviderPreferencesIgnore](../components/providerpreferencesignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | |
| `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | |
| `sort` | [OptionalNullable[components.ProviderPreferencesSortUnion]](../components/providerpreferencessortunion.md) | :heavy_minus_sign: | N/A | |
| `max_price` | [Optional[components.ProviderPreferencesMaxPrice]](../components/providerpreferencesmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | |
| `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 |
| `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 |
@@ -0,0 +1,17 @@
# ProviderPreferencesIgnore
## Supported Types
### `components.ProviderName`
```python
value: components.ProviderName = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,14 @@
# ProviderPreferencesMaxPrice
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
## Fields
| Field | Type | Required | Description | Example |
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 |
@@ -0,0 +1,17 @@
# ProviderPreferencesOnly
## Supported Types
### `components.ProviderName`
```python
value: components.ProviderName = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,17 @@
# ProviderPreferencesOrder
## Supported Types
### `components.ProviderName`
```python
value: components.ProviderName = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -0,0 +1,9 @@
# ProviderPreferencesPartition
## Values
| Name | Value |
| ------- | ------- |
| `MODEL` | model |
| `NONE` | none |
@@ -0,0 +1,10 @@
# ProviderPreferencesProviderSort
## Values
| Name | Value |
| ------------ | ------------ |
| `PRICE` | price |
| `THROUGHPUT` | throughput |
| `LATENCY` | latency |
@@ -0,0 +1,9 @@
# ProviderPreferencesProviderSortConfig
## Fields
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `by` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | N/A | price |
| `partition` | [OptionalNullable[components.ProviderPreferencesPartition]](../components/providerpreferencespartition.md) | :heavy_minus_sign: | N/A | |
@@ -0,0 +1,25 @@
# ProviderPreferencesSortUnion
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
## Supported Types
### `components.ProviderPreferencesProviderSort`
```python
value: components.ProviderPreferencesProviderSort = /* values here */
```
### `components.ProviderSortConfigUnion`
```python
value: components.ProviderSortConfigUnion = /* values here */
```
### `components.SortEnum`
```python
value: components.SortEnum = /* values here */
```
-2
View File
@@ -1,7 +1,5 @@
# ProviderSort
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
## Values
+9
View File
@@ -0,0 +1,9 @@
# ProviderSortConfig
## Fields
| Field | Type | Required | Description | Example |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `by` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | N/A | price |
| `partition` | [OptionalNullable[components.Partition]](../components/partition.md) | :heavy_minus_sign: | N/A | |
+10
View File
@@ -0,0 +1,10 @@
# ProviderSortConfigEnum
## Values
| Name | Value |
| ------------ | ------------ |
| `PRICE` | price |
| `THROUGHPUT` | throughput |
| `LATENCY` | latency |
@@ -0,0 +1,17 @@
# ProviderSortConfigUnion
## Supported Types
### `components.ProviderPreferencesProviderSortConfig`
```python
value: components.ProviderPreferencesProviderSortConfig = /* values here */
```
### `components.ProviderSortConfigEnum`
```python
value: components.ProviderSortConfigEnum = /* values here */
```
+17
View File
@@ -0,0 +1,17 @@
# ProviderSortUnion
## Supported Types
### `components.ProviderSort`
```python
value: components.ProviderSort = /* values here */
```
### `components.ProviderSortConfig`
```python
value: components.ProviderSortConfig = /* values here */
```
+3 -1
View File
@@ -19,4 +19,6 @@ Information about a specific model endpoint
| `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | N/A | |
| `status` | [Optional[components.EndpointStatus]](../components/endpointstatus.md) | :heavy_minus_sign: | N/A | 0 |
| `uptime_last_30m` | *Nullable[float]* | :heavy_check_mark: | N/A | |
| `supports_implicit_caching` | *bool* | :heavy_check_mark: | N/A | |
| `supports_implicit_caching` | *bool* | :heavy_check_mark: | N/A | |
| `latency_last_30m` | [Nullable[components.PercentileStats]](../components/percentilestats.md) | :heavy_check_mark: | Latency percentiles in seconds over the last 30 minutes. Latency measures time to first token. | |
| `throughput_last_30m` | [Nullable[components.PercentileStats]](../components/percentilestats.md) | :heavy_check_mark: | N/A | |
@@ -5,11 +5,13 @@ An output item containing reasoning
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| `type` | [components.ResponsesOutputItemReasoningType](../components/responsesoutputitemreasoningtype.md) | :heavy_check_mark: | N/A |
| `id` | *str* | :heavy_check_mark: | N/A |
| `content` | List[[components.ReasoningTextContent](../components/reasoningtextcontent.md)] | :heavy_minus_sign: | N/A |
| `summary` | List[[components.ReasoningSummaryText](../components/reasoningsummarytext.md)] | :heavy_check_mark: | N/A |
| `encrypted_content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `status` | [Optional[components.ResponsesOutputItemReasoningStatusUnion]](../components/responsesoutputitemreasoningstatusunion.md) | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| `type` | [components.ResponsesOutputItemReasoningType](../components/responsesoutputitemreasoningtype.md) | :heavy_check_mark: | N/A | |
| `id` | *str* | :heavy_check_mark: | N/A | |
| `content` | List[[components.ReasoningTextContent](../components/reasoningtextcontent.md)] | :heavy_minus_sign: | N/A | |
| `summary` | List[[components.ReasoningSummaryText](../components/reasoningsummarytext.md)] | :heavy_check_mark: | N/A | |
| `encrypted_content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
| `status` | [Optional[components.ResponsesOutputItemReasoningStatusUnion]](../components/responsesoutputitemreasoningstatusunion.md) | :heavy_minus_sign: | N/A | |
| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | A signature for the reasoning content, used for verification | EvcBCkgIChABGAIqQKkSDbRuVEQUk9qN1odC098l9SEj... |
| `format_` | [OptionalNullable[components.ResponsesOutputItemReasoningFormat]](../components/responsesoutputitemreasoningformat.md) | :heavy_minus_sign: | The format of the reasoning content | anthropic-claude-v1 |
@@ -0,0 +1,15 @@
# ResponsesOutputItemReasoningFormat
The format of the reasoning content
## Values
| Name | Value |
| --------------------------- | --------------------------- |
| `UNKNOWN` | unknown |
| `OPENAI_RESPONSES_V1` | openai-responses-v1 |
| `AZURE_OPENAI_RESPONSES_V1` | azure-openai-responses-v1 |
| `XAI_RESPONSES_V1` | xai-responses-v1 |
| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 |
| `GOOGLE_GEMINI_V1` | google-gemini-v1 |
@@ -0,0 +1,9 @@
# ResponsesOutputModality
## Values
| Name | Value |
| ------- | ------- |
| `TEXT` | text |
| `IMAGE` | image |
+9
View File
@@ -0,0 +1,9 @@
# Route
## Values
| Name | Value |
| ---------- | ---------- |
| `FALLBACK` | fallback |
| `SORT` | sort |
+2 -2
View File
@@ -31,7 +31,6 @@
| `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud |
| `GO_POMELO` | GoPomelo |
| `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq |
@@ -61,13 +60,14 @@
| `PHALA` | Phala |
| `RELACE` | Relace |
| `SAMBA_NOVA` | SambaNova |
| `SEED` | Seed |
| `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint |
| `TARGON` | Targon |
| `TOGETHER` | Together |
| `UPSTAGE` | Upstage |
| `VENICE` | Venice |
| `WAND_B` | WandB |
| `XIAOMI` | Xiaomi |
+23
View File
@@ -0,0 +1,23 @@
# Schema3
## Supported Types
### `components.Schema3ReasoningSummary`
```python
value: components.Schema3ReasoningSummary = /* values here */
```
### `components.Schema3ReasoningEncrypted`
```python
value: components.Schema3ReasoningEncrypted = /* values here */
```
### `components.Schema3ReasoningText`
```python
value: components.Schema3ReasoningText = /* values here */
```
@@ -0,0 +1,12 @@
# Schema3ReasoningEncrypted
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A |
| `data` | *str* | :heavy_check_mark: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema5]](../components/schema5.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
@@ -0,0 +1,12 @@
# Schema3ReasoningSummary
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A |
| `summary` | *str* | :heavy_check_mark: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema5]](../components/schema5.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
+13
View File
@@ -0,0 +1,13 @@
# Schema3ReasoningText
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A |
| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema5]](../components/schema5.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
+13
View File
@@ -0,0 +1,13 @@
# Schema5
## Values
| Name | Value |
| --------------------------- | --------------------------- |
| `UNKNOWN` | unknown |
| `OPENAI_RESPONSES_V1` | openai-responses-v1 |
| `AZURE_OPENAI_RESPONSES_V1` | azure-openai-responses-v1 |
| `XAI_RESPONSES_V1` | xai-responses-v1 |
| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 |
| `GOOGLE_GEMINI_V1` | google-gemini-v1 |
+10
View File
@@ -0,0 +1,10 @@
# SortEnum
## Values
| Name | Value |
| ------------ | ------------ |
| `PRICE` | price |
| `THROUGHPUT` | throughput |
| `LATENCY` | latency |
+11
View File
@@ -0,0 +1,11 @@
# WebSearchEngine
The search engine to use for web search.
## Values
| Name | Value |
| -------- | -------- |
| `NATIVE` | native |
| `EXA` | exa |
+9 -9
View File
@@ -3,12 +3,12 @@
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| `input` | [operations.InputUnion](../operations/inputunion.md) | :heavy_check_mark: | N/A |
| `model` | *str* | :heavy_check_mark: | N/A |
| `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.md) | :heavy_minus_sign: | N/A |
| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A |
| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `input` | [operations.InputUnion](../operations/inputunion.md) | :heavy_check_mark: | N/A |
| `model` | *str* | :heavy_check_mark: | N/A |
| `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.md) | :heavy_minus_sign: | N/A |
| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `provider` | [Optional[components.ProviderPreferences]](../components/providerpreferences.md) | :heavy_minus_sign: | Provider routing preferences for the request. |
| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A |
+5 -5
View File
@@ -3,8 +3,8 @@
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `author` | *str* | :heavy_check_mark: | N/A |
| `slug` | *str* | :heavy_check_mark: | N/A |
| `provider` | [Optional[operations.GetParametersProvider]](../operations/getparametersprovider.md) | :heavy_minus_sign: | N/A |
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `author` | *str* | :heavy_check_mark: | N/A | |
| `slug` | *str* | :heavy_check_mark: | N/A | |
| `provider` | [Optional[components.ProviderName]](../components/providername.md) | :heavy_minus_sign: | N/A | OpenAI |
File diff suppressed because one or more lines are too long
+1
View File
@@ -26,5 +26,6 @@
| `PARALLEL_TOOL_CALLS` | parallel_tool_calls |
| `INCLUDE_REASONING` | include_reasoning |
| `REASONING` | reasoning |
| `REASONING_EFFORT` | reasoning_effort |
| `WEB_SEARCH_OPTIONS` | web_search_options |
| `VERBOSITY` | verbosity |
+3 -1
View File
@@ -39,7 +39,7 @@ with OpenRouter(
| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A |
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. |
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. |
| `route` | [OptionalNullable[components.ChatGenerationParamsRoute]](../../components/chatgenerationparamsroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. |
| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. |
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
@@ -63,6 +63,8 @@ with OpenRouter(
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A |
| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A |
| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
### Response
+10 -10
View File
@@ -35,16 +35,16 @@ with OpenRouter(
### Parameters
| Parameter | Type | Required | Description |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `input` | [operations.InputUnion](../../operations/inputunion.md) | :heavy_check_mark: | N/A |
| `model` | *str* | :heavy_check_mark: | N/A |
| `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.md) | :heavy_minus_sign: | N/A |
| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A |
| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| Parameter | Type | Required | Description |
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `input` | [operations.InputUnion](../../operations/inputunion.md) | :heavy_check_mark: | N/A |
| `model` | *str* | :heavy_check_mark: | N/A |
| `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.md) | :heavy_minus_sign: | N/A |
| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `provider` | [Optional[components.ProviderPreferences]](../../components/providerpreferences.md) | :heavy_minus_sign: | Provider routing preferences for the request. |
| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
### Response
+7 -7
View File
@@ -34,13 +34,13 @@ with OpenRouter() as open_router:
### Parameters
| Parameter | Type | Required | Description |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `security` | [operations.GetParametersSecurity](../../operations/getparameterssecurity.md) | :heavy_check_mark: | N/A |
| `author` | *str* | :heavy_check_mark: | N/A |
| `slug` | *str* | :heavy_check_mark: | N/A |
| `provider` | [Optional[operations.GetParametersProvider]](../../operations/getparametersprovider.md) | :heavy_minus_sign: | N/A |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `security` | [operations.GetParametersSecurity](../../operations/getparameterssecurity.md) | :heavy_check_mark: | N/A | |
| `author` | *str* | :heavy_check_mark: | N/A | |
| `slug` | *str* | :heavy_check_mark: | N/A | |
| `provider` | [Optional[components.ProviderName]](../../components/providername.md) | :heavy_minus_sign: | N/A | OpenAI |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
### Response
+2 -1
View File
@@ -52,6 +52,8 @@ with OpenRouter(
| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | |
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | |
| `top_k` | *Optional[float]* | :heavy_minus_sign: | N/A | |
| `image_config` | Dict[str, [components.OpenResponsesRequestImageConfig](../../components/openresponsesrequestimageconfig.md)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details. | {<br/>"aspect_ratio": "16:9"<br/>} |
| `modalities` | List[[components.ResponsesOutputModality](../../components/responsesoutputmodality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text" and "image". | [<br/>"text",<br/>"image"<br/>] |
| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
| `previous_response_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
| `prompt` | [OptionalNullable[components.OpenAIResponsesPrompt]](../../components/openairesponsesprompt.md) | :heavy_minus_sign: | N/A | |
@@ -63,7 +65,6 @@ with OpenRouter(
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| `route` | [OptionalNullable[components.OpenResponsesRequestRoute]](../../components/openresponsesrequestroute.md) | :heavy_minus_sign: | Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. | |
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
+2 -4
View File
@@ -7,12 +7,10 @@ This example demonstrates how to:
"""
from openrouter import OpenRouter
from openrouter.utils.oauth_create_sha256_code_challenge import (
from openrouter.utils import (
oauth_create_sha256_code_challenge,
CreateSHA256CodeChallengeRequest,
)
from openrouter.utils.oauth_create_authorization_url import (
oauth_create_authorization_url,
CreateSHA256CodeChallengeRequest,
CreateAuthorizationUrlRequestWithPKCE,
)
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "openrouter"
version = "0.0.16"
version = "0.0.17"
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.0.16"
__version__: str = "0.0.17"
__openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.0.16 2.768.0 1.0.0 openrouter"
__user_agent__: str = "speakeasy-sdk/python 0.0.17 2.768.0 1.0.0 openrouter"
try:
if __package__ is not None:
+70 -12
View File
@@ -33,7 +33,7 @@ class Chat(BaseSDK):
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None,
@@ -76,6 +76,13 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
image_config: Optional[
Union[
Dict[str, components.ChatGenerationParamsImageConfig],
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
]
] = None,
modalities: Optional[List[components.Modality]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -88,7 +95,7 @@ class Chat(BaseSDK):
:param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param route:
:param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param model:
@@ -112,6 +119,8 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param debug:
:param image_config:
:param modalities:
: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
@@ -136,7 +145,7 @@ class Chat(BaseSDK):
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None,
@@ -179,6 +188,13 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
image_config: Optional[
Union[
Dict[str, components.ChatGenerationParamsImageConfig],
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
]
] = None,
modalities: Optional[List[components.Modality]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -191,7 +207,7 @@ class Chat(BaseSDK):
:param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param route:
:param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param model:
@@ -215,6 +231,8 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param debug:
:param image_config:
:param modalities:
: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
@@ -238,7 +256,7 @@ class Chat(BaseSDK):
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None,
@@ -281,6 +299,13 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
image_config: Optional[
Union[
Dict[str, components.ChatGenerationParamsImageConfig],
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
]
] = None,
modalities: Optional[List[components.Modality]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -293,7 +318,7 @@ class Chat(BaseSDK):
:param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param route:
:param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param model:
@@ -317,6 +342,8 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param debug:
:param image_config:
:param modalities:
: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
@@ -374,6 +401,8 @@ class Chat(BaseSDK):
),
top_p=top_p,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
image_config=image_config,
modalities=modalities,
)
req = self._build_request(
@@ -480,7 +509,7 @@ class Chat(BaseSDK):
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None,
@@ -523,6 +552,13 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
image_config: Optional[
Union[
Dict[str, components.ChatGenerationParamsImageConfig],
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
]
] = None,
modalities: Optional[List[components.Modality]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -535,7 +571,7 @@ class Chat(BaseSDK):
:param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param route:
:param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param model:
@@ -559,6 +595,8 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param debug:
:param image_config:
:param modalities:
: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
@@ -583,7 +621,7 @@ class Chat(BaseSDK):
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None,
@@ -626,6 +664,13 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
image_config: Optional[
Union[
Dict[str, components.ChatGenerationParamsImageConfig],
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
]
] = None,
modalities: Optional[List[components.Modality]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -638,7 +683,7 @@ class Chat(BaseSDK):
:param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param route:
:param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param model:
@@ -662,6 +707,8 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param debug:
:param image_config:
:param modalities:
: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
@@ -685,7 +732,7 @@ class Chat(BaseSDK):
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None,
route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None,
session_id: Optional[str] = None,
model: Optional[str] = None,
@@ -728,6 +775,13 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
image_config: Optional[
Union[
Dict[str, components.ChatGenerationParamsImageConfig],
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
]
] = None,
modalities: Optional[List[components.Modality]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -740,7 +794,7 @@ class Chat(BaseSDK):
:param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
:param route:
:param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param model:
@@ -764,6 +818,8 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param debug:
:param image_config:
:param modalities:
: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
@@ -821,6 +877,8 @@ class Chat(BaseSDK):
),
top_p=top_p,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
image_config=image_config,
modalities=modalities,
)
req = self._build_request_async(
+251 -51
View File
@@ -7,6 +7,17 @@ import sys
if TYPE_CHECKING:
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict
from ._schema3 import (
Schema3,
Schema3ReasoningEncrypted,
Schema3ReasoningEncryptedTypedDict,
Schema3ReasoningSummary,
Schema3ReasoningSummaryTypedDict,
Schema3ReasoningText,
Schema3ReasoningTextTypedDict,
Schema3TypedDict,
Schema5,
)
from .activityitem import ActivityItem, ActivityItemTypedDict
from .assistantmessage import (
AssistantMessage,
@@ -27,12 +38,12 @@ if TYPE_CHECKING:
from .chatgenerationparams import (
ChatGenerationParams,
ChatGenerationParamsDataCollection,
ChatGenerationParamsEngine,
ChatGenerationParamsImageConfig,
ChatGenerationParamsImageConfigTypedDict,
ChatGenerationParamsMaxPrice,
ChatGenerationParamsMaxPriceTypedDict,
ChatGenerationParamsPdf,
ChatGenerationParamsPdfEngine,
ChatGenerationParamsPdfTypedDict,
ChatGenerationParamsPluginAutoRouter,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParser,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginModeration,
@@ -43,6 +54,14 @@ if TYPE_CHECKING:
ChatGenerationParamsPluginUnionTypedDict,
ChatGenerationParamsPluginWeb,
ChatGenerationParamsPluginWebTypedDict,
ChatGenerationParamsPreferredMaxLatency,
ChatGenerationParamsPreferredMaxLatencyTypedDict,
ChatGenerationParamsPreferredMaxLatencyUnion,
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict,
ChatGenerationParamsPreferredMinThroughput,
ChatGenerationParamsPreferredMinThroughputTypedDict,
ChatGenerationParamsPreferredMinThroughputUnion,
ChatGenerationParamsPreferredMinThroughputUnionTypedDict,
ChatGenerationParamsProvider,
ChatGenerationParamsProviderTypedDict,
ChatGenerationParamsResponseFormatJSONObject,
@@ -53,17 +72,21 @@ if TYPE_CHECKING:
ChatGenerationParamsResponseFormatTextTypedDict,
ChatGenerationParamsResponseFormatUnion,
ChatGenerationParamsResponseFormatUnionTypedDict,
ChatGenerationParamsRoute,
ChatGenerationParamsStop,
ChatGenerationParamsStopTypedDict,
ChatGenerationParamsTypedDict,
Debug,
DebugTypedDict,
Effort,
Engine,
Modality,
Pdf,
PdfEngine,
PdfTypedDict,
Quantizations,
Reasoning,
ReasoningTypedDict,
Sort,
Route,
)
from .chatgenerationtokenusage import (
ChatGenerationTokenUsage,
@@ -444,21 +467,24 @@ if TYPE_CHECKING:
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
)
from .openresponsesrequest import (
IDAutoRouter,
IDFileParser,
IDModeration,
IDResponseHealing,
IDWeb,
Ignore,
IgnoreTypedDict,
Only,
OnlyTypedDict,
OpenResponsesRequest,
OpenResponsesRequestEngine,
OpenResponsesRequestIgnore,
OpenResponsesRequestIgnoreTypedDict,
OpenResponsesRequestImageConfig,
OpenResponsesRequestImageConfigTypedDict,
OpenResponsesRequestMaxPrice,
OpenResponsesRequestMaxPriceTypedDict,
OpenResponsesRequestPdf,
OpenResponsesRequestPdfEngine,
OpenResponsesRequestPdfTypedDict,
OpenResponsesRequestOnly,
OpenResponsesRequestOnlyTypedDict,
OpenResponsesRequestOrder,
OpenResponsesRequestOrderTypedDict,
OpenResponsesRequestPluginAutoRouter,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParser,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginModeration,
@@ -471,15 +497,14 @@ if TYPE_CHECKING:
OpenResponsesRequestPluginWebTypedDict,
OpenResponsesRequestProvider,
OpenResponsesRequestProviderTypedDict,
OpenResponsesRequestRoute,
OpenResponsesRequestSort,
OpenResponsesRequestSortTypedDict,
OpenResponsesRequestToolFunction,
OpenResponsesRequestToolFunctionTypedDict,
OpenResponsesRequestToolUnion,
OpenResponsesRequestToolUnionTypedDict,
OpenResponsesRequestType,
OpenResponsesRequestTypedDict,
Order,
OrderTypedDict,
ServiceTier,
Truncation,
)
@@ -613,13 +638,57 @@ if TYPE_CHECKING:
PaymentRequiredResponseErrorData,
PaymentRequiredResponseErrorDataTypedDict,
)
from .pdfparserengine import PDFParserEngine
from .pdfparseroptions import PDFParserOptions, PDFParserOptionsTypedDict
from .percentilelatencycutoffs import (
PercentileLatencyCutoffs,
PercentileLatencyCutoffsTypedDict,
)
from .percentilestats import PercentileStats, PercentileStatsTypedDict
from .percentilethroughputcutoffs import (
PercentileThroughputCutoffs,
PercentileThroughputCutoffsTypedDict,
)
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
from .preferredmaxlatency import PreferredMaxLatency, PreferredMaxLatencyTypedDict
from .preferredminthroughput import (
PreferredMinThroughput,
PreferredMinThroughputTypedDict,
)
from .providername import ProviderName
from .provideroverloadedresponseerrordata import (
ProviderOverloadedResponseErrorData,
ProviderOverloadedResponseErrorDataTypedDict,
)
from .providerpreferences import (
ProviderPreferences,
ProviderPreferencesIgnore,
ProviderPreferencesIgnoreTypedDict,
ProviderPreferencesMaxPrice,
ProviderPreferencesMaxPriceTypedDict,
ProviderPreferencesOnly,
ProviderPreferencesOnlyTypedDict,
ProviderPreferencesOrder,
ProviderPreferencesOrderTypedDict,
ProviderPreferencesPartition,
ProviderPreferencesProviderSort,
ProviderPreferencesProviderSortConfig,
ProviderPreferencesProviderSortConfigTypedDict,
ProviderPreferencesSortUnion,
ProviderPreferencesSortUnionTypedDict,
ProviderPreferencesTypedDict,
ProviderSortConfigEnum,
ProviderSortConfigUnion,
ProviderSortConfigUnionTypedDict,
SortEnum,
)
from .providersort import ProviderSort
from .providersortconfig import (
Partition,
ProviderSortConfig,
ProviderSortConfigTypedDict,
)
from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict
from .publicendpoint import (
Pricing,
PricingTypedDict,
@@ -728,6 +797,7 @@ if TYPE_CHECKING:
)
from .responsesoutputitemreasoning import (
ResponsesOutputItemReasoning,
ResponsesOutputItemReasoningFormat,
ResponsesOutputItemReasoningStatusCompleted,
ResponsesOutputItemReasoningStatusInProgress,
ResponsesOutputItemReasoningStatusIncomplete,
@@ -749,6 +819,7 @@ if TYPE_CHECKING:
ResponsesOutputMessageType,
ResponsesOutputMessageTypedDict,
)
from .responsesoutputmodality import ResponsesOutputModality
from .responsessearchcontextsize import ResponsesSearchContextSize
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
@@ -809,6 +880,7 @@ if TYPE_CHECKING:
UserMessageContentTypedDict,
UserMessageTypedDict,
)
from .websearchengine import WebSearchEngine
from .websearchpreviewtooluserlocation import (
WebSearchPreviewToolUserLocation,
WebSearchPreviewToolUserLocationType,
@@ -835,12 +907,12 @@ __all__ = [
"ChatErrorErrorTypedDict",
"ChatGenerationParams",
"ChatGenerationParamsDataCollection",
"ChatGenerationParamsEngine",
"ChatGenerationParamsImageConfig",
"ChatGenerationParamsImageConfigTypedDict",
"ChatGenerationParamsMaxPrice",
"ChatGenerationParamsMaxPriceTypedDict",
"ChatGenerationParamsPdf",
"ChatGenerationParamsPdfEngine",
"ChatGenerationParamsPdfTypedDict",
"ChatGenerationParamsPluginAutoRouter",
"ChatGenerationParamsPluginAutoRouterTypedDict",
"ChatGenerationParamsPluginFileParser",
"ChatGenerationParamsPluginFileParserTypedDict",
"ChatGenerationParamsPluginModeration",
@@ -851,6 +923,14 @@ __all__ = [
"ChatGenerationParamsPluginUnionTypedDict",
"ChatGenerationParamsPluginWeb",
"ChatGenerationParamsPluginWebTypedDict",
"ChatGenerationParamsPreferredMaxLatency",
"ChatGenerationParamsPreferredMaxLatencyTypedDict",
"ChatGenerationParamsPreferredMaxLatencyUnion",
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
"ChatGenerationParamsPreferredMinThroughput",
"ChatGenerationParamsPreferredMinThroughputTypedDict",
"ChatGenerationParamsPreferredMinThroughputUnion",
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
"ChatGenerationParamsProvider",
"ChatGenerationParamsProviderTypedDict",
"ChatGenerationParamsResponseFormatJSONObject",
@@ -861,7 +941,6 @@ __all__ = [
"ChatGenerationParamsResponseFormatTextTypedDict",
"ChatGenerationParamsResponseFormatUnion",
"ChatGenerationParamsResponseFormatUnionTypedDict",
"ChatGenerationParamsRoute",
"ChatGenerationParamsStop",
"ChatGenerationParamsStopTypedDict",
"ChatGenerationParamsTypedDict",
@@ -954,6 +1033,7 @@ __all__ = [
"EdgeNetworkTimeoutResponseErrorDataTypedDict",
"Effort",
"EndpointStatus",
"Engine",
"FileCitation",
"FileCitationType",
"FileCitationTypedDict",
@@ -962,12 +1042,11 @@ __all__ = [
"FilePathTypedDict",
"ForbiddenResponseErrorData",
"ForbiddenResponseErrorDataTypedDict",
"IDAutoRouter",
"IDFileParser",
"IDModeration",
"IDResponseHealing",
"IDWeb",
"Ignore",
"IgnoreTypedDict",
"ImageGenerationStatus",
"ImageURL",
"ImageURLTypedDict",
@@ -987,6 +1066,7 @@ __all__ = [
"MessageDeveloper",
"MessageDeveloperTypedDict",
"MessageTypedDict",
"Modality",
"Model",
"ModelArchitecture",
"ModelArchitectureInstructType",
@@ -1006,8 +1086,6 @@ __all__ = [
"NotFoundResponseErrorData",
"NotFoundResponseErrorDataTypedDict",
"Object",
"Only",
"OnlyTypedDict",
"OpenAIResponsesAnnotation",
"OpenAIResponsesAnnotationTypedDict",
"OpenAIResponsesIncludable",
@@ -1153,12 +1231,18 @@ __all__ = [
"OpenResponsesReasoningType",
"OpenResponsesReasoningTypedDict",
"OpenResponsesRequest",
"OpenResponsesRequestEngine",
"OpenResponsesRequestIgnore",
"OpenResponsesRequestIgnoreTypedDict",
"OpenResponsesRequestImageConfig",
"OpenResponsesRequestImageConfigTypedDict",
"OpenResponsesRequestMaxPrice",
"OpenResponsesRequestMaxPriceTypedDict",
"OpenResponsesRequestPdf",
"OpenResponsesRequestPdfEngine",
"OpenResponsesRequestPdfTypedDict",
"OpenResponsesRequestOnly",
"OpenResponsesRequestOnlyTypedDict",
"OpenResponsesRequestOrder",
"OpenResponsesRequestOrderTypedDict",
"OpenResponsesRequestPluginAutoRouter",
"OpenResponsesRequestPluginAutoRouterTypedDict",
"OpenResponsesRequestPluginFileParser",
"OpenResponsesRequestPluginFileParserTypedDict",
"OpenResponsesRequestPluginModeration",
@@ -1171,7 +1255,8 @@ __all__ = [
"OpenResponsesRequestPluginWebTypedDict",
"OpenResponsesRequestProvider",
"OpenResponsesRequestProviderTypedDict",
"OpenResponsesRequestRoute",
"OpenResponsesRequestSort",
"OpenResponsesRequestSortTypedDict",
"OpenResponsesRequestToolFunction",
"OpenResponsesRequestToolFunctionTypedDict",
"OpenResponsesRequestToolUnion",
@@ -1237,8 +1322,6 @@ __all__ = [
"OpenResponsesWebSearchToolFiltersTypedDict",
"OpenResponsesWebSearchToolType",
"OpenResponsesWebSearchToolTypedDict",
"Order",
"OrderTypedDict",
"OutputItemImageGenerationCall",
"OutputItemImageGenerationCallType",
"OutputItemImageGenerationCallTypedDict",
@@ -1256,17 +1339,34 @@ __all__ = [
"OutputModality",
"OutputTokensDetails",
"OutputTokensDetailsTypedDict",
"PDFParserEngine",
"PDFParserOptions",
"PDFParserOptionsTypedDict",
"Parameter",
"Part1",
"Part1TypedDict",
"Part2",
"Part2TypedDict",
"Partition",
"PayloadTooLargeResponseErrorData",
"PayloadTooLargeResponseErrorDataTypedDict",
"PaymentRequiredResponseErrorData",
"PaymentRequiredResponseErrorDataTypedDict",
"Pdf",
"PdfEngine",
"PdfTypedDict",
"PerRequestLimits",
"PerRequestLimitsTypedDict",
"PercentileLatencyCutoffs",
"PercentileLatencyCutoffsTypedDict",
"PercentileStats",
"PercentileStatsTypedDict",
"PercentileThroughputCutoffs",
"PercentileThroughputCutoffsTypedDict",
"PreferredMaxLatency",
"PreferredMaxLatencyTypedDict",
"PreferredMinThroughput",
"PreferredMinThroughputTypedDict",
"Pricing",
"PricingTypedDict",
"Prompt",
@@ -1276,7 +1376,30 @@ __all__ = [
"ProviderName",
"ProviderOverloadedResponseErrorData",
"ProviderOverloadedResponseErrorDataTypedDict",
"ProviderPreferences",
"ProviderPreferencesIgnore",
"ProviderPreferencesIgnoreTypedDict",
"ProviderPreferencesMaxPrice",
"ProviderPreferencesMaxPriceTypedDict",
"ProviderPreferencesOnly",
"ProviderPreferencesOnlyTypedDict",
"ProviderPreferencesOrder",
"ProviderPreferencesOrderTypedDict",
"ProviderPreferencesPartition",
"ProviderPreferencesProviderSort",
"ProviderPreferencesProviderSortConfig",
"ProviderPreferencesProviderSortConfigTypedDict",
"ProviderPreferencesSortUnion",
"ProviderPreferencesSortUnionTypedDict",
"ProviderPreferencesTypedDict",
"ProviderSort",
"ProviderSortConfig",
"ProviderSortConfigEnum",
"ProviderSortConfigTypedDict",
"ProviderSortConfigUnion",
"ProviderSortConfigUnionTypedDict",
"ProviderSortUnion",
"ProviderSortUnionTypedDict",
"PublicEndpoint",
"PublicEndpointQuantization",
"PublicEndpointTypedDict",
@@ -1351,6 +1474,7 @@ __all__ = [
"ResponsesOutputItemFunctionCallType",
"ResponsesOutputItemFunctionCallTypedDict",
"ResponsesOutputItemReasoning",
"ResponsesOutputItemReasoningFormat",
"ResponsesOutputItemReasoningStatusCompleted",
"ResponsesOutputItemReasoningStatusInProgress",
"ResponsesOutputItemReasoningStatusIncomplete",
@@ -1370,6 +1494,7 @@ __all__ = [
"ResponsesOutputMessageStatusUnionTypedDict",
"ResponsesOutputMessageType",
"ResponsesOutputMessageTypedDict",
"ResponsesOutputModality",
"ResponsesSearchContextSize",
"ResponsesWebSearchCallOutput",
"ResponsesWebSearchCallOutputType",
@@ -1377,15 +1502,25 @@ __all__ = [
"ResponsesWebSearchUserLocation",
"ResponsesWebSearchUserLocationType",
"ResponsesWebSearchUserLocationTypedDict",
"Route",
"Schema0",
"Schema0Enum",
"Schema0TypedDict",
"Schema3",
"Schema3ReasoningEncrypted",
"Schema3ReasoningEncryptedTypedDict",
"Schema3ReasoningSummary",
"Schema3ReasoningSummaryTypedDict",
"Schema3ReasoningText",
"Schema3ReasoningTextTypedDict",
"Schema3TypedDict",
"Schema5",
"Security",
"SecurityTypedDict",
"ServiceTier",
"ServiceUnavailableResponseErrorData",
"ServiceUnavailableResponseErrorDataTypedDict",
"Sort",
"SortEnum",
"StreamOptions",
"StreamOptionsTypedDict",
"SystemMessage",
@@ -1446,6 +1581,7 @@ __all__ = [
"VideoURL1TypedDict",
"VideoURL2",
"VideoURL2TypedDict",
"WebSearchEngine",
"WebSearchPreviewToolUserLocation",
"WebSearchPreviewToolUserLocationType",
"WebSearchPreviewToolUserLocationTypedDict",
@@ -1456,6 +1592,15 @@ _dynamic_imports: dict[str, str] = {
"Schema0": "._schema0",
"Schema0Enum": "._schema0",
"Schema0TypedDict": "._schema0",
"Schema3": "._schema3",
"Schema3ReasoningEncrypted": "._schema3",
"Schema3ReasoningEncryptedTypedDict": "._schema3",
"Schema3ReasoningSummary": "._schema3",
"Schema3ReasoningSummaryTypedDict": "._schema3",
"Schema3ReasoningText": "._schema3",
"Schema3ReasoningTextTypedDict": "._schema3",
"Schema3TypedDict": "._schema3",
"Schema5": "._schema3",
"ActivityItem": ".activityitem",
"ActivityItemTypedDict": ".activityitem",
"AssistantMessage": ".assistantmessage",
@@ -1473,12 +1618,12 @@ _dynamic_imports: dict[str, str] = {
"CodeTypedDict": ".chaterror",
"ChatGenerationParams": ".chatgenerationparams",
"ChatGenerationParamsDataCollection": ".chatgenerationparams",
"ChatGenerationParamsEngine": ".chatgenerationparams",
"ChatGenerationParamsImageConfig": ".chatgenerationparams",
"ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams",
"ChatGenerationParamsMaxPrice": ".chatgenerationparams",
"ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPdf": ".chatgenerationparams",
"ChatGenerationParamsPdfEngine": ".chatgenerationparams",
"ChatGenerationParamsPdfTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
@@ -1489,6 +1634,14 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginWeb": ".chatgenerationparams",
"ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatency": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyUnion": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughput": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputUnion": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsProvider": ".chatgenerationparams",
"ChatGenerationParamsProviderTypedDict": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatJSONObject": ".chatgenerationparams",
@@ -1499,17 +1652,21 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsRoute": ".chatgenerationparams",
"ChatGenerationParamsStop": ".chatgenerationparams",
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
"ChatGenerationParamsTypedDict": ".chatgenerationparams",
"Debug": ".chatgenerationparams",
"DebugTypedDict": ".chatgenerationparams",
"Effort": ".chatgenerationparams",
"Engine": ".chatgenerationparams",
"Modality": ".chatgenerationparams",
"Pdf": ".chatgenerationparams",
"PdfEngine": ".chatgenerationparams",
"PdfTypedDict": ".chatgenerationparams",
"Quantizations": ".chatgenerationparams",
"Reasoning": ".chatgenerationparams",
"ReasoningTypedDict": ".chatgenerationparams",
"Sort": ".chatgenerationparams",
"Route": ".chatgenerationparams",
"ChatGenerationTokenUsage": ".chatgenerationtokenusage",
"ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage",
"CompletionTokensDetails": ".chatgenerationtokenusage",
@@ -1801,21 +1958,24 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
"IDAutoRouter": ".openresponsesrequest",
"IDFileParser": ".openresponsesrequest",
"IDModeration": ".openresponsesrequest",
"IDResponseHealing": ".openresponsesrequest",
"IDWeb": ".openresponsesrequest",
"Ignore": ".openresponsesrequest",
"IgnoreTypedDict": ".openresponsesrequest",
"Only": ".openresponsesrequest",
"OnlyTypedDict": ".openresponsesrequest",
"OpenResponsesRequest": ".openresponsesrequest",
"OpenResponsesRequestEngine": ".openresponsesrequest",
"OpenResponsesRequestIgnore": ".openresponsesrequest",
"OpenResponsesRequestIgnoreTypedDict": ".openresponsesrequest",
"OpenResponsesRequestImageConfig": ".openresponsesrequest",
"OpenResponsesRequestImageConfigTypedDict": ".openresponsesrequest",
"OpenResponsesRequestMaxPrice": ".openresponsesrequest",
"OpenResponsesRequestMaxPriceTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPdf": ".openresponsesrequest",
"OpenResponsesRequestPdfEngine": ".openresponsesrequest",
"OpenResponsesRequestPdfTypedDict": ".openresponsesrequest",
"OpenResponsesRequestOnly": ".openresponsesrequest",
"OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest",
"OpenResponsesRequestOrder": ".openresponsesrequest",
"OpenResponsesRequestOrderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParser": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginModeration": ".openresponsesrequest",
@@ -1828,15 +1988,14 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequestPluginWebTypedDict": ".openresponsesrequest",
"OpenResponsesRequestProvider": ".openresponsesrequest",
"OpenResponsesRequestProviderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestRoute": ".openresponsesrequest",
"OpenResponsesRequestSort": ".openresponsesrequest",
"OpenResponsesRequestSortTypedDict": ".openresponsesrequest",
"OpenResponsesRequestToolFunction": ".openresponsesrequest",
"OpenResponsesRequestToolFunctionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestToolUnion": ".openresponsesrequest",
"OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestType": ".openresponsesrequest",
"OpenResponsesRequestTypedDict": ".openresponsesrequest",
"Order": ".openresponsesrequest",
"OrderTypedDict": ".openresponsesrequest",
"ServiceTier": ".openresponsesrequest",
"Truncation": ".openresponsesrequest",
"OpenResponsesResponseText": ".openresponsesresponsetext",
@@ -1945,12 +2104,50 @@ _dynamic_imports: dict[str, str] = {
"PayloadTooLargeResponseErrorDataTypedDict": ".payloadtoolargeresponseerrordata",
"PaymentRequiredResponseErrorData": ".paymentrequiredresponseerrordata",
"PaymentRequiredResponseErrorDataTypedDict": ".paymentrequiredresponseerrordata",
"PDFParserEngine": ".pdfparserengine",
"PDFParserOptions": ".pdfparseroptions",
"PDFParserOptionsTypedDict": ".pdfparseroptions",
"PercentileLatencyCutoffs": ".percentilelatencycutoffs",
"PercentileLatencyCutoffsTypedDict": ".percentilelatencycutoffs",
"PercentileStats": ".percentilestats",
"PercentileStatsTypedDict": ".percentilestats",
"PercentileThroughputCutoffs": ".percentilethroughputcutoffs",
"PercentileThroughputCutoffsTypedDict": ".percentilethroughputcutoffs",
"PerRequestLimits": ".perrequestlimits",
"PerRequestLimitsTypedDict": ".perrequestlimits",
"PreferredMaxLatency": ".preferredmaxlatency",
"PreferredMaxLatencyTypedDict": ".preferredmaxlatency",
"PreferredMinThroughput": ".preferredminthroughput",
"PreferredMinThroughputTypedDict": ".preferredminthroughput",
"ProviderName": ".providername",
"ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata",
"ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata",
"ProviderPreferences": ".providerpreferences",
"ProviderPreferencesIgnore": ".providerpreferences",
"ProviderPreferencesIgnoreTypedDict": ".providerpreferences",
"ProviderPreferencesMaxPrice": ".providerpreferences",
"ProviderPreferencesMaxPriceTypedDict": ".providerpreferences",
"ProviderPreferencesOnly": ".providerpreferences",
"ProviderPreferencesOnlyTypedDict": ".providerpreferences",
"ProviderPreferencesOrder": ".providerpreferences",
"ProviderPreferencesOrderTypedDict": ".providerpreferences",
"ProviderPreferencesPartition": ".providerpreferences",
"ProviderPreferencesProviderSort": ".providerpreferences",
"ProviderPreferencesProviderSortConfig": ".providerpreferences",
"ProviderPreferencesProviderSortConfigTypedDict": ".providerpreferences",
"ProviderPreferencesSortUnion": ".providerpreferences",
"ProviderPreferencesSortUnionTypedDict": ".providerpreferences",
"ProviderPreferencesTypedDict": ".providerpreferences",
"ProviderSortConfigEnum": ".providerpreferences",
"ProviderSortConfigUnion": ".providerpreferences",
"ProviderSortConfigUnionTypedDict": ".providerpreferences",
"SortEnum": ".providerpreferences",
"ProviderSort": ".providersort",
"Partition": ".providersortconfig",
"ProviderSortConfig": ".providersortconfig",
"ProviderSortConfigTypedDict": ".providersortconfig",
"ProviderSortUnion": ".providersortunion",
"ProviderSortUnionTypedDict": ".providersortunion",
"Pricing": ".publicendpoint",
"PricingTypedDict": ".publicendpoint",
"PublicEndpoint": ".publicendpoint",
@@ -2022,6 +2219,7 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputItemFunctionCallType": ".responsesoutputitemfunctioncall",
"ResponsesOutputItemFunctionCallTypedDict": ".responsesoutputitemfunctioncall",
"ResponsesOutputItemReasoning": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningFormat": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusCompleted": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusInProgress": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusIncomplete": ".responsesoutputitemreasoning",
@@ -2040,6 +2238,7 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputMessageStatusUnionTypedDict": ".responsesoutputmessage",
"ResponsesOutputMessageType": ".responsesoutputmessage",
"ResponsesOutputMessageTypedDict": ".responsesoutputmessage",
"ResponsesOutputModality": ".responsesoutputmodality",
"ResponsesSearchContextSize": ".responsessearchcontextsize",
"ResponsesWebSearchCallOutput": ".responseswebsearchcalloutput",
"ResponsesWebSearchCallOutputType": ".responseswebsearchcalloutput",
@@ -2082,6 +2281,7 @@ _dynamic_imports: dict[str, str] = {
"UserMessageContent": ".usermessage",
"UserMessageContentTypedDict": ".usermessage",
"UserMessageTypedDict": ".usermessage",
"WebSearchEngine": ".websearchengine",
"WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationTypedDict": ".websearchpreviewtooluserlocation",
+2 -2
View File
@@ -36,7 +36,6 @@ Schema0Enum = Union[
"Fireworks",
"Friendli",
"GMICloud",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
@@ -66,13 +65,14 @@ Schema0Enum = Union[
"Phala",
"Relace",
"SambaNova",
"Seed",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
"Upstage",
"Venice",
"WandB",
"Xiaomi",
+229
View File
@@ -0,0 +1,229 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
import pydantic
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
Schema5 = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
],
UnrecognizedStr,
]
class Schema3ReasoningTextTypedDict(TypedDict):
type: Literal["reasoning.text"]
text: NotRequired[Nullable[str]]
signature: NotRequired[Nullable[str]]
id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema5]]
index: NotRequired[float]
class Schema3ReasoningText(BaseModel):
TYPE: Annotated[
Annotated[
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
],
pydantic.Field(alias="type"),
] = "reasoning.text"
text: OptionalNullable[str] = UNSET
signature: OptionalNullable[str] = UNSET
id: OptionalNullable[str] = UNSET
format_: Annotated[
Annotated[OptionalNullable[Schema5], PlainValidator(validate_open_enum(False))],
pydantic.Field(alias="format"),
] = UNSET
index: Optional[float] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["text", "signature", "id", "format", "index"]
nullable_fields = ["text", "signature", "id", "format"]
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 Schema3ReasoningEncryptedTypedDict(TypedDict):
data: str
type: Literal["reasoning.encrypted"]
id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema5]]
index: NotRequired[float]
class Schema3ReasoningEncrypted(BaseModel):
data: str
TYPE: Annotated[
Annotated[
Literal["reasoning.encrypted"],
AfterValidator(validate_const("reasoning.encrypted")),
],
pydantic.Field(alias="type"),
] = "reasoning.encrypted"
id: OptionalNullable[str] = UNSET
format_: Annotated[
Annotated[OptionalNullable[Schema5], PlainValidator(validate_open_enum(False))],
pydantic.Field(alias="format"),
] = UNSET
index: Optional[float] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "format", "index"]
nullable_fields = ["id", "format"]
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 Schema3ReasoningSummaryTypedDict(TypedDict):
summary: str
type: Literal["reasoning.summary"]
id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema5]]
index: NotRequired[float]
class Schema3ReasoningSummary(BaseModel):
summary: str
TYPE: Annotated[
Annotated[
Literal["reasoning.summary"],
AfterValidator(validate_const("reasoning.summary")),
],
pydantic.Field(alias="type"),
] = "reasoning.summary"
id: OptionalNullable[str] = UNSET
format_: Annotated[
Annotated[OptionalNullable[Schema5], PlainValidator(validate_open_enum(False))],
pydantic.Field(alias="format"),
] = UNSET
index: Optional[float] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "format", "index"]
nullable_fields = ["id", "format"]
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
Schema3TypedDict = TypeAliasType(
"Schema3TypedDict",
Union[
Schema3ReasoningSummaryTypedDict,
Schema3ReasoningEncryptedTypedDict,
Schema3ReasoningTextTypedDict,
],
)
Schema3 = Annotated[
Union[
Annotated[Schema3ReasoningSummary, Tag("reasoning.summary")],
Annotated[Schema3ReasoningEncrypted, Tag("reasoning.encrypted")],
Annotated[Schema3ReasoningText, Tag("reasoning.text")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
+211 -50
View File
@@ -4,6 +4,7 @@ from __future__ import annotations
from ._schema0 import Schema0, Schema0TypedDict
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
from .message import Message, MessageTypedDict
from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
from .responseformatjsonschema import (
ResponseFormatJSONSchema,
@@ -55,16 +56,6 @@ Quantizations = Union[
]
Sort = Union[
Literal[
"price",
"throughput",
"latency",
],
UnrecognizedStr,
]
class ChatGenerationParamsMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
@@ -89,6 +80,124 @@ class ChatGenerationParamsMaxPrice(BaseModel):
request: Optional[Any] = None
class ChatGenerationParamsPreferredMinThroughputTypedDict(TypedDict):
p50: NotRequired[Nullable[float]]
p75: NotRequired[Nullable[float]]
p90: NotRequired[Nullable[float]]
p99: NotRequired[Nullable[float]]
class ChatGenerationParamsPreferredMinThroughput(BaseModel):
p50: OptionalNullable[float] = UNSET
p75: OptionalNullable[float] = UNSET
p90: OptionalNullable[float] = UNSET
p99: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["p50", "p75", "p90", "p99"]
nullable_fields = ["p50", "p75", "p90", "p99"]
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
ChatGenerationParamsPreferredMinThroughputUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
Union[ChatGenerationParamsPreferredMinThroughputTypedDict, float],
)
ChatGenerationParamsPreferredMinThroughputUnion = TypeAliasType(
"ChatGenerationParamsPreferredMinThroughputUnion",
Union[ChatGenerationParamsPreferredMinThroughput, float],
)
class ChatGenerationParamsPreferredMaxLatencyTypedDict(TypedDict):
p50: NotRequired[Nullable[float]]
p75: NotRequired[Nullable[float]]
p90: NotRequired[Nullable[float]]
p99: NotRequired[Nullable[float]]
class ChatGenerationParamsPreferredMaxLatency(BaseModel):
p50: OptionalNullable[float] = UNSET
p75: OptionalNullable[float] = UNSET
p90: OptionalNullable[float] = UNSET
p99: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["p50", "p75", "p90", "p99"]
nullable_fields = ["p50", "p75", "p90", "p99"]
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
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
Union[ChatGenerationParamsPreferredMaxLatencyTypedDict, float],
)
ChatGenerationParamsPreferredMaxLatencyUnion = TypeAliasType(
"ChatGenerationParamsPreferredMaxLatencyUnion",
Union[ChatGenerationParamsPreferredMaxLatency, float],
)
class ChatGenerationParamsProviderTypedDict(TypedDict):
allow_fallbacks: NotRequired[Nullable[bool]]
r"""Whether to allow backup providers to serve requests
@@ -114,14 +223,18 @@ class ChatGenerationParamsProviderTypedDict(TypedDict):
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: NotRequired[Nullable[List[Quantizations]]]
r"""A list of quantization levels to filter the provider by."""
sort: NotRequired[Nullable[Sort]]
sort: NotRequired[Nullable[ProviderSortUnionTypedDict]]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: NotRequired[Nullable[float]]
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: NotRequired[Nullable[float]]
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
preferred_min_throughput: NotRequired[
Nullable[ChatGenerationParamsPreferredMinThroughputUnionTypedDict]
]
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[
Nullable[ChatGenerationParamsPreferredMaxLatencyUnionTypedDict]
]
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
class ChatGenerationParamsProvider(BaseModel):
@@ -163,19 +276,21 @@ class ChatGenerationParamsProvider(BaseModel):
] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: Annotated[
OptionalNullable[Sort], PlainValidator(validate_open_enum(False))
] = UNSET
sort: OptionalNullable[ProviderSortUnion] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: Optional[ChatGenerationParamsMaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: OptionalNullable[float] = UNSET
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
preferred_min_throughput: OptionalNullable[
ChatGenerationParamsPreferredMinThroughputUnion
] = UNSET
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
max_latency: OptionalNullable[float] = UNSET
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
preferred_max_latency: OptionalNullable[
ChatGenerationParamsPreferredMaxLatencyUnion
] = UNSET
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -191,8 +306,8 @@ class ChatGenerationParamsProvider(BaseModel):
"quantizations",
"sort",
"max_price",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
nullable_fields = [
"allow_fallbacks",
@@ -205,8 +320,8 @@ class ChatGenerationParamsProvider(BaseModel):
"ignore",
"quantizations",
"sort",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
null_default_fields = []
@@ -252,7 +367,7 @@ class ChatGenerationParamsPluginResponseHealing(BaseModel):
enabled: Optional[bool] = None
ChatGenerationParamsPdfEngine = Union[
PdfEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
@@ -262,21 +377,20 @@ ChatGenerationParamsPdfEngine = Union[
]
class ChatGenerationParamsPdfTypedDict(TypedDict):
engine: NotRequired[ChatGenerationParamsPdfEngine]
class PdfTypedDict(TypedDict):
engine: NotRequired[PdfEngine]
class ChatGenerationParamsPdf(BaseModel):
class Pdf(BaseModel):
engine: Annotated[
Optional[ChatGenerationParamsPdfEngine],
PlainValidator(validate_open_enum(False)),
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
] = None
class ChatGenerationParamsPluginFileParserTypedDict(TypedDict):
id: Literal["file-parser"]
enabled: NotRequired[bool]
pdf: NotRequired[ChatGenerationParamsPdfTypedDict]
pdf: NotRequired[PdfTypedDict]
class ChatGenerationParamsPluginFileParser(BaseModel):
@@ -289,10 +403,10 @@ class ChatGenerationParamsPluginFileParser(BaseModel):
enabled: Optional[bool] = None
pdf: Optional[ChatGenerationParamsPdf] = None
pdf: Optional[Pdf] = None
ChatGenerationParamsEngine = Union[
Engine = Union[
Literal[
"native",
"exa",
@@ -306,7 +420,7 @@ class ChatGenerationParamsPluginWebTypedDict(TypedDict):
enabled: NotRequired[bool]
max_results: NotRequired[float]
search_prompt: NotRequired[str]
engine: NotRequired[ChatGenerationParamsEngine]
engine: NotRequired[Engine]
class ChatGenerationParamsPluginWeb(BaseModel):
@@ -321,9 +435,9 @@ class ChatGenerationParamsPluginWeb(BaseModel):
search_prompt: Optional[str] = None
engine: Annotated[
Optional[ChatGenerationParamsEngine], PlainValidator(validate_open_enum(False))
] = None
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
None
)
class ChatGenerationParamsPluginModerationTypedDict(TypedDict):
@@ -337,11 +451,31 @@ class ChatGenerationParamsPluginModeration(BaseModel):
] = "moderation"
class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict):
id: Literal["auto-router"]
enabled: NotRequired[bool]
allowed_models: NotRequired[List[str]]
class ChatGenerationParamsPluginAutoRouter(BaseModel):
ID: Annotated[
Annotated[
Literal["auto-router"], AfterValidator(validate_const("auto-router"))
],
pydantic.Field(alias="id"),
] = "auto-router"
enabled: Optional[bool] = None
allowed_models: Optional[List[str]] = None
ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPluginUnionTypedDict",
Union[
ChatGenerationParamsPluginModerationTypedDict,
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginWebTypedDict,
],
@@ -350,6 +484,7 @@ ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
ChatGenerationParamsPluginUnion = Annotated[
Union[
Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")],
Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")],
Annotated[ChatGenerationParamsPluginWeb, Tag("web")],
Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")],
@@ -359,7 +494,7 @@ ChatGenerationParamsPluginUnion = Annotated[
]
ChatGenerationParamsRoute = Union[
Route = Union[
Literal[
"fallback",
"sort",
@@ -370,12 +505,12 @@ ChatGenerationParamsRoute = Union[
Effort = Union[
Literal[
"none",
"minimal",
"low",
"medium",
"high",
"xhigh",
"high",
"medium",
"low",
"minimal",
"none",
],
UnrecognizedStr,
]
@@ -504,14 +639,32 @@ class Debug(BaseModel):
echo_upstream_body: Optional[bool] = None
ChatGenerationParamsImageConfigTypedDict = TypeAliasType(
"ChatGenerationParamsImageConfigTypedDict", Union[str, float]
)
ChatGenerationParamsImageConfig = TypeAliasType(
"ChatGenerationParamsImageConfig", Union[str, float]
)
Modality = Union[
Literal[
"text",
"image",
],
UnrecognizedStr,
]
class ChatGenerationParamsTypedDict(TypedDict):
messages: List[MessageTypedDict]
provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]]
r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]]
r"""Plugins you want to enable for this request, including their settings."""
route: NotRequired[Nullable[ChatGenerationParamsRoute]]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
route: NotRequired[Nullable[Route]]
user: NotRequired[str]
session_id: NotRequired[str]
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
@@ -536,6 +689,8 @@ class ChatGenerationParamsTypedDict(TypedDict):
tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
top_p: NotRequired[Nullable[float]]
debug: NotRequired[DebugTypedDict]
image_config: NotRequired[Dict[str, ChatGenerationParamsImageConfigTypedDict]]
modalities: NotRequired[List[Modality]]
class ChatGenerationParams(BaseModel):
@@ -548,10 +703,8 @@ class ChatGenerationParams(BaseModel):
r"""Plugins you want to enable for this request, including their settings."""
route: Annotated[
OptionalNullable[ChatGenerationParamsRoute],
PlainValidator(validate_open_enum(False)),
OptionalNullable[Route], PlainValidator(validate_open_enum(False))
] = UNSET
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: Optional[str] = None
@@ -600,6 +753,12 @@ class ChatGenerationParams(BaseModel):
debug: Optional[Debug] = None
image_config: Optional[Dict[str, ChatGenerationParamsImageConfig]] = None
modalities: Optional[
List[Annotated[Modality, PlainValidator(validate_open_enum(False))]]
] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -629,6 +788,8 @@ class ChatGenerationParams(BaseModel):
"tools",
"top_p",
"debug",
"image_config",
"modalities",
]
nullable_fields = [
"provider",
@@ -72,6 +72,7 @@ class CompletionTokensDetails(BaseModel):
class PromptTokensDetailsTypedDict(TypedDict):
cached_tokens: NotRequired[float]
cache_write_tokens: NotRequired[float]
audio_tokens: NotRequired[float]
video_tokens: NotRequired[float]
@@ -79,6 +80,8 @@ class PromptTokensDetailsTypedDict(TypedDict):
class PromptTokensDetails(BaseModel):
cached_tokens: Optional[float] = None
cache_write_tokens: Optional[float] = None
audio_tokens: Optional[float] = None
video_tokens: Optional[float] = None
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from ._schema3 import Schema3, Schema3TypedDict
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chatmessagetokenlogprobs import (
@@ -17,6 +18,7 @@ from openrouter.types import (
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -24,6 +26,7 @@ class ChatResponseChoiceTypedDict(TypedDict):
finish_reason: Nullable[ChatCompletionFinishReason]
index: float
message: AssistantMessageTypedDict
reasoning_details: NotRequired[List[Schema3TypedDict]]
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
@@ -36,11 +39,13 @@ class ChatResponseChoice(BaseModel):
message: AssistantMessage
reasoning_details: Optional[List[Schema3]] = None
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["logprobs"]
optional_fields = ["reasoning_details", "logprobs"]
nullable_fields = ["finish_reason", "logprobs"]
null_default_fields = []
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from ._schema3 import Schema3, Schema3TypedDict
from .chatstreamingmessagetoolcall import (
ChatStreamingMessageToolCall,
ChatStreamingMessageToolCallTypedDict,
@@ -26,6 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict):
reasoning: NotRequired[Nullable[str]]
refusal: NotRequired[Nullable[str]]
tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]]
reasoning_details: NotRequired[List[Schema3TypedDict]]
class ChatStreamingMessageChunk(BaseModel):
@@ -39,9 +41,18 @@ class ChatStreamingMessageChunk(BaseModel):
tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None
reasoning_details: Optional[List[Schema3]] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["role", "content", "reasoning", "refusal", "tool_calls"]
optional_fields = [
"role",
"content",
"reasoning",
"refusal",
"tool_calls",
"reasoning_details",
]
nullable_fields = ["content", "reasoning", "refusal"]
null_default_fields = []
@@ -60,9 +60,9 @@ OpenResponsesInput1TypedDict = TypeAliasType(
OpenResponsesFunctionCallOutputTypedDict,
ResponsesOutputMessageTypedDict,
OpenResponsesFunctionToolCallTypedDict,
ResponsesOutputItemReasoningTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
OpenResponsesReasoningTypedDict,
ResponsesOutputItemReasoningTypedDict,
],
)
@@ -78,9 +78,9 @@ OpenResponsesInput1 = TypeAliasType(
OpenResponsesFunctionCallOutput,
ResponsesOutputMessage,
OpenResponsesFunctionToolCall,
ResponsesOutputItemReasoning,
ResponsesOutputItemFunctionCall,
OpenResponsesReasoning,
ResponsesOutputItemReasoning,
],
)
@@ -55,6 +55,7 @@ OpenResponsesReasoningFormat = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
+121 -85
View File
@@ -33,9 +33,18 @@ from .openresponseswebsearchtool import (
OpenResponsesWebSearchTool,
OpenResponsesWebSearchToolTypedDict,
)
from .pdfparseroptions import PDFParserOptions, PDFParserOptionsTypedDict
from .preferredmaxlatency import PreferredMaxLatency, PreferredMaxLatencyTypedDict
from .preferredminthroughput import (
PreferredMinThroughput,
PreferredMinThroughputTypedDict,
)
from .providername import ProviderName
from .providersort import ProviderSort
from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict
from .quantization import Quantization
from .responsesoutputmodality import ResponsesOutputModality
from .websearchengine import WebSearchEngine
from openrouter.types import (
BaseModel,
Nullable,
@@ -136,6 +145,16 @@ OpenResponsesRequestToolUnion = Annotated[
]
OpenResponsesRequestImageConfigTypedDict = TypeAliasType(
"OpenResponsesRequestImageConfigTypedDict", Union[str, float]
)
OpenResponsesRequestImageConfig = TypeAliasType(
"OpenResponsesRequestImageConfig", Union[str, float]
)
ServiceTier = Literal["auto",]
@@ -148,33 +167,57 @@ Truncation = Union[
]
OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str])
OpenResponsesRequestOrderTypedDict = TypeAliasType(
"OpenResponsesRequestOrderTypedDict", Union[ProviderName, str]
)
Order = TypeAliasType(
"Order",
OpenResponsesRequestOrder = TypeAliasType(
"OpenResponsesRequestOrder",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
OnlyTypedDict = TypeAliasType("OnlyTypedDict", Union[ProviderName, str])
OpenResponsesRequestOnlyTypedDict = TypeAliasType(
"OpenResponsesRequestOnlyTypedDict", Union[ProviderName, str]
)
Only = TypeAliasType(
"Only",
OpenResponsesRequestOnly = TypeAliasType(
"OpenResponsesRequestOnly",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
IgnoreTypedDict = TypeAliasType("IgnoreTypedDict", Union[ProviderName, str])
OpenResponsesRequestIgnoreTypedDict = TypeAliasType(
"OpenResponsesRequestIgnoreTypedDict", Union[ProviderName, str]
)
Ignore = TypeAliasType(
"Ignore",
OpenResponsesRequestIgnore = TypeAliasType(
"OpenResponsesRequestIgnore",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
OpenResponsesRequestSortTypedDict = TypeAliasType(
"OpenResponsesRequestSortTypedDict",
Union[ProviderSortConfigTypedDict, ProviderSort, Any],
)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
OpenResponsesRequestSort = TypeAliasType(
"OpenResponsesRequestSort",
Union[
ProviderSortConfig,
Annotated[ProviderSort, PlainValidator(validate_open_enum(False))],
Any,
],
)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
class OpenResponsesRequestMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
@@ -230,22 +273,22 @@ class OpenResponsesRequestProviderTypedDict(TypedDict):
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
enforce_distillable_text: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: NotRequired[Nullable[List[OrderTypedDict]]]
order: NotRequired[Nullable[List[OpenResponsesRequestOrderTypedDict]]]
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: NotRequired[Nullable[List[OnlyTypedDict]]]
only: NotRequired[Nullable[List[OpenResponsesRequestOnlyTypedDict]]]
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: NotRequired[Nullable[List[IgnoreTypedDict]]]
ignore: NotRequired[Nullable[List[OpenResponsesRequestIgnoreTypedDict]]]
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: NotRequired[Nullable[List[Quantization]]]
r"""A list of quantization levels to filter the provider by."""
sort: NotRequired[Nullable[ProviderSort]]
sort: NotRequired[Nullable[OpenResponsesRequestSortTypedDict]]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: NotRequired[OpenResponsesRequestMaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: NotRequired[Nullable[float]]
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: NotRequired[Nullable[float]]
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
preferred_min_throughput: NotRequired[Nullable[PreferredMinThroughputTypedDict]]
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[Nullable[PreferredMaxLatencyTypedDict]]
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
class OpenResponsesRequestProvider(BaseModel):
@@ -276,13 +319,13 @@ class OpenResponsesRequestProvider(BaseModel):
enforce_distillable_text: OptionalNullable[bool] = UNSET
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: OptionalNullable[List[Order]] = UNSET
order: OptionalNullable[List[OpenResponsesRequestOrder]] = UNSET
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: OptionalNullable[List[Only]] = UNSET
only: OptionalNullable[List[OpenResponsesRequestOnly]] = UNSET
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: OptionalNullable[List[Ignore]] = UNSET
ignore: OptionalNullable[List[OpenResponsesRequestIgnore]] = UNSET
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: OptionalNullable[
@@ -290,19 +333,17 @@ class OpenResponsesRequestProvider(BaseModel):
] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: Annotated[
OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False))
] = UNSET
sort: OptionalNullable[OpenResponsesRequestSort] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: Optional[OpenResponsesRequestMaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
min_throughput: OptionalNullable[float] = UNSET
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
preferred_min_throughput: OptionalNullable[PreferredMinThroughput] = UNSET
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
max_latency: OptionalNullable[float] = UNSET
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
preferred_max_latency: OptionalNullable[PreferredMaxLatency] = UNSET
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -318,8 +359,8 @@ class OpenResponsesRequestProvider(BaseModel):
"quantizations",
"sort",
"max_price",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
nullable_fields = [
"allow_fallbacks",
@@ -332,8 +373,8 @@ class OpenResponsesRequestProvider(BaseModel):
"ignore",
"quantizations",
"sort",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
null_default_fields = []
@@ -381,32 +422,12 @@ class OpenResponsesRequestPluginResponseHealing(BaseModel):
IDFileParser = Literal["file-parser",]
OpenResponsesRequestPdfEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
"native",
],
UnrecognizedStr,
]
class OpenResponsesRequestPdfTypedDict(TypedDict):
engine: NotRequired[OpenResponsesRequestPdfEngine]
class OpenResponsesRequestPdf(BaseModel):
engine: Annotated[
Optional[OpenResponsesRequestPdfEngine],
PlainValidator(validate_open_enum(False)),
] = None
class OpenResponsesRequestPluginFileParserTypedDict(TypedDict):
id: IDFileParser
enabled: NotRequired[bool]
r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
pdf: NotRequired[OpenResponsesRequestPdfTypedDict]
pdf: NotRequired[PDFParserOptionsTypedDict]
r"""Options for PDF parsing."""
class OpenResponsesRequestPluginFileParser(BaseModel):
@@ -415,28 +436,21 @@ class OpenResponsesRequestPluginFileParser(BaseModel):
enabled: Optional[bool] = None
r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
pdf: Optional[OpenResponsesRequestPdf] = None
pdf: Optional[PDFParserOptions] = None
r"""Options for PDF parsing."""
IDWeb = Literal["web",]
OpenResponsesRequestEngine = Union[
Literal[
"native",
"exa",
],
UnrecognizedStr,
]
class OpenResponsesRequestPluginWebTypedDict(TypedDict):
id: IDWeb
enabled: NotRequired[bool]
r"""Set to false to disable the web-search plugin for this request. Defaults to true."""
max_results: NotRequired[float]
search_prompt: NotRequired[str]
engine: NotRequired[OpenResponsesRequestEngine]
engine: NotRequired[WebSearchEngine]
r"""The search engine to use for web search."""
class OpenResponsesRequestPluginWeb(BaseModel):
@@ -450,8 +464,9 @@ class OpenResponsesRequestPluginWeb(BaseModel):
search_prompt: Optional[str] = None
engine: Annotated[
Optional[OpenResponsesRequestEngine], PlainValidator(validate_open_enum(False))
Optional[WebSearchEngine], PlainValidator(validate_open_enum(False))
] = None
r"""The search engine to use for web search."""
IDModeration = Literal["moderation",]
@@ -465,11 +480,33 @@ class OpenResponsesRequestPluginModeration(BaseModel):
id: IDModeration
IDAutoRouter = Literal["auto-router",]
class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict):
id: IDAutoRouter
enabled: NotRequired[bool]
r"""Set to false to disable the auto-router plugin for this request. Defaults to true."""
allowed_models: NotRequired[List[str]]
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
class OpenResponsesRequestPluginAutoRouter(BaseModel):
id: IDAutoRouter
enabled: Optional[bool] = None
r"""Set to false to disable the auto-router plugin for this request. Defaults to true."""
allowed_models: Optional[List[str]] = None
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
"OpenResponsesRequestPluginUnionTypedDict",
Union[
OpenResponsesRequestPluginModerationTypedDict,
OpenResponsesRequestPluginResponseHealingTypedDict,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginWebTypedDict,
],
@@ -478,6 +515,7 @@ OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
OpenResponsesRequestPluginUnion = Annotated[
Union[
Annotated[OpenResponsesRequestPluginAutoRouter, Tag("auto-router")],
Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")],
Annotated[OpenResponsesRequestPluginWeb, Tag("web")],
Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")],
@@ -487,16 +525,6 @@ OpenResponsesRequestPluginUnion = Annotated[
]
OpenResponsesRequestRoute = Union[
Literal[
"fallback",
"sort",
],
UnrecognizedStr,
]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
class OpenResponsesRequestTypedDict(TypedDict):
r"""Request schema for Responses endpoint"""
@@ -518,6 +546,10 @@ class OpenResponsesRequestTypedDict(TypedDict):
temperature: NotRequired[Nullable[float]]
top_p: NotRequired[Nullable[float]]
top_k: NotRequired[float]
image_config: NotRequired[Dict[str, OpenResponsesRequestImageConfigTypedDict]]
r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details."""
modalities: NotRequired[List[ResponsesOutputModality]]
r"""Output modalities for the response. Supported values are \"text\" and \"image\"."""
prompt_cache_key: NotRequired[Nullable[str]]
previous_response_id: NotRequired[Nullable[str]]
prompt: NotRequired[Nullable[OpenAIResponsesPromptTypedDict]]
@@ -532,8 +564,6 @@ class OpenResponsesRequestTypedDict(TypedDict):
r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]]
r"""Plugins you want to enable for this request, including their settings."""
route: NotRequired[Nullable[OpenResponsesRequestRoute]]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: NotRequired[str]
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
session_id: NotRequired[str]
@@ -575,6 +605,18 @@ class OpenResponsesRequest(BaseModel):
top_k: Optional[float] = None
image_config: Optional[Dict[str, OpenResponsesRequestImageConfig]] = None
r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details."""
modalities: Optional[
List[
Annotated[
ResponsesOutputModality, PlainValidator(validate_open_enum(False))
]
]
] = None
r"""Output modalities for the response. Supported values are \"text\" and \"image\"."""
prompt_cache_key: OptionalNullable[str] = UNSET
previous_response_id: OptionalNullable[str] = UNSET
@@ -612,12 +654,6 @@ class OpenResponsesRequest(BaseModel):
plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None
r"""Plugins you want to enable for this request, including their settings."""
route: Annotated[
OptionalNullable[OpenResponsesRequestRoute],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: Optional[str] = None
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
@@ -641,6 +677,8 @@ class OpenResponsesRequest(BaseModel):
"temperature",
"top_p",
"top_k",
"image_config",
"modalities",
"prompt_cache_key",
"previous_response_id",
"prompt",
@@ -653,7 +691,6 @@ class OpenResponsesRequest(BaseModel):
"stream",
"provider",
"plugins",
"route",
"user",
"session_id",
]
@@ -673,7 +710,6 @@ class OpenResponsesRequest(BaseModel):
"safety_identifier",
"truncation",
"provider",
"route",
]
null_default_fields = []
+1
View File
@@ -28,6 +28,7 @@ Parameter = Union[
"parallel_tool_calls",
"include_reasoning",
"reasoning",
"reasoning_effort",
"web_search_options",
"verbosity",
],
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
PDFParserEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
"native",
],
UnrecognizedStr,
]
r"""The engine to use for parsing PDF files."""

Some files were not shown because too many files have changed in this diff Show More