From f190e3f95011c96993731a490ca245383ec92876 Mon Sep 17 00:00:00 2001 From: Matt Apperson Date: Tue, 16 Dec 2025 16:16:22 -0500 Subject: [PATCH] feat: fix types and add reasoning_details to chat responses (#27) --- .speakeasy/gen.lock | 63 ++- .speakeasy/gen.yaml | 4 +- .speakeasy/in.openapi.yaml | 531 ++++++++++-------- .speakeasy/lint.yaml | 10 + .speakeasy/out.openapi.yaml | 499 +++++++++------- .speakeasy/workflow.lock | 14 +- docs/components/chatgenerationparams.md | 2 +- .../chatgenerationparamspluginfileparser.md | 11 +- .../chatgenerationparamspluginweb.md | 14 +- .../chatgenerationparamsprovider.md | 8 +- docs/components/chatresponsechoice.md | 1 + docs/components/chatstreamingmessagechunk.md | 3 +- docs/components/effort.md | 10 +- docs/components/engine.md | 9 + docs/components/openresponsesrequest.md | 1 - docs/components/openresponsesrequestignore.md | 17 + docs/components/openresponsesrequestonly.md | 17 + docs/components/openresponsesrequestorder.md | 17 + .../openresponsesrequestpluginfileparser.md | 11 +- .../openresponsesrequestpluginweb.md | 14 +- .../openresponsesrequestprovider.md | 14 +- docs/components/openresponsesrequestsort.md | 25 + docs/components/parameter.md | 1 + docs/components/partition.md | 9 + docs/components/pdf.md | 8 + docs/components/pdfengine.md | 10 + docs/components/pdfparserengine.md | 12 + docs/components/pdfparseroptions.md | 10 + docs/components/providerpreferences.md | 24 + docs/components/providerpreferencesignore.md | 17 + .../components/providerpreferencesmaxprice.md | 14 + docs/components/providerpreferencesonly.md | 17 + docs/components/providerpreferencesorder.md | 17 + .../providerpreferencespartition.md | 9 + .../providerpreferencesprovidersort.md | 10 + .../providerpreferencesprovidersortconfig.md | 9 + .../providerpreferencessortunion.md | 25 + docs/components/providersort.md | 2 - docs/components/providersortconfig.md | 9 + docs/components/providersortconfigenum.md | 10 + docs/components/providersortconfigunion.md | 17 + docs/components/providersortunion.md | 17 + docs/components/route.md | 9 + docs/components/schema3.md | 23 + docs/components/schema3reasoningencrypted.md | 12 + docs/components/schema3reasoningsummary.md | 12 + docs/components/schema3reasoningtext.md | 13 + docs/components/schema5.md | 12 + docs/components/sortenum.md | 10 + docs/components/websearchengine.md | 11 + docs/operations/createembeddingsrequest.md | 18 +- docs/operations/getparametersrequest.md | 10 +- docs/operations/supportedparameter.md | 1 + docs/sdks/chat/README.md | 2 +- docs/sdks/embeddings/README.md | 20 +- docs/sdks/parameters/README.md | 14 +- docs/sdks/responses/README.md | 1 - pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/chat.py | 24 +- src/openrouter/components/__init__.py | 208 +++++-- src/openrouter/components/_schema3.py | 228 ++++++++ .../components/chatgenerationparams.py | 78 ++- .../components/chatresponsechoice.py | 7 +- .../components/chatstreamingmessagechunk.py | 13 +- .../components/openresponsesrequest.py | 164 +++--- src/openrouter/components/parameter.py | 1 + src/openrouter/components/pdfparserengine.py | 16 + src/openrouter/components/pdfparseroptions.py | 25 + .../components/providerpreferences.py | 375 +++++++++++++ src/openrouter/components/providersort.py | 1 - .../components/providersortconfig.py | 71 +++ .../components/providersortunion.py | 23 + src/openrouter/components/websearchengine.py | 15 + src/openrouter/embeddings.py | 14 +- src/openrouter/operations/__init__.py | 33 -- src/openrouter/operations/createembeddings.py | 265 +-------- src/openrouter/operations/getparameters.py | 83 +-- src/openrouter/parameters.py | 4 +- src/openrouter/responses.py | 14 - uv.lock | 4 +- 81 files changed, 2249 insertions(+), 1133 deletions(-) create mode 100644 .speakeasy/lint.yaml create mode 100644 docs/components/engine.md create mode 100644 docs/components/openresponsesrequestignore.md create mode 100644 docs/components/openresponsesrequestonly.md create mode 100644 docs/components/openresponsesrequestorder.md create mode 100644 docs/components/openresponsesrequestsort.md create mode 100644 docs/components/partition.md create mode 100644 docs/components/pdf.md create mode 100644 docs/components/pdfengine.md create mode 100644 docs/components/pdfparserengine.md create mode 100644 docs/components/pdfparseroptions.md create mode 100644 docs/components/providerpreferences.md create mode 100644 docs/components/providerpreferencesignore.md create mode 100644 docs/components/providerpreferencesmaxprice.md create mode 100644 docs/components/providerpreferencesonly.md create mode 100644 docs/components/providerpreferencesorder.md create mode 100644 docs/components/providerpreferencespartition.md create mode 100644 docs/components/providerpreferencesprovidersort.md create mode 100644 docs/components/providerpreferencesprovidersortconfig.md create mode 100644 docs/components/providerpreferencessortunion.md create mode 100644 docs/components/providersortconfig.md create mode 100644 docs/components/providersortconfigenum.md create mode 100644 docs/components/providersortconfigunion.md create mode 100644 docs/components/providersortunion.md create mode 100644 docs/components/route.md create mode 100644 docs/components/schema3.md create mode 100644 docs/components/schema3reasoningencrypted.md create mode 100644 docs/components/schema3reasoningsummary.md create mode 100644 docs/components/schema3reasoningtext.md create mode 100644 docs/components/schema5.md create mode 100644 docs/components/sortenum.md create mode 100644 docs/components/websearchengine.md create mode 100644 src/openrouter/components/_schema3.py create mode 100644 src/openrouter/components/pdfparserengine.py create mode 100644 src/openrouter/components/pdfparseroptions.py create mode 100644 src/openrouter/components/providerpreferences.py create mode 100644 src/openrouter/components/providersortconfig.py create mode 100644 src/openrouter/components/providersortunion.py create mode 100644 src/openrouter/components/websearchengine.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index bada82f..efd609d 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d management: - docChecksum: e929ecf569d79ab96a315332a4855566 + docChecksum: a5b3a567dd4de3ab77a9f0b23d4a9f10 docVersion: 1.0.0 speakeasyVersion: 1.666.0 generationVersion: 2.768.0 - releaseVersion: 0.0.22 - configChecksum: 0afda3910a58a8d797ac6674fa858711 + 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,10 +60,7 @@ generatedFiles: - docs/components/chaterrorerror.md - docs/components/chatgenerationparams.md - docs/components/chatgenerationparamsdatacollection.md - - docs/components/chatgenerationparamsengine.md - docs/components/chatgenerationparamsmaxprice.md - - docs/components/chatgenerationparamspdf.md - - docs/components/chatgenerationparamspdfengine.md - docs/components/chatgenerationparamspluginfileparser.md - docs/components/chatgenerationparamspluginmoderation.md - docs/components/chatgenerationparamspluginresponsehealing.md @@ -73,7 +71,6 @@ generatedFiles: - 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,6 +120,7 @@ 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 @@ -132,7 +130,6 @@ generatedFiles: - 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 @@ -155,7 +152,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 +250,17 @@ generatedFiles: - docs/components/openresponsesreasoningsummarytextdoneeventtype.md - docs/components/openresponsesreasoningtype.md - docs/components/openresponsesrequest.md - - docs/components/openresponsesrequestengine.md + - docs/components/openresponsesrequestignore.md - docs/components/openresponsesrequestmaxprice.md - - docs/components/openresponsesrequestpdf.md - - docs/components/openresponsesrequestpdfengine.md + - docs/components/openresponsesrequestonly.md + - docs/components/openresponsesrequestorder.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 +296,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 +311,33 @@ 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/perrequestlimits.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 @@ -393,12 +406,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 +459,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 +493,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 +521,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 +538,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 +584,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 +682,15 @@ 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/perrequestlimits.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 @@ -712,6 +732,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 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 93a6aea..b708944 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -31,7 +31,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.0.22 + version: 0.0.17 additionalDependencies: dev: {} main: {} @@ -39,6 +39,8 @@ python: - id - object - input + - models + - hash asyncMode: both authors: - OpenRouter diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index a5f339a..4047ff2 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -3529,19 +3529,47 @@ components: example: fp16 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 + ProviderSortConfig: + type: object + properties: + by: + anyOf: + - $ref: '#/components/schemas/ProviderSort' + - type: 'null' + partition: + anyOf: + - type: string + enum: + - model + - none + - type: 'null' BigNumberUnion: type: string description: A value in string format that is a large number example: 1000 + WebSearchEngine: + type: string + enum: + - native + - exa + description: The search engine to use for web search. + PDFParserEngine: + type: string + enum: + - mistral-ocr + - pdf-text + - native + description: The engine to use for parsing PDF files. + PDFParserOptions: + type: object + properties: + engine: + $ref: '#/components/schemas/PDFParserEngine' + description: Options for PDF parsing. OpenResponsesRequest: type: object properties: @@ -3721,7 +3749,14 @@ 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: @@ -3738,20 +3773,38 @@ components: 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: + type: number + nullable: true + description: >- + Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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 + preferred_max_latency: + type: number + nullable: true + description: >- + Preferred maximum latency (in seconds). Endpoints above this threshold 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 min_throughput: type: number nullable: true - example: 100 + deprecated: true 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. + **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for + preferred_min_throughput. + example: 100 + x-speakeasy-deprecation-message: Use preferred_min_throughput instead. max_latency: type: number nullable: true + deprecated: true + description: '**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.' 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. + x-speakeasy-deprecation-message: Use preferred_max_latency instead. additionalProperties: false description: When multiple model providers are available, optionally indicate your routing preference. plugins: @@ -3780,10 +3833,7 @@ components: search_prompt: type: string engine: - type: string - enum: - - native - - exa + $ref: '#/components/schemas/WebSearchEngine' required: - id - type: object @@ -3795,17 +3845,8 @@ components: enabled: type: boolean description: Set to false to disable the file-parser plugin for this request. Defaults to true. - max_files: - type: number pdf: - type: object - properties: - engine: - type: string - enum: - - mistral-ocr - - pdf-text - - native + $ref: '#/components/schemas/PDFParserOptions' required: - id - type: object @@ -3826,9 +3867,13 @@ 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 user: type: string maxLength: 128 @@ -3988,6 +4033,137 @@ 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: + type: number + nullable: true + description: >- + Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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 + preferred_max_latency: + type: number + nullable: true + description: >- + Preferred maximum latency (in seconds). Endpoints above this threshold 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 + min_throughput: + type: number + nullable: true + deprecated: true + description: >- + **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for + preferred_min_throughput. + example: 100 + x-speakeasy-deprecation-message: Use preferred_min_throughput instead. + max_latency: + type: number + nullable: true + deprecated: true + description: '**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.' + example: 5 + x-speakeasy-deprecation-message: Use preferred_max_latency instead. + description: Provider routing preferences for the request. PublicPricing: type: object properties: @@ -4195,6 +4371,7 @@ components: - parallel_tool_calls - include_reasoning - reasoning + - reasoning_effort - web_search_options - verbosity example: temperature @@ -4708,6 +4885,78 @@ 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 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + - type: 'null' + __schema6: + type: number ModelName: type: string ChatMessageContentItemText: @@ -5253,11 +5502,7 @@ components: 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 + - $ref: '#/components/schemas/ProviderSortUnion' - type: 'null' max_price: description: >- @@ -5275,17 +5520,19 @@ components: $ref: '#/components/schemas/__schema1' request: $ref: '#/components/schemas/__schema1' + preferred_min_throughput: + anyOf: + - type: number + - type: 'null' + preferred_max_latency: + anyOf: + - type: number + - type: 'null' 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. anyOf: - type: number - type: 'null' 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. anyOf: - type: number - type: 'null' @@ -5328,8 +5575,6 @@ components: const: file-parser enabled: type: boolean - max_files: - type: number pdf: type: object properties: @@ -5352,9 +5597,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: @@ -5434,12 +5676,12 @@ components: anyOf: - type: string enum: - - none - - minimal - - low - - medium - - high - xhigh + - high + - medium + - low + - minimal + - none - type: 'null' summary: anyOf: @@ -5520,6 +5762,10 @@ components: type: boolean required: - messages + ProviderSortUnion: + anyOf: + - $ref: '#/components/schemas/ProviderSort' + - $ref: '#/components/schemas/ProviderSortConfig' ChatResponseChoice: type: object properties: @@ -5529,6 +5775,10 @@ components: type: number message: $ref: '#/components/schemas/AssistantMessage' + reasoning_details: + type: array + items: + $ref: '#/components/schemas/__schema3' logprobs: anyOf: - $ref: '#/components/schemas/ChatMessageTokenLogprobs' @@ -5579,6 +5829,10 @@ components: type: array items: $ref: '#/components/schemas/ChatStreamingMessageToolCall' + reasoning_details: + type: array + items: + $ref: '#/components/schemas/__schema3' ChatStreamingChoice: type: object properties: @@ -6403,111 +6657,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: @@ -7109,77 +7259,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 + $ref: '#/components/schemas/ProviderName' required: false name: provider in: query @@ -7224,6 +7304,7 @@ paths: - parallel_tool_calls - include_reasoning - reasoning + - reasoning_effort - web_search_options - verbosity description: List of parameters supported by this model diff --git a/.speakeasy/lint.yaml b/.speakeasy/lint.yaml new file mode 100644 index 0000000..0b49ccc --- /dev/null +++ b/.speakeasy/lint.yaml @@ -0,0 +1,10 @@ +lintVersion: 1.0.0 +defaultRuleset: openrouter +rulesets: + openrouter: + rulesets: + - speakeasy-recommended + - speakeasy-generation + rules: + oas3-missing-example: + severity: "off" diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 5506188..31a1ea0 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -3548,19 +3548,51 @@ 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 + 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: @@ -3733,7 +3765,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,18 +3787,33 @@ 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. + preferred_min_throughput: + type: number + nullable: true + description: >- + Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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 + preferred_max_latency: + type: number + nullable: true + description: >- + Preferred maximum latency (in seconds). Endpoints above this threshold 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 min_throughput: type: number nullable: true - example: 100 + deprecated: true 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. + **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. + example: 100 + x-speakeasy-deprecation-message: Use preferred_min_throughput instead. max_latency: type: number nullable: true + deprecated: true + description: '**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.' 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. + x-speakeasy-deprecation-message: Use preferred_max_latency instead. additionalProperties: false description: When multiple model providers are available, optionally indicate your routing preference. plugins: @@ -3789,11 +3842,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 @@ -3805,18 +3854,8 @@ components: enabled: type: boolean description: Set to false to disable the file-parser plugin for this request. Defaults to true. - max_files: - type: number 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 @@ -3837,8 +3876,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 @@ -3996,6 +4039,123 @@ 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: + type: number + nullable: true + description: >- + Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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 + preferred_max_latency: + type: number + nullable: true + description: >- + Preferred maximum latency (in seconds). Endpoints above this threshold 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 + min_throughput: + type: number + nullable: true + deprecated: true + description: >- + **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. + example: 100 + x-speakeasy-deprecation-message: Use preferred_min_throughput instead. + max_latency: + type: number + nullable: true + deprecated: true + description: '**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.' + example: 5 + x-speakeasy-deprecation-message: Use preferred_max_latency instead. + description: Provider routing preferences for the request. PublicPricing: type: object properties: @@ -4207,6 +4367,7 @@ components: - parallel_tool_calls - include_reasoning - reasoning + - reasoning_effort - web_search_options - verbosity example: temperature @@ -4724,6 +4885,79 @@ 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 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + x-speakeasy-unknown-values: allow + - type: 'null' + __schema6: + type: number ModelName: type: string ChatMessageContentItemText: @@ -5266,12 +5500,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: >- @@ -5288,15 +5517,19 @@ components: $ref: '#/components/schemas/__schema1' request: $ref: '#/components/schemas/__schema1' + preferred_min_throughput: + anyOf: + - type: number + - type: 'null' + preferred_max_latency: + anyOf: + - type: number + - type: 'null' 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. anyOf: - type: number - type: 'null' 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. anyOf: - type: number - type: 'null' @@ -5340,8 +5573,6 @@ components: const: file-parser enabled: type: boolean - max_files: - type: number pdf: type: object properties: @@ -5365,8 +5596,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: @@ -5445,12 +5674,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: @@ -5532,6 +5761,10 @@ components: type: boolean required: - messages + ProviderSortUnion: + anyOf: + - $ref: '#/components/schemas/ProviderSort' + - $ref: '#/components/schemas/ProviderSortConfig' ChatResponseChoice: type: object properties: @@ -5541,6 +5774,10 @@ components: type: number message: $ref: '#/components/schemas/AssistantMessage' + reasoning_details: + type: array + items: + $ref: '#/components/schemas/__schema3' logprobs: anyOf: - $ref: '#/components/schemas/ChatMessageTokenLogprobs' @@ -5591,6 +5828,10 @@ components: type: array items: $ref: '#/components/schemas/ChatStreamingMessageToolCall' + reasoning_details: + type: array + items: + $ref: '#/components/schemas/__schema3' ChatStreamingChoice: type: object properties: @@ -6417,99 +6658,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: @@ -7099,78 +7248,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 @@ -7215,6 +7293,7 @@ paths: - parallel_tool_calls - include_reasoning - reasoning + - reasoning_effort - web_search_options - verbosity x-speakeasy-unknown-values: allow diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 04703aa..83aebe0 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,14 +2,14 @@ speakeasyVersion: 1.666.0 sources: -OAS: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695 - sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553 + sourceRevisionDigest: sha256:01256c8494de6bfc13c36d82ae316a6a13d402194f844618bcd4d59e34f325f3 + sourceBlobDigest: sha256:4c80e48fd5e1cd030e68d664eb93984b4d5946867252ff1755a2bd2a05eccd4e tags: - latest OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b - sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab + sourceRevisionDigest: sha256:92f6f1568ba089ae8e52bd55d859a97e446ae232c4c9ca9302ea64705313c7a0 + sourceBlobDigest: sha256:6bbf6ab7123261f7e0604f1c640e32b5fc8fb6bb503b1bc8b12d0d78ed19fefc tags: - latest - 1.0.0 @@ -17,10 +17,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b - sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab + sourceRevisionDigest: sha256:92f6f1568ba089ae8e52bd55d859a97e446ae232c4c9ca9302ea64705313c7a0 + sourceBlobDigest: sha256:6bbf6ab7123261f7e0604f1c640e32b5fc8fb6bb503b1bc8b12d0d78ed19fefc codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:92747cd4c744e6671784b73c124d89adc662799d11caf5e6573880f6bfb52405 + codeSamplesRevisionDigest: sha256:8340c172a77ca9ffeeea6ca5dce0d69a084a3ba0a4e2e41d098759f546d80da4 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.666.0 diff --git a/docs/components/chatgenerationparams.md b/docs/components/chatgenerationparams.md index 15d98c3..7bf5109 100644 --- a/docs/components/chatgenerationparams.md +++ b/docs/components/chatgenerationparams.md @@ -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 | diff --git a/docs/components/chatgenerationparamspluginfileparser.md b/docs/components/chatgenerationparamspluginfileparser.md index 7937ab1..9d53438 100644 --- a/docs/components/chatgenerationparamspluginfileparser.md +++ b/docs/components/chatgenerationparamspluginfileparser.md @@ -3,9 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `id` | *Literal["file-parser"]* | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `pdf` | [Optional[components.ChatGenerationParamsPdf]](../components/chatgenerationparamspdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| 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 | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspluginweb.md b/docs/components/chatgenerationparamspluginweb.md index 890c505..e495619 100644 --- a/docs/components/chatgenerationparamspluginweb.md +++ b/docs/components/chatgenerationparamspluginweb.md @@ -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 | \ No newline at end of file +| 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 | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsprovider.md b/docs/components/chatgenerationparamsprovider.md index 7dc2bc8..7c4a48f 100644 --- a/docs/components/chatgenerationparamsprovider.md +++ b/docs/components/chatgenerationparamsprovider.md @@ -14,7 +14,9 @@ | `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. | +| `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. | -| `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. | \ No newline at end of file +| `preferred_min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `preferred_max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_latency` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatresponsechoice.md b/docs/components/chatresponsechoice.md index 54b4a32..82a46e5 100644 --- a/docs/components/chatresponsechoice.md +++ b/docs/components/chatresponsechoice.md @@ -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 | \ No newline at end of file diff --git a/docs/components/chatstreamingmessagechunk.md b/docs/components/chatstreamingmessagechunk.md index ceada75..9d622a2 100644 --- a/docs/components/chatstreamingmessagechunk.md +++ b/docs/components/chatstreamingmessagechunk.md @@ -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 | \ No newline at end of file +| `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 | \ No newline at end of file diff --git a/docs/components/effort.md b/docs/components/effort.md index 9d2261a..acf9c82 100644 --- a/docs/components/effort.md +++ b/docs/components/effort.md @@ -5,9 +5,9 @@ | Name | Value | | --------- | --------- | -| `NONE` | none | -| `MINIMAL` | minimal | -| `LOW` | low | -| `MEDIUM` | medium | +| `XHIGH` | xhigh | | `HIGH` | high | -| `XHIGH` | xhigh | \ No newline at end of file +| `MEDIUM` | medium | +| `LOW` | low | +| `MINIMAL` | minimal | +| `NONE` | none | \ No newline at end of file diff --git a/docs/components/engine.md b/docs/components/engine.md new file mode 100644 index 0000000..fcea19c --- /dev/null +++ b/docs/components/engine.md @@ -0,0 +1,9 @@ +# Engine + + +## Values + +| Name | Value | +| -------- | -------- | +| `NATIVE` | native | +| `EXA` | exa | \ No newline at end of file diff --git a/docs/components/openresponsesrequest.md b/docs/components/openresponsesrequest.md index 3803f4e..247144a 100644 --- a/docs/components/openresponsesrequest.md +++ b/docs/components/openresponsesrequest.md @@ -33,6 +33,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. | | \ No newline at end of file diff --git a/docs/components/openresponsesrequestignore.md b/docs/components/openresponsesrequestignore.md new file mode 100644 index 0000000..4528330 --- /dev/null +++ b/docs/components/openresponsesrequestignore.md @@ -0,0 +1,17 @@ +# OpenResponsesRequestIgnore + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/openresponsesrequestonly.md b/docs/components/openresponsesrequestonly.md new file mode 100644 index 0000000..d1ee630 --- /dev/null +++ b/docs/components/openresponsesrequestonly.md @@ -0,0 +1,17 @@ +# OpenResponsesRequestOnly + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/openresponsesrequestorder.md b/docs/components/openresponsesrequestorder.md new file mode 100644 index 0000000..50da1f9 --- /dev/null +++ b/docs/components/openresponsesrequestorder.md @@ -0,0 +1,17 @@ +# OpenResponsesRequestOrder + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/openresponsesrequestpluginfileparser.md b/docs/components/openresponsesrequestpluginfileparser.md index 9ad57a6..34d0801 100644 --- a/docs/components/openresponsesrequestpluginfileparser.md +++ b/docs/components/openresponsesrequestpluginfileparser.md @@ -3,9 +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. | -| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `pdf` | [Optional[components.OpenResponsesRequestPdf]](../components/openresponsesrequestpdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| 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. | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginweb.md b/docs/components/openresponsesrequestpluginweb.md index 5d8fa30..2223caf 100644 --- a/docs/components/openresponsesrequestpluginweb.md +++ b/docs/components/openresponsesrequestpluginweb.md @@ -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 | \ No newline at end of file +| 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. | \ No newline at end of file diff --git a/docs/components/openresponsesrequestprovider.md b/docs/components/openresponsesrequestprovider.md index d5910b1..fd4d909 100644 --- a/docs/components/openresponsesrequestprovider.md +++ b/docs/components/openresponsesrequestprovider.md @@ -12,11 +12,13 @@ When multiple model providers are available, optionally indicate your routing pr | `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.
- allow: (default) allow providers which store user data non-transiently and may train on it

- 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. | | +| `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.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 | +| `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. | | -| `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 | \ No newline at end of file +| `preferred_min_throughput` | *OptionalNullable[float]* | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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[float]* | :heavy_minus_sign: | Preferred maximum latency (in seconds). Endpoints above this threshold 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 | +| ~~`min_throughput`~~ | *OptionalNullable[float]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: Use preferred_min_throughput instead..

**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. | 100 | +| ~~`max_latency`~~ | *OptionalNullable[float]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: Use preferred_max_latency instead..

**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency. | 5 | \ No newline at end of file diff --git a/docs/components/openresponsesrequestsort.md b/docs/components/openresponsesrequestsort.md new file mode 100644 index 0000000..3fd9dc7 --- /dev/null +++ b/docs/components/openresponsesrequestsort.md @@ -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 */ +``` + diff --git a/docs/components/parameter.md b/docs/components/parameter.md index 3640dfa..b638d09 100644 --- a/docs/components/parameter.md +++ b/docs/components/parameter.md @@ -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 | \ No newline at end of file diff --git a/docs/components/partition.md b/docs/components/partition.md new file mode 100644 index 0000000..975706f --- /dev/null +++ b/docs/components/partition.md @@ -0,0 +1,9 @@ +# Partition + + +## Values + +| Name | Value | +| ------- | ------- | +| `MODEL` | model | +| `NONE` | none | \ No newline at end of file diff --git a/docs/components/pdf.md b/docs/components/pdf.md new file mode 100644 index 0000000..b039762 --- /dev/null +++ b/docs/components/pdf.md @@ -0,0 +1,8 @@ +# Pdf + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `engine` | [Optional[components.PdfEngine]](../components/pdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/pdfengine.md b/docs/components/pdfengine.md new file mode 100644 index 0000000..55bca5e --- /dev/null +++ b/docs/components/pdfengine.md @@ -0,0 +1,10 @@ +# PdfEngine + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `MISTRAL_OCR` | mistral-ocr | +| `PDF_TEXT` | pdf-text | +| `NATIVE` | native | \ No newline at end of file diff --git a/docs/components/pdfparserengine.md b/docs/components/pdfparserengine.md new file mode 100644 index 0000000..8d3c25c --- /dev/null +++ b/docs/components/pdfparserengine.md @@ -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 | \ No newline at end of file diff --git a/docs/components/pdfparseroptions.md b/docs/components/pdfparseroptions.md new file mode 100644 index 0000000..3718a3d --- /dev/null +++ b/docs/components/pdfparseroptions.md @@ -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. | \ No newline at end of file diff --git a/docs/components/providerpreferences.md b/docs/components/providerpreferences.md new file mode 100644 index 0000000..e823310 --- /dev/null +++ b/docs/components/providerpreferences.md @@ -0,0 +1,24 @@ +# 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
- 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` | *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.
- allow: (default) allow providers which store user data non-transiently and may train on it

- 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[float]* | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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[float]* | :heavy_minus_sign: | Preferred maximum latency (in seconds). Endpoints above this threshold 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 | +| ~~`min_throughput`~~ | *OptionalNullable[float]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: Use preferred_min_throughput instead..

**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. | 100 | +| ~~`max_latency`~~ | *OptionalNullable[float]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: Use preferred_max_latency instead..

**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency. | 5 | \ No newline at end of file diff --git a/docs/components/providerpreferencesignore.md b/docs/components/providerpreferencesignore.md new file mode 100644 index 0000000..2d18b70 --- /dev/null +++ b/docs/components/providerpreferencesignore.md @@ -0,0 +1,17 @@ +# ProviderPreferencesIgnore + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/providerpreferencesmaxprice.md b/docs/components/providerpreferencesmaxprice.md new file mode 100644 index 0000000..99f99dc --- /dev/null +++ b/docs/components/providerpreferencesmaxprice.md @@ -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 | \ No newline at end of file diff --git a/docs/components/providerpreferencesonly.md b/docs/components/providerpreferencesonly.md new file mode 100644 index 0000000..be68765 --- /dev/null +++ b/docs/components/providerpreferencesonly.md @@ -0,0 +1,17 @@ +# ProviderPreferencesOnly + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/providerpreferencesorder.md b/docs/components/providerpreferencesorder.md new file mode 100644 index 0000000..ccc7218 --- /dev/null +++ b/docs/components/providerpreferencesorder.md @@ -0,0 +1,17 @@ +# ProviderPreferencesOrder + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/providerpreferencespartition.md b/docs/components/providerpreferencespartition.md new file mode 100644 index 0000000..dab9b83 --- /dev/null +++ b/docs/components/providerpreferencespartition.md @@ -0,0 +1,9 @@ +# ProviderPreferencesPartition + + +## Values + +| Name | Value | +| ------- | ------- | +| `MODEL` | model | +| `NONE` | none | \ No newline at end of file diff --git a/docs/components/providerpreferencesprovidersort.md b/docs/components/providerpreferencesprovidersort.md new file mode 100644 index 0000000..9d8bac3 --- /dev/null +++ b/docs/components/providerpreferencesprovidersort.md @@ -0,0 +1,10 @@ +# ProviderPreferencesProviderSort + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/providerpreferencesprovidersortconfig.md b/docs/components/providerpreferencesprovidersortconfig.md new file mode 100644 index 0000000..1b9ed9c --- /dev/null +++ b/docs/components/providerpreferencesprovidersortconfig.md @@ -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 | | \ No newline at end of file diff --git a/docs/components/providerpreferencessortunion.md b/docs/components/providerpreferencessortunion.md new file mode 100644 index 0000000..e25b117 --- /dev/null +++ b/docs/components/providerpreferencessortunion.md @@ -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 */ +``` + diff --git a/docs/components/providersort.md b/docs/components/providersort.md index 771741f..f6d1c72 100644 --- a/docs/components/providersort.md +++ b/docs/components/providersort.md @@ -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 diff --git a/docs/components/providersortconfig.md b/docs/components/providersortconfig.md new file mode 100644 index 0000000..a010a19 --- /dev/null +++ b/docs/components/providersortconfig.md @@ -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 | | \ No newline at end of file diff --git a/docs/components/providersortconfigenum.md b/docs/components/providersortconfigenum.md new file mode 100644 index 0000000..4aca83d --- /dev/null +++ b/docs/components/providersortconfigenum.md @@ -0,0 +1,10 @@ +# ProviderSortConfigEnum + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/providersortconfigunion.md b/docs/components/providersortconfigunion.md new file mode 100644 index 0000000..6a9b42b --- /dev/null +++ b/docs/components/providersortconfigunion.md @@ -0,0 +1,17 @@ +# ProviderSortConfigUnion + + +## Supported Types + +### `components.ProviderPreferencesProviderSortConfig` + +```python +value: components.ProviderPreferencesProviderSortConfig = /* values here */ +``` + +### `components.ProviderSortConfigEnum` + +```python +value: components.ProviderSortConfigEnum = /* values here */ +``` + diff --git a/docs/components/providersortunion.md b/docs/components/providersortunion.md new file mode 100644 index 0000000..9cd4d04 --- /dev/null +++ b/docs/components/providersortunion.md @@ -0,0 +1,17 @@ +# ProviderSortUnion + + +## Supported Types + +### `components.ProviderSort` + +```python +value: components.ProviderSort = /* values here */ +``` + +### `components.ProviderSortConfig` + +```python +value: components.ProviderSortConfig = /* values here */ +``` + diff --git a/docs/components/route.md b/docs/components/route.md new file mode 100644 index 0000000..6ddb804 --- /dev/null +++ b/docs/components/route.md @@ -0,0 +1,9 @@ +# Route + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `FALLBACK` | fallback | +| `SORT` | sort | \ No newline at end of file diff --git a/docs/components/schema3.md b/docs/components/schema3.md new file mode 100644 index 0000000..afe2a72 --- /dev/null +++ b/docs/components/schema3.md @@ -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 */ +``` + diff --git a/docs/components/schema3reasoningencrypted.md b/docs/components/schema3reasoningencrypted.md new file mode 100644 index 0000000..1441d0d --- /dev/null +++ b/docs/components/schema3reasoningencrypted.md @@ -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 | \ No newline at end of file diff --git a/docs/components/schema3reasoningsummary.md b/docs/components/schema3reasoningsummary.md new file mode 100644 index 0000000..d5e348d --- /dev/null +++ b/docs/components/schema3reasoningsummary.md @@ -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 | \ No newline at end of file diff --git a/docs/components/schema3reasoningtext.md b/docs/components/schema3reasoningtext.md new file mode 100644 index 0000000..d64ae86 --- /dev/null +++ b/docs/components/schema3reasoningtext.md @@ -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 | \ No newline at end of file diff --git a/docs/components/schema5.md b/docs/components/schema5.md new file mode 100644 index 0000000..471b50f --- /dev/null +++ b/docs/components/schema5.md @@ -0,0 +1,12 @@ +# Schema5 + + +## 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 | \ No newline at end of file diff --git a/docs/components/sortenum.md b/docs/components/sortenum.md new file mode 100644 index 0000000..728cf4b --- /dev/null +++ b/docs/components/sortenum.md @@ -0,0 +1,10 @@ +# SortEnum + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/websearchengine.md b/docs/components/websearchengine.md new file mode 100644 index 0000000..0b843a8 --- /dev/null +++ b/docs/components/websearchengine.md @@ -0,0 +1,11 @@ +# WebSearchEngine + +The search engine to use for web search. + + +## Values + +| Name | Value | +| -------- | -------- | +| `NATIVE` | native | +| `EXA` | exa | \ No newline at end of file diff --git a/docs/operations/createembeddingsrequest.md b/docs/operations/createembeddingsrequest.md index 2226077..a799bcb 100644 --- a/docs/operations/createembeddingsrequest.md +++ b/docs/operations/createembeddingsrequest.md @@ -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 | \ No newline at end of file +| 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 | \ No newline at end of file diff --git a/docs/operations/getparametersrequest.md b/docs/operations/getparametersrequest.md index e7fd937..6c24661 100644 --- a/docs/operations/getparametersrequest.md +++ b/docs/operations/getparametersrequest.md @@ -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 | \ No newline at end of file +| 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 | \ No newline at end of file diff --git a/docs/operations/supportedparameter.md b/docs/operations/supportedparameter.md index 4d18fd1..219529f 100644 --- a/docs/operations/supportedparameter.md +++ b/docs/operations/supportedparameter.md @@ -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 | \ No newline at end of file diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index ab61108..9a66640 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -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 | diff --git a/docs/sdks/embeddings/README.md b/docs/sdks/embeddings/README.md index 4f4244b..9defe9a 100644 --- a/docs/sdks/embeddings/README.md +++ b/docs/sdks/embeddings/README.md @@ -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 diff --git a/docs/sdks/parameters/README.md b/docs/sdks/parameters/README.md index 8ad31a4..41db61a 100644 --- a/docs/sdks/parameters/README.md +++ b/docs/sdks/parameters/README.md @@ -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 diff --git a/docs/sdks/responses/README.md b/docs/sdks/responses/README.md index 3fecb96..3db5046 100644 --- a/docs/sdks/responses/README.md +++ b/docs/sdks/responses/README.md @@ -63,7 +63,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. | | diff --git a/pyproject.toml b/pyproject.toml index 9ec2c59..21d2698 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.0.22" +version = "0.0.17" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 927c895..3aacaa3 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.0.22" +__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.22 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: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index f66c259..7f034a2 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -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, @@ -88,7 +88,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: @@ -136,7 +136,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, @@ -191,7 +191,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: @@ -238,7 +238,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, @@ -293,7 +293,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: @@ -480,7 +480,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, @@ -535,7 +535,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: @@ -583,7 +583,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, @@ -638,7 +638,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: @@ -685,7 +685,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, @@ -740,7 +740,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: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index ed2cd19..1106fa8 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -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,8 @@ if TYPE_CHECKING: from .chatgenerationparams import ( ChatGenerationParams, ChatGenerationParamsDataCollection, - ChatGenerationParamsEngine, ChatGenerationParamsMaxPrice, ChatGenerationParamsMaxPriceTypedDict, - ChatGenerationParamsPdf, - ChatGenerationParamsPdfEngine, - ChatGenerationParamsPdfTypedDict, ChatGenerationParamsPluginFileParser, ChatGenerationParamsPluginFileParserTypedDict, ChatGenerationParamsPluginModeration, @@ -53,17 +60,20 @@ if TYPE_CHECKING: ChatGenerationParamsResponseFormatTextTypedDict, ChatGenerationParamsResponseFormatUnion, ChatGenerationParamsResponseFormatUnionTypedDict, - ChatGenerationParamsRoute, ChatGenerationParamsStop, ChatGenerationParamsStopTypedDict, ChatGenerationParamsTypedDict, Debug, DebugTypedDict, Effort, + Engine, + Pdf, + PdfEngine, + PdfTypedDict, Quantizations, Reasoning, ReasoningTypedDict, - Sort, + Route, ) from .chatgenerationtokenusage import ( ChatGenerationTokenUsage, @@ -448,17 +458,15 @@ if TYPE_CHECKING: IDModeration, IDResponseHealing, IDWeb, - Ignore, - IgnoreTypedDict, - Only, - OnlyTypedDict, OpenResponsesRequest, - OpenResponsesRequestEngine, + OpenResponsesRequestIgnore, + OpenResponsesRequestIgnoreTypedDict, OpenResponsesRequestMaxPrice, OpenResponsesRequestMaxPriceTypedDict, - OpenResponsesRequestPdf, - OpenResponsesRequestPdfEngine, - OpenResponsesRequestPdfTypedDict, + OpenResponsesRequestOnly, + OpenResponsesRequestOnlyTypedDict, + OpenResponsesRequestOrder, + OpenResponsesRequestOrderTypedDict, OpenResponsesRequestPluginFileParser, OpenResponsesRequestPluginFileParserTypedDict, OpenResponsesRequestPluginModeration, @@ -471,15 +479,14 @@ if TYPE_CHECKING: OpenResponsesRequestPluginWebTypedDict, OpenResponsesRequestProvider, OpenResponsesRequestProviderTypedDict, - OpenResponsesRequestRoute, + OpenResponsesRequestSort, + OpenResponsesRequestSortTypedDict, OpenResponsesRequestToolFunction, OpenResponsesRequestToolFunctionTypedDict, OpenResponsesRequestToolUnion, OpenResponsesRequestToolUnionTypedDict, OpenResponsesRequestType, OpenResponsesRequestTypedDict, - Order, - OrderTypedDict, ServiceTier, Truncation, ) @@ -613,13 +620,43 @@ if TYPE_CHECKING: PaymentRequiredResponseErrorData, PaymentRequiredResponseErrorDataTypedDict, ) + from .pdfparserengine import PDFParserEngine + from .pdfparseroptions import PDFParserOptions, PDFParserOptionsTypedDict from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict 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, @@ -809,6 +846,7 @@ if TYPE_CHECKING: UserMessageContentTypedDict, UserMessageTypedDict, ) + from .websearchengine import WebSearchEngine from .websearchpreviewtooluserlocation import ( WebSearchPreviewToolUserLocation, WebSearchPreviewToolUserLocationType, @@ -835,12 +873,8 @@ __all__ = [ "ChatErrorErrorTypedDict", "ChatGenerationParams", "ChatGenerationParamsDataCollection", - "ChatGenerationParamsEngine", "ChatGenerationParamsMaxPrice", "ChatGenerationParamsMaxPriceTypedDict", - "ChatGenerationParamsPdf", - "ChatGenerationParamsPdfEngine", - "ChatGenerationParamsPdfTypedDict", "ChatGenerationParamsPluginFileParser", "ChatGenerationParamsPluginFileParserTypedDict", "ChatGenerationParamsPluginModeration", @@ -861,7 +895,6 @@ __all__ = [ "ChatGenerationParamsResponseFormatTextTypedDict", "ChatGenerationParamsResponseFormatUnion", "ChatGenerationParamsResponseFormatUnionTypedDict", - "ChatGenerationParamsRoute", "ChatGenerationParamsStop", "ChatGenerationParamsStopTypedDict", "ChatGenerationParamsTypedDict", @@ -954,6 +987,7 @@ __all__ = [ "EdgeNetworkTimeoutResponseErrorDataTypedDict", "Effort", "EndpointStatus", + "Engine", "FileCitation", "FileCitationType", "FileCitationTypedDict", @@ -966,8 +1000,6 @@ __all__ = [ "IDModeration", "IDResponseHealing", "IDWeb", - "Ignore", - "IgnoreTypedDict", "ImageGenerationStatus", "ImageURL", "ImageURLTypedDict", @@ -1006,8 +1038,6 @@ __all__ = [ "NotFoundResponseErrorData", "NotFoundResponseErrorDataTypedDict", "Object", - "Only", - "OnlyTypedDict", "OpenAIResponsesAnnotation", "OpenAIResponsesAnnotationTypedDict", "OpenAIResponsesIncludable", @@ -1153,12 +1183,14 @@ __all__ = [ "OpenResponsesReasoningType", "OpenResponsesReasoningTypedDict", "OpenResponsesRequest", - "OpenResponsesRequestEngine", + "OpenResponsesRequestIgnore", + "OpenResponsesRequestIgnoreTypedDict", "OpenResponsesRequestMaxPrice", "OpenResponsesRequestMaxPriceTypedDict", - "OpenResponsesRequestPdf", - "OpenResponsesRequestPdfEngine", - "OpenResponsesRequestPdfTypedDict", + "OpenResponsesRequestOnly", + "OpenResponsesRequestOnlyTypedDict", + "OpenResponsesRequestOrder", + "OpenResponsesRequestOrderTypedDict", "OpenResponsesRequestPluginFileParser", "OpenResponsesRequestPluginFileParserTypedDict", "OpenResponsesRequestPluginModeration", @@ -1171,7 +1203,8 @@ __all__ = [ "OpenResponsesRequestPluginWebTypedDict", "OpenResponsesRequestProvider", "OpenResponsesRequestProviderTypedDict", - "OpenResponsesRequestRoute", + "OpenResponsesRequestSort", + "OpenResponsesRequestSortTypedDict", "OpenResponsesRequestToolFunction", "OpenResponsesRequestToolFunctionTypedDict", "OpenResponsesRequestToolUnion", @@ -1237,8 +1270,6 @@ __all__ = [ "OpenResponsesWebSearchToolFiltersTypedDict", "OpenResponsesWebSearchToolType", "OpenResponsesWebSearchToolTypedDict", - "Order", - "OrderTypedDict", "OutputItemImageGenerationCall", "OutputItemImageGenerationCallType", "OutputItemImageGenerationCallTypedDict", @@ -1256,15 +1287,22 @@ __all__ = [ "OutputModality", "OutputTokensDetails", "OutputTokensDetailsTypedDict", + "PDFParserEngine", + "PDFParserOptions", + "PDFParserOptionsTypedDict", "Parameter", "Part1", "Part1TypedDict", "Part2", "Part2TypedDict", + "Partition", "PayloadTooLargeResponseErrorData", "PayloadTooLargeResponseErrorDataTypedDict", "PaymentRequiredResponseErrorData", "PaymentRequiredResponseErrorDataTypedDict", + "Pdf", + "PdfEngine", + "PdfTypedDict", "PerRequestLimits", "PerRequestLimitsTypedDict", "Pricing", @@ -1276,7 +1314,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", @@ -1377,15 +1438,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 +1517,7 @@ __all__ = [ "VideoURL1TypedDict", "VideoURL2", "VideoURL2TypedDict", + "WebSearchEngine", "WebSearchPreviewToolUserLocation", "WebSearchPreviewToolUserLocationType", "WebSearchPreviewToolUserLocationTypedDict", @@ -1456,6 +1528,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 +1554,8 @@ _dynamic_imports: dict[str, str] = { "CodeTypedDict": ".chaterror", "ChatGenerationParams": ".chatgenerationparams", "ChatGenerationParamsDataCollection": ".chatgenerationparams", - "ChatGenerationParamsEngine": ".chatgenerationparams", "ChatGenerationParamsMaxPrice": ".chatgenerationparams", "ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPdf": ".chatgenerationparams", - "ChatGenerationParamsPdfEngine": ".chatgenerationparams", - "ChatGenerationParamsPdfTypedDict": ".chatgenerationparams", "ChatGenerationParamsPluginFileParser": ".chatgenerationparams", "ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams", "ChatGenerationParamsPluginModeration": ".chatgenerationparams", @@ -1499,17 +1576,20 @@ _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", + "Pdf": ".chatgenerationparams", + "PdfEngine": ".chatgenerationparams", + "PdfTypedDict": ".chatgenerationparams", "Quantizations": ".chatgenerationparams", "Reasoning": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams", - "Sort": ".chatgenerationparams", + "Route": ".chatgenerationparams", "ChatGenerationTokenUsage": ".chatgenerationtokenusage", "ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage", "CompletionTokensDetails": ".chatgenerationtokenusage", @@ -1805,17 +1885,15 @@ _dynamic_imports: dict[str, str] = { "IDModeration": ".openresponsesrequest", "IDResponseHealing": ".openresponsesrequest", "IDWeb": ".openresponsesrequest", - "Ignore": ".openresponsesrequest", - "IgnoreTypedDict": ".openresponsesrequest", - "Only": ".openresponsesrequest", - "OnlyTypedDict": ".openresponsesrequest", "OpenResponsesRequest": ".openresponsesrequest", - "OpenResponsesRequestEngine": ".openresponsesrequest", + "OpenResponsesRequestIgnore": ".openresponsesrequest", + "OpenResponsesRequestIgnoreTypedDict": ".openresponsesrequest", "OpenResponsesRequestMaxPrice": ".openresponsesrequest", "OpenResponsesRequestMaxPriceTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPdf": ".openresponsesrequest", - "OpenResponsesRequestPdfEngine": ".openresponsesrequest", - "OpenResponsesRequestPdfTypedDict": ".openresponsesrequest", + "OpenResponsesRequestOnly": ".openresponsesrequest", + "OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest", + "OpenResponsesRequestOrder": ".openresponsesrequest", + "OpenResponsesRequestOrderTypedDict": ".openresponsesrequest", "OpenResponsesRequestPluginFileParser": ".openresponsesrequest", "OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest", "OpenResponsesRequestPluginModeration": ".openresponsesrequest", @@ -1828,15 +1906,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 +2022,40 @@ _dynamic_imports: dict[str, str] = { "PayloadTooLargeResponseErrorDataTypedDict": ".payloadtoolargeresponseerrordata", "PaymentRequiredResponseErrorData": ".paymentrequiredresponseerrordata", "PaymentRequiredResponseErrorDataTypedDict": ".paymentrequiredresponseerrordata", + "PDFParserEngine": ".pdfparserengine", + "PDFParserOptions": ".pdfparseroptions", + "PDFParserOptionsTypedDict": ".pdfparseroptions", "PerRequestLimits": ".perrequestlimits", "PerRequestLimitsTypedDict": ".perrequestlimits", "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", @@ -2082,6 +2187,7 @@ _dynamic_imports: dict[str, str] = { "UserMessageContent": ".usermessage", "UserMessageContentTypedDict": ".usermessage", "UserMessageTypedDict": ".usermessage", + "WebSearchEngine": ".websearchengine", "WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation", "WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation", "WebSearchPreviewToolUserLocationTypedDict": ".websearchpreviewtooluserlocation", diff --git a/src/openrouter/components/_schema3.py b/src/openrouter/components/_schema3.py new file mode 100644 index 0000000..c9b2e40 --- /dev/null +++ b/src/openrouter/components/_schema3.py @@ -0,0 +1,228 @@ +"""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", + "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")), +] diff --git a/src/openrouter/components/chatgenerationparams.py b/src/openrouter/components/chatgenerationparams.py index 588668f..5cae41e 100644 --- a/src/openrouter/components/chatgenerationparams.py +++ b/src/openrouter/components/chatgenerationparams.py @@ -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.""" @@ -114,14 +105,14 @@ 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.""" + preferred_min_throughput: NotRequired[Nullable[float]] + preferred_max_latency: NotRequired[Nullable[float]] 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.""" class ChatGenerationParamsProvider(BaseModel): @@ -163,19 +154,19 @@ 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.""" + preferred_min_throughput: OptionalNullable[float] = UNSET + + preferred_max_latency: OptionalNullable[float] = UNSET + 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.""" 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.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -191,6 +182,8 @@ class ChatGenerationParamsProvider(BaseModel): "quantizations", "sort", "max_price", + "preferred_min_throughput", + "preferred_max_latency", "min_throughput", "max_latency", ] @@ -205,6 +198,8 @@ class ChatGenerationParamsProvider(BaseModel): "ignore", "quantizations", "sort", + "preferred_min_throughput", + "preferred_max_latency", "min_throughput", "max_latency", ] @@ -252,7 +247,7 @@ class ChatGenerationParamsPluginResponseHealing(BaseModel): enabled: Optional[bool] = None -ChatGenerationParamsPdfEngine = Union[ +PdfEngine = Union[ Literal[ "mistral-ocr", "pdf-text", @@ -262,22 +257,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] - max_files: NotRequired[float] - pdf: NotRequired[ChatGenerationParamsPdfTypedDict] + pdf: NotRequired[PdfTypedDict] class ChatGenerationParamsPluginFileParser(BaseModel): @@ -290,12 +283,10 @@ class ChatGenerationParamsPluginFileParser(BaseModel): enabled: Optional[bool] = None - max_files: Optional[float] = None - - pdf: Optional[ChatGenerationParamsPdf] = None + pdf: Optional[Pdf] = None -ChatGenerationParamsEngine = Union[ +Engine = Union[ Literal[ "native", "exa", @@ -309,7 +300,7 @@ class ChatGenerationParamsPluginWebTypedDict(TypedDict): enabled: NotRequired[bool] max_results: NotRequired[float] search_prompt: NotRequired[str] - engine: NotRequired[ChatGenerationParamsEngine] + engine: NotRequired[Engine] class ChatGenerationParamsPluginWeb(BaseModel): @@ -324,9 +315,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): @@ -362,7 +353,7 @@ ChatGenerationParamsPluginUnion = Annotated[ ] -ChatGenerationParamsRoute = Union[ +Route = Union[ Literal[ "fallback", "sort", @@ -373,12 +364,12 @@ ChatGenerationParamsRoute = Union[ Effort = Union[ Literal[ - "none", - "minimal", - "low", - "medium", - "high", "xhigh", + "high", + "medium", + "low", + "minimal", + "none", ], UnrecognizedStr, ] @@ -513,8 +504,7 @@ class ChatGenerationParamsTypedDict(TypedDict): 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.""" @@ -551,10 +541,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 diff --git a/src/openrouter/components/chatresponsechoice.py b/src/openrouter/components/chatresponsechoice.py index 9592bf1..9696904 100644 --- a/src/openrouter/components/chatresponsechoice.py +++ b/src/openrouter/components/chatresponsechoice.py @@ -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 = [] diff --git a/src/openrouter/components/chatstreamingmessagechunk.py b/src/openrouter/components/chatstreamingmessagechunk.py index dec4faf..8852ee8 100644 --- a/src/openrouter/components/chatstreamingmessagechunk.py +++ b/src/openrouter/components/chatstreamingmessagechunk.py @@ -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 = [] diff --git a/src/openrouter/components/openresponsesrequest.py b/src/openrouter/components/openresponsesrequest.py index d12b9b8..4dafb1c 100644 --- a/src/openrouter/components/openresponsesrequest.py +++ b/src/openrouter/components/openresponsesrequest.py @@ -33,9 +33,12 @@ from .openresponseswebsearchtool import ( OpenResponsesWebSearchTool, OpenResponsesWebSearchToolTypedDict, ) +from .pdfparseroptions import PDFParserOptions, PDFParserOptionsTypedDict from .providername import ProviderName from .providersort import ProviderSort +from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict from .quantization import Quantization +from .websearchengine import WebSearchEngine from openrouter.types import ( BaseModel, Nullable, @@ -148,33 +151,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 +257,26 @@ 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.""" + preferred_min_throughput: NotRequired[Nullable[float]] + r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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[float]] + r"""Preferred maximum latency (in seconds). Endpoints above this threshold 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.""" 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.""" + r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput.""" 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.""" + r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.""" class OpenResponsesRequestProvider(BaseModel): @@ -276,13 +307,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 +321,33 @@ 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[float] = UNSET + r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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[float] = UNSET + r"""Preferred maximum latency (in seconds). Endpoints above this threshold 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.""" + + min_throughput: Annotated[ + OptionalNullable[float], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - Use preferred_min_throughput instead.." + ), + ] = UNSET + r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput.""" + + max_latency: Annotated[ + OptionalNullable[float], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - Use preferred_max_latency instead.." + ), + ] = UNSET + r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -318,6 +363,8 @@ class OpenResponsesRequestProvider(BaseModel): "quantizations", "sort", "max_price", + "preferred_min_throughput", + "preferred_max_latency", "min_throughput", "max_latency", ] @@ -332,6 +379,8 @@ class OpenResponsesRequestProvider(BaseModel): "ignore", "quantizations", "sort", + "preferred_min_throughput", + "preferred_max_latency", "min_throughput", "max_latency", ] @@ -381,33 +430,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.""" - max_files: NotRequired[float] - pdf: NotRequired[OpenResponsesRequestPdfTypedDict] + pdf: NotRequired[PDFParserOptionsTypedDict] + r"""Options for PDF parsing.""" class OpenResponsesRequestPluginFileParser(BaseModel): @@ -416,30 +444,21 @@ class OpenResponsesRequestPluginFileParser(BaseModel): enabled: Optional[bool] = None r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" - max_files: Optional[float] = None - - 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): @@ -453,8 +472,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",] @@ -490,16 +510,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""" @@ -535,8 +545,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] @@ -615,12 +623,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.""" @@ -656,7 +658,6 @@ class OpenResponsesRequest(BaseModel): "stream", "provider", "plugins", - "route", "user", "session_id", ] @@ -676,7 +677,6 @@ class OpenResponsesRequest(BaseModel): "safety_identifier", "truncation", "provider", - "route", ] null_default_fields = [] diff --git a/src/openrouter/components/parameter.py b/src/openrouter/components/parameter.py index ec65bc3..b84cbf0 100644 --- a/src/openrouter/components/parameter.py +++ b/src/openrouter/components/parameter.py @@ -28,6 +28,7 @@ Parameter = Union[ "parallel_tool_calls", "include_reasoning", "reasoning", + "reasoning_effort", "web_search_options", "verbosity", ], diff --git a/src/openrouter/components/pdfparserengine.py b/src/openrouter/components/pdfparserengine.py new file mode 100644 index 0000000..4951697 --- /dev/null +++ b/src/openrouter/components/pdfparserengine.py @@ -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.""" diff --git a/src/openrouter/components/pdfparseroptions.py b/src/openrouter/components/pdfparseroptions.py new file mode 100644 index 0000000..13f177f --- /dev/null +++ b/src/openrouter/components/pdfparseroptions.py @@ -0,0 +1,25 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .pdfparserengine import PDFParserEngine +from openrouter.types import BaseModel +from openrouter.utils import validate_open_enum +from pydantic.functional_validators import PlainValidator +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class PDFParserOptionsTypedDict(TypedDict): + r"""Options for PDF parsing.""" + + engine: NotRequired[PDFParserEngine] + r"""The engine to use for parsing PDF files.""" + + +class PDFParserOptions(BaseModel): + r"""Options for PDF parsing.""" + + engine: Annotated[ + Optional[PDFParserEngine], PlainValidator(validate_open_enum(False)) + ] = None + r"""The engine to use for parsing PDF files.""" diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py new file mode 100644 index 0000000..85dfa40 --- /dev/null +++ b/src/openrouter/components/providerpreferences.py @@ -0,0 +1,375 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .datacollection import DataCollection +from .providername import ProviderName +from .providersort import ProviderSort +from .quantization import Quantization +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import validate_open_enum +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +ProviderPreferencesOrderTypedDict = TypeAliasType( + "ProviderPreferencesOrderTypedDict", Union[ProviderName, str] +) + + +ProviderPreferencesOrder = TypeAliasType( + "ProviderPreferencesOrder", + Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str], +) + + +ProviderPreferencesOnlyTypedDict = TypeAliasType( + "ProviderPreferencesOnlyTypedDict", Union[ProviderName, str] +) + + +ProviderPreferencesOnly = TypeAliasType( + "ProviderPreferencesOnly", + Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str], +) + + +ProviderPreferencesIgnoreTypedDict = TypeAliasType( + "ProviderPreferencesIgnoreTypedDict", Union[ProviderName, str] +) + + +ProviderPreferencesIgnore = TypeAliasType( + "ProviderPreferencesIgnore", + Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str], +) + + +SortEnum = Union[ + Literal[ + "price", + "throughput", + "latency", + ], + UnrecognizedStr, +] + + +ProviderSortConfigEnum = Literal[ + "price", + "throughput", + "latency", +] + + +ProviderPreferencesPartition = Union[ + Literal[ + "model", + "none", + ], + UnrecognizedStr, +] + + +class ProviderPreferencesProviderSortConfigTypedDict(TypedDict): + by: NotRequired[Nullable[ProviderSort]] + partition: NotRequired[Nullable[ProviderPreferencesPartition]] + + +class ProviderPreferencesProviderSortConfig(BaseModel): + by: Annotated[ + OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False)) + ] = UNSET + + partition: Annotated[ + OptionalNullable[ProviderPreferencesPartition], + PlainValidator(validate_open_enum(False)), + ] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["by", "partition"] + nullable_fields = ["by", "partition"] + 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 + + +ProviderSortConfigUnionTypedDict = TypeAliasType( + "ProviderSortConfigUnionTypedDict", + Union[ProviderPreferencesProviderSortConfigTypedDict, ProviderSortConfigEnum], +) + + +ProviderSortConfigUnion = TypeAliasType( + "ProviderSortConfigUnion", + Union[ProviderPreferencesProviderSortConfig, ProviderSortConfigEnum], +) + + +ProviderPreferencesProviderSort = Union[ + Literal[ + "price", + "throughput", + "latency", + ], + UnrecognizedStr, +] + + +ProviderPreferencesSortUnionTypedDict = TypeAliasType( + "ProviderPreferencesSortUnionTypedDict", + Union[ProviderPreferencesProviderSort, ProviderSortConfigUnionTypedDict, SortEnum], +) +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + +ProviderPreferencesSortUnion = TypeAliasType( + "ProviderPreferencesSortUnion", + Union[ + Annotated[ + ProviderPreferencesProviderSort, PlainValidator(validate_open_enum(False)) + ], + ProviderSortConfigUnion, + Annotated[SortEnum, PlainValidator(validate_open_enum(False))], + ], +) +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + +class ProviderPreferencesMaxPriceTypedDict(TypedDict): + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + + prompt: NotRequired[str] + r"""A value in string format that is a large number""" + completion: NotRequired[str] + r"""A value in string format that is a large number""" + image: NotRequired[str] + r"""A value in string format that is a large number""" + audio: NotRequired[str] + r"""A value in string format that is a large number""" + request: NotRequired[str] + r"""A value in string format that is a large number""" + + +class ProviderPreferencesMaxPrice(BaseModel): + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + + prompt: Optional[str] = None + r"""A value in string format that is a large number""" + + completion: Optional[str] = None + r"""A value in string format that is a large number""" + + image: Optional[str] = None + r"""A value in string format that is a large number""" + + audio: Optional[str] = None + r"""A value in string format that is a large number""" + + request: Optional[str] = None + r"""A value in string format that is a large number""" + + +class ProviderPreferencesTypedDict(TypedDict): + r"""Provider routing preferences for the request.""" + + allow_fallbacks: NotRequired[Nullable[bool]] + r"""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: NotRequired[Nullable[bool]] + r"""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: NotRequired[Nullable[DataCollection]] + r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. + - allow: (default) allow providers which store user data non-transiently and may train on it + + - deny: use only providers which do not collect user data. + """ + zdr: NotRequired[Nullable[bool]] + 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[ProviderPreferencesOrderTypedDict]]] + 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[ProviderPreferencesOnlyTypedDict]]] + 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[ProviderPreferencesIgnoreTypedDict]]] + 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[ProviderPreferencesSortUnionTypedDict]] + max_price: NotRequired[ProviderPreferencesMaxPriceTypedDict] + r"""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: NotRequired[Nullable[float]] + r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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[float]] + r"""Preferred maximum latency (in seconds). Endpoints above this threshold 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.""" + min_throughput: NotRequired[Nullable[float]] + r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput.""" + max_latency: NotRequired[Nullable[float]] + r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.""" + + +class ProviderPreferences(BaseModel): + r"""Provider routing preferences for the request.""" + + allow_fallbacks: OptionalNullable[bool] = UNSET + r"""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: OptionalNullable[bool] = UNSET + r"""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: Annotated[ + OptionalNullable[DataCollection], PlainValidator(validate_open_enum(False)) + ] = UNSET + r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. + - allow: (default) allow providers which store user data non-transiently and may train on it + + - deny: use only providers which do not collect user data. + """ + + zdr: OptionalNullable[bool] = UNSET + 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: 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[ProviderPreferencesOrder]] = 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[ProviderPreferencesOnly]] = 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[ProviderPreferencesIgnore]] = 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[ + List[Annotated[Quantization, PlainValidator(validate_open_enum(False))]] + ] = UNSET + r"""A list of quantization levels to filter the provider by.""" + + sort: OptionalNullable[ProviderPreferencesSortUnion] = UNSET + + max_price: Optional[ProviderPreferencesMaxPrice] = None + r"""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[float] = UNSET + r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold 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[float] = UNSET + r"""Preferred maximum latency (in seconds). Endpoints above this threshold 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.""" + + min_throughput: Annotated[ + OptionalNullable[float], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - Use preferred_min_throughput instead.." + ), + ] = UNSET + r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput.""" + + max_latency: Annotated[ + OptionalNullable[float], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - Use preferred_max_latency instead.." + ), + ] = UNSET + r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "allow_fallbacks", + "require_parameters", + "data_collection", + "zdr", + "enforce_distillable_text", + "order", + "only", + "ignore", + "quantizations", + "sort", + "max_price", + "preferred_min_throughput", + "preferred_max_latency", + "min_throughput", + "max_latency", + ] + nullable_fields = [ + "allow_fallbacks", + "require_parameters", + "data_collection", + "zdr", + "enforce_distillable_text", + "order", + "only", + "ignore", + "quantizations", + "sort", + "preferred_min_throughput", + "preferred_max_latency", + "min_throughput", + "max_latency", + ] + 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 diff --git a/src/openrouter/components/providersort.py b/src/openrouter/components/providersort.py index 8a8d415..c4cbc29 100644 --- a/src/openrouter/components/providersort.py +++ b/src/openrouter/components/providersort.py @@ -13,4 +13,3 @@ ProviderSort = Union[ ], UnrecognizedStr, ] -r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" diff --git a/src/openrouter/components/providersortconfig.py b/src/openrouter/components/providersortconfig.py new file mode 100644 index 0000000..c53a2fa --- /dev/null +++ b/src/openrouter/components/providersortconfig.py @@ -0,0 +1,71 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .providersort import ProviderSort +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import validate_open_enum +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import Literal, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +Partition = Union[ + Literal[ + "model", + "none", + ], + UnrecognizedStr, +] + + +class ProviderSortConfigTypedDict(TypedDict): + by: NotRequired[Nullable[ProviderSort]] + partition: NotRequired[Nullable[Partition]] + + +class ProviderSortConfig(BaseModel): + by: Annotated[ + OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False)) + ] = UNSET + + partition: Annotated[ + OptionalNullable[Partition], PlainValidator(validate_open_enum(False)) + ] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["by", "partition"] + nullable_fields = ["by", "partition"] + 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 diff --git a/src/openrouter/components/providersortunion.py b/src/openrouter/components/providersortunion.py new file mode 100644 index 0000000..52ed036 --- /dev/null +++ b/src/openrouter/components/providersortunion.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .providersort import ProviderSort +from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict +from openrouter.utils import validate_open_enum +from pydantic.functional_validators import PlainValidator +from typing import Union +from typing_extensions import Annotated, TypeAliasType + + +ProviderSortUnionTypedDict = TypeAliasType( + "ProviderSortUnionTypedDict", Union[ProviderSortConfigTypedDict, ProviderSort] +) + + +ProviderSortUnion = TypeAliasType( + "ProviderSortUnion", + Union[ + ProviderSortConfig, + Annotated[ProviderSort, PlainValidator(validate_open_enum(False))], + ], +) diff --git a/src/openrouter/components/websearchengine.py b/src/openrouter/components/websearchengine.py new file mode 100644 index 0000000..40dafa8 --- /dev/null +++ b/src/openrouter/components/websearchengine.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +WebSearchEngine = Union[ + Literal[ + "native", + "exa", + ], + UnrecognizedStr, +] +r"""The search engine to use for web search.""" diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index 3ea39af..20e9512 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -28,8 +28,7 @@ class Embeddings(BaseSDK): user: Optional[str] = None, provider: Optional[ Union[ - operations.CreateEmbeddingsProvider, - operations.CreateEmbeddingsProviderTypedDict, + components.ProviderPreferences, components.ProviderPreferencesTypedDict ] ] = None, input_type: Optional[str] = None, @@ -48,7 +47,7 @@ class Embeddings(BaseSDK): :param encoding_format: :param dimensions: :param user: - :param provider: + :param provider: Provider routing preferences for the request. :param input_type: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -73,7 +72,7 @@ class Embeddings(BaseSDK): dimensions=dimensions, user=user, provider=utils.get_pydantic_model( - provider, Optional[operations.CreateEmbeddingsProvider] + provider, Optional[components.ProviderPreferences] ), input_type=input_type, ) @@ -216,8 +215,7 @@ class Embeddings(BaseSDK): user: Optional[str] = None, provider: Optional[ Union[ - operations.CreateEmbeddingsProvider, - operations.CreateEmbeddingsProviderTypedDict, + components.ProviderPreferences, components.ProviderPreferencesTypedDict ] ] = None, input_type: Optional[str] = None, @@ -236,7 +234,7 @@ class Embeddings(BaseSDK): :param encoding_format: :param dimensions: :param user: - :param provider: + :param provider: Provider routing preferences for the request. :param input_type: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -261,7 +259,7 @@ class Embeddings(BaseSDK): dimensions=dimensions, user=user, provider=utils.get_pydantic_model( - provider, Optional[operations.CreateEmbeddingsProvider] + provider, Optional[components.ProviderPreferences] ), input_type=input_type, ) diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 9466002..be7e440 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -40,8 +40,6 @@ if TYPE_CHECKING: ContentTypedDict, CreateEmbeddingsData, CreateEmbeddingsDataTypedDict, - CreateEmbeddingsProvider, - CreateEmbeddingsProviderTypedDict, CreateEmbeddingsRequest, CreateEmbeddingsRequestTypedDict, CreateEmbeddingsResponse, @@ -51,22 +49,14 @@ if TYPE_CHECKING: Embedding, EmbeddingTypedDict, EncodingFormat, - Ignore, - IgnoreTypedDict, ImageURL, ImageURLTypedDict, Input, InputTypedDict, InputUnion, InputUnionTypedDict, - MaxPrice, - MaxPriceTypedDict, Object, ObjectEmbedding, - Only, - OnlyTypedDict, - Order, - OrderTypedDict, TypeImageURL, TypeText, Usage, @@ -135,7 +125,6 @@ if TYPE_CHECKING: from .getparameters import ( GetParametersData, GetParametersDataTypedDict, - GetParametersProvider, GetParametersRequest, GetParametersRequestTypedDict, GetParametersResponse, @@ -216,8 +205,6 @@ __all__ = [ "CreateCoinbaseChargeSecurityTypedDict", "CreateEmbeddingsData", "CreateEmbeddingsDataTypedDict", - "CreateEmbeddingsProvider", - "CreateEmbeddingsProviderTypedDict", "CreateEmbeddingsRequest", "CreateEmbeddingsRequestTypedDict", "CreateEmbeddingsResponse", @@ -271,7 +258,6 @@ __all__ = [ "GetModelsRequestTypedDict", "GetParametersData", "GetParametersDataTypedDict", - "GetParametersProvider", "GetParametersRequest", "GetParametersRequestTypedDict", "GetParametersResponse", @@ -282,8 +268,6 @@ __all__ = [ "GetUserActivityRequestTypedDict", "GetUserActivityResponse", "GetUserActivityResponseTypedDict", - "Ignore", - "IgnoreTypedDict", "ImageURL", "ImageURLTypedDict", "Input", @@ -308,16 +292,10 @@ __all__ = [ "ListRequestTypedDict", "ListResponse", "ListResponseTypedDict", - "MaxPrice", - "MaxPriceTypedDict", "Metadata", "MetadataTypedDict", "Object", "ObjectEmbedding", - "Only", - "OnlyTypedDict", - "Order", - "OrderTypedDict", "RateLimit", "RateLimitTypedDict", "SendChatCompletionRequestResponse", @@ -372,8 +350,6 @@ _dynamic_imports: dict[str, str] = { "ContentTypedDict": ".createembeddings", "CreateEmbeddingsData": ".createembeddings", "CreateEmbeddingsDataTypedDict": ".createembeddings", - "CreateEmbeddingsProvider": ".createembeddings", - "CreateEmbeddingsProviderTypedDict": ".createembeddings", "CreateEmbeddingsRequest": ".createembeddings", "CreateEmbeddingsRequestTypedDict": ".createembeddings", "CreateEmbeddingsResponse": ".createembeddings", @@ -383,22 +359,14 @@ _dynamic_imports: dict[str, str] = { "Embedding": ".createembeddings", "EmbeddingTypedDict": ".createembeddings", "EncodingFormat": ".createembeddings", - "Ignore": ".createembeddings", - "IgnoreTypedDict": ".createembeddings", "ImageURL": ".createembeddings", "ImageURLTypedDict": ".createembeddings", "Input": ".createembeddings", "InputTypedDict": ".createembeddings", "InputUnion": ".createembeddings", "InputUnionTypedDict": ".createembeddings", - "MaxPrice": ".createembeddings", - "MaxPriceTypedDict": ".createembeddings", "Object": ".createembeddings", "ObjectEmbedding": ".createembeddings", - "Only": ".createembeddings", - "OnlyTypedDict": ".createembeddings", - "Order": ".createembeddings", - "OrderTypedDict": ".createembeddings", "TypeImageURL": ".createembeddings", "TypeText": ".createembeddings", "Usage": ".createembeddings", @@ -450,7 +418,6 @@ _dynamic_imports: dict[str, str] = { "GetModelsRequestTypedDict": ".getmodels", "GetParametersData": ".getparameters", "GetParametersDataTypedDict": ".getparameters", - "GetParametersProvider": ".getparameters", "GetParametersRequest": ".getparameters", "GetParametersRequestTypedDict": ".getparameters", "GetParametersResponse": ".getparameters", diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index a8b90c0..6b0f07d 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -1,22 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.components import ( - datacollection as components_datacollection, - providername as components_providername, - providersort as components_providersort, - quantization as components_quantization, -) -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) +from openrouter.components import providerpreferences as components_providerpreferences +from openrouter.types import BaseModel, UnrecognizedStr from openrouter.utils import get_discriminator, validate_open_enum -from pydantic import Discriminator, Tag, model_serializer +from pydantic import Discriminator, Tag from pydantic.functional_validators import PlainValidator from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -100,254 +88,14 @@ EncodingFormat = Union[ ] -OrderTypedDict = TypeAliasType( - "OrderTypedDict", Union[components_providername.ProviderName, str] -) - - -Order = TypeAliasType( - "Order", - Union[ - Annotated[ - components_providername.ProviderName, - PlainValidator(validate_open_enum(False)), - ], - str, - ], -) - - -OnlyTypedDict = TypeAliasType( - "OnlyTypedDict", Union[components_providername.ProviderName, str] -) - - -Only = TypeAliasType( - "Only", - Union[ - Annotated[ - components_providername.ProviderName, - PlainValidator(validate_open_enum(False)), - ], - str, - ], -) - - -IgnoreTypedDict = TypeAliasType( - "IgnoreTypedDict", Union[components_providername.ProviderName, str] -) - - -Ignore = TypeAliasType( - "Ignore", - Union[ - Annotated[ - components_providername.ProviderName, - PlainValidator(validate_open_enum(False)), - ], - str, - ], -) - - -class MaxPriceTypedDict(TypedDict): - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - - prompt: NotRequired[str] - r"""A value in string format that is a large number""" - completion: NotRequired[str] - r"""A value in string format that is a large number""" - image: NotRequired[str] - r"""A value in string format that is a large number""" - audio: NotRequired[str] - r"""A value in string format that is a large number""" - request: NotRequired[str] - r"""A value in string format that is a large number""" - - -class MaxPrice(BaseModel): - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - - prompt: Optional[str] = None - r"""A value in string format that is a large number""" - - completion: Optional[str] = None - r"""A value in string format that is a large number""" - - image: Optional[str] = None - r"""A value in string format that is a large number""" - - audio: Optional[str] = None - r"""A value in string format that is a large number""" - - request: Optional[str] = None - r"""A value in string format that is a large number""" - - -class CreateEmbeddingsProviderTypedDict(TypedDict): - allow_fallbacks: NotRequired[Nullable[bool]] - r"""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: NotRequired[Nullable[bool]] - r"""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: NotRequired[Nullable[components_datacollection.DataCollection]] - r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - - allow: (default) allow providers which store user data non-transiently and may train on it - - - deny: use only providers which do not collect user data. - """ - zdr: NotRequired[Nullable[bool]] - 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]]] - 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]]] - 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]]] - 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[components_quantization.Quantization]]] - r"""A list of quantization levels to filter the provider by.""" - sort: NotRequired[Nullable[components_providersort.ProviderSort]] - r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - max_price: NotRequired[MaxPriceTypedDict] - 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.""" - - -class CreateEmbeddingsProvider(BaseModel): - allow_fallbacks: OptionalNullable[bool] = UNSET - r"""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: OptionalNullable[bool] = UNSET - r"""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: Annotated[ - OptionalNullable[components_datacollection.DataCollection], - PlainValidator(validate_open_enum(False)), - ] = UNSET - r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - - allow: (default) allow providers which store user data non-transiently and may train on it - - - deny: use only providers which do not collect user data. - """ - - zdr: OptionalNullable[bool] = UNSET - 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: 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 - 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 - 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 - 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[ - List[ - Annotated[ - components_quantization.Quantization, - PlainValidator(validate_open_enum(False)), - ] - ] - ] = UNSET - r"""A list of quantization levels to filter the provider by.""" - - sort: Annotated[ - OptionalNullable[components_providersort.ProviderSort], - PlainValidator(validate_open_enum(False)), - ] = 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[MaxPrice] = 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.""" - - 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.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [ - "allow_fallbacks", - "require_parameters", - "data_collection", - "zdr", - "enforce_distillable_text", - "order", - "only", - "ignore", - "quantizations", - "sort", - "max_price", - "min_throughput", - "max_latency", - ] - nullable_fields = [ - "allow_fallbacks", - "require_parameters", - "data_collection", - "zdr", - "enforce_distillable_text", - "order", - "only", - "ignore", - "quantizations", - "sort", - "min_throughput", - "max_latency", - ] - 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 CreateEmbeddingsRequestTypedDict(TypedDict): input: InputUnionTypedDict model: str encoding_format: NotRequired[EncodingFormat] dimensions: NotRequired[int] user: NotRequired[str] - provider: NotRequired[CreateEmbeddingsProviderTypedDict] + provider: NotRequired[components_providerpreferences.ProviderPreferencesTypedDict] + r"""Provider routing preferences for the request.""" input_type: NotRequired[str] @@ -364,7 +112,8 @@ class CreateEmbeddingsRequest(BaseModel): user: Optional[str] = None - provider: Optional[CreateEmbeddingsProvider] = None + provider: Optional[components_providerpreferences.ProviderPreferences] = None + r"""Provider routing preferences for the request.""" input_type: Optional[str] = None diff --git a/src/openrouter/operations/getparameters.py b/src/openrouter/operations/getparameters.py index 70c323e..2ae70a2 100644 --- a/src/openrouter/operations/getparameters.py +++ b/src/openrouter/operations/getparameters.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from openrouter.components import providername as components_providername from openrouter.types import BaseModel, UnrecognizedStr from openrouter.utils import ( FieldMetadata, @@ -32,86 +33,10 @@ class GetParametersSecurity(BaseModel): ] -GetParametersProvider = Union[ - Literal[ - "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", - ], - UnrecognizedStr, -] - - class GetParametersRequestTypedDict(TypedDict): author: str slug: str - provider: NotRequired[GetParametersProvider] + provider: NotRequired[components_providername.ProviderName] class GetParametersRequest(BaseModel): @@ -125,7 +50,8 @@ class GetParametersRequest(BaseModel): provider: Annotated[ Annotated[ - Optional[GetParametersProvider], PlainValidator(validate_open_enum(False)) + Optional[components_providername.ProviderName], + PlainValidator(validate_open_enum(False)), ], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None @@ -154,6 +80,7 @@ SupportedParameter = Union[ "parallel_tool_calls", "include_reasoning", "reasoning", + "reasoning_effort", "web_search_options", "verbosity", ], diff --git a/src/openrouter/parameters.py b/src/openrouter/parameters.py index 5206f57..d645cb1 100644 --- a/src/openrouter/parameters.py +++ b/src/openrouter/parameters.py @@ -20,7 +20,7 @@ class Parameters(BaseSDK): ], author: str, slug: str, - provider: Optional[operations.GetParametersProvider] = None, + provider: Optional[components.ProviderName] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -132,7 +132,7 @@ class Parameters(BaseSDK): ], author: str, slug: str, - provider: Optional[operations.GetParametersProvider] = None, + provider: Optional[components.ProviderName] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index 18f71dd..bb9603b 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -84,7 +84,6 @@ class Responses(BaseSDK): List[components.OpenResponsesRequestPluginUnionTypedDict], ] ] = None, - route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -121,7 +120,6 @@ class Responses(BaseSDK): :param stream: :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 user: 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. :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 retries: Override the default retry configuration for this method @@ -197,7 +195,6 @@ class Responses(BaseSDK): List[components.OpenResponsesRequestPluginUnionTypedDict], ] ] = None, - route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -234,7 +231,6 @@ class Responses(BaseSDK): :param stream: :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 user: 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. :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 retries: Override the default retry configuration for this method @@ -309,7 +305,6 @@ class Responses(BaseSDK): List[components.OpenResponsesRequestPluginUnionTypedDict], ] ] = None, - route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -346,7 +341,6 @@ class Responses(BaseSDK): :param stream: :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 user: 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. :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 retries: Override the default retry configuration for this method @@ -407,7 +401,6 @@ class Responses(BaseSDK): plugins=utils.get_pydantic_model( plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] ), - route=route, user=user, session_id=session_id, ) @@ -667,7 +660,6 @@ class Responses(BaseSDK): List[components.OpenResponsesRequestPluginUnionTypedDict], ] ] = None, - route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -704,7 +696,6 @@ class Responses(BaseSDK): :param stream: :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 user: 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. :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 retries: Override the default retry configuration for this method @@ -780,7 +771,6 @@ class Responses(BaseSDK): List[components.OpenResponsesRequestPluginUnionTypedDict], ] ] = None, - route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -817,7 +807,6 @@ class Responses(BaseSDK): :param stream: :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 user: 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. :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 retries: Override the default retry configuration for this method @@ -892,7 +881,6 @@ class Responses(BaseSDK): List[components.OpenResponsesRequestPluginUnionTypedDict], ] ] = None, - route: OptionalNullable[components.OpenResponsesRequestRoute] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -929,7 +917,6 @@ class Responses(BaseSDK): :param stream: :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 user: 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. :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 retries: Override the default retry configuration for this method @@ -990,7 +977,6 @@ class Responses(BaseSDK): plugins=utils.get_pydantic_model( plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] ), - route=route, user=user, session_id=session_id, ) diff --git a/uv.lock b/uv.lock index d506269..b70500b 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.9.2" resolution-markers = [ "python_full_version >= '3.12'", @@ -211,7 +211,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.0.16" +version = "0.0.17" source = { editable = "." } dependencies = [ { name = "httpcore" },