diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index c2713afd..aeb8e96e 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 8b6cd71c-ea04-44da-af45-e43968b5928d management: - docChecksum: e929ecf569d79ab96a315332a4855566 + docChecksum: a5b3a567dd4de3ab77a9f0b23d4a9f10 docVersion: 1.0.0 speakeasyVersion: 1.666.0 generationVersion: 2.768.0 - releaseVersion: 0.2.11 - configChecksum: e77ce69b2f427b72c26c9a5508fc1232 + releaseVersion: 0.3.1 + configChecksum: 2ebf79caacefe8cd3647823595fe3688 repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git installationURL: https://github.com/OpenRouterTeam/typescript-sdk published: true @@ -28,6 +28,7 @@ features: globalServerURLs: 2.83.0 globals: 2.82.2 groups: 2.81.3 + ignores: 2.81.1 methodArguments: 0.1.2 methodSecurity: 2.82.6 nameOverrides: 2.81.2 @@ -60,10 +61,7 @@ generatedFiles: - docs/models/chaterrorerror.md - docs/models/chatgenerationparams.md - docs/models/chatgenerationparamsdatacollection.md - - docs/models/chatgenerationparamsengine.md - docs/models/chatgenerationparamsmaxprice.md - - docs/models/chatgenerationparamspdf.md - - docs/models/chatgenerationparamspdfengine.md - docs/models/chatgenerationparamspluginfileparser.md - docs/models/chatgenerationparamspluginmoderation.md - docs/models/chatgenerationparamspluginresponsehealing.md @@ -74,7 +72,6 @@ generatedFiles: - docs/models/chatgenerationparamsresponseformatpython.md - docs/models/chatgenerationparamsresponseformattext.md - docs/models/chatgenerationparamsresponseformatunion.md - - docs/models/chatgenerationparamsroute.md - docs/models/chatgenerationparamsstop.md - docs/models/chatgenerationtokenusage.md - docs/models/chatmessagecontentitem.md @@ -124,6 +121,7 @@ generatedFiles: - docs/models/edgenetworktimeoutresponseerrordata.md - docs/models/effort.md - docs/models/endpointstatus.md + - docs/models/engine.md - docs/models/errors/badgatewayresponseerror.md - docs/models/errors/badrequestresponseerror.md - docs/models/errors/chaterror.md @@ -142,7 +140,6 @@ generatedFiles: - docs/models/filecitation.md - docs/models/filepath.md - docs/models/forbiddenresponseerrordata.md - - docs/models/ignore.md - docs/models/imagegenerationstatus.md - docs/models/imageurl.md - docs/models/inputmodality.md @@ -165,7 +162,6 @@ generatedFiles: - docs/models/namedtoolchoicefunction.md - docs/models/notfoundresponseerrordata.md - docs/models/objectt.md - - docs/models/only.md - docs/models/openairesponsesannotation.md - docs/models/openairesponsesincludable.md - docs/models/openairesponsesincompletedetails.md @@ -252,17 +248,17 @@ generatedFiles: - docs/models/openresponsesreasoningsummarytextdoneevent.md - docs/models/openresponsesreasoningtype.md - docs/models/openresponsesrequest.md - - docs/models/openresponsesrequestengine.md + - docs/models/openresponsesrequestignore.md - docs/models/openresponsesrequestmaxprice.md - - docs/models/openresponsesrequestpdf.md - - docs/models/openresponsesrequestpdfengine.md + - docs/models/openresponsesrequestonly.md + - docs/models/openresponsesrequestorder.md - docs/models/openresponsesrequestpluginfileparser.md - docs/models/openresponsesrequestpluginmoderation.md - docs/models/openresponsesrequestpluginresponsehealing.md - docs/models/openresponsesrequestpluginunion.md - docs/models/openresponsesrequestpluginweb.md - docs/models/openresponsesrequestprovider.md - - docs/models/openresponsesrequestroute.md + - docs/models/openresponsesrequestsort.md - docs/models/openresponsesrequesttoolfunction.md - docs/models/openresponsesrequesttoolunion.md - docs/models/openresponsesresponsetext.md @@ -306,7 +302,6 @@ generatedFiles: - docs/models/operations/createcoinbasechargeresponse.md - docs/models/operations/createcoinbasechargesecurity.md - docs/models/operations/createembeddingsdata.md - - docs/models/operations/createembeddingsprovider.md - docs/models/operations/createembeddingsrequest.md - docs/models/operations/createembeddingsresponse.md - docs/models/operations/createembeddingsresponsebody.md @@ -335,13 +330,11 @@ generatedFiles: - docs/models/operations/getkeyresponse.md - docs/models/operations/getmodelsrequest.md - docs/models/operations/getparametersdata.md - - docs/models/operations/getparametersprovider.md - docs/models/operations/getparametersrequest.md - docs/models/operations/getparametersresponse.md - docs/models/operations/getparameterssecurity.md - docs/models/operations/getuseractivityrequest.md - docs/models/operations/getuseractivityresponse.md - - docs/models/operations/ignore.md - docs/models/operations/imageurl.md - docs/models/operations/input.md - docs/models/operations/inputunion.md @@ -354,12 +347,9 @@ generatedFiles: - docs/models/operations/listprovidersresponse.md - docs/models/operations/listrequest.md - docs/models/operations/listresponse.md - - docs/models/operations/maxprice.md - docs/models/operations/metadata.md - docs/models/operations/objectembedding.md - docs/models/operations/objectt.md - - docs/models/operations/only.md - - docs/models/operations/order.md - docs/models/operations/ratelimit.md - docs/models/operations/sendchatcompletionrequestresponse.md - docs/models/operations/supportedparameter.md @@ -371,7 +361,6 @@ generatedFiles: - docs/models/operations/updatekeysresponse.md - docs/models/operations/usage.md - docs/models/operations/web3data.md - - docs/models/order.md - docs/models/outputitemimagegenerationcall.md - docs/models/outputitemimagegenerationcalltype.md - docs/models/outputmessage.md @@ -387,15 +376,33 @@ generatedFiles: - docs/models/parameter.md - docs/models/part1.md - docs/models/part2.md + - docs/models/partition.md - docs/models/payloadtoolargeresponseerrordata.md - docs/models/paymentrequiredresponseerrordata.md + - docs/models/pdf.md + - docs/models/pdfengine.md + - docs/models/pdfparserengine.md + - docs/models/pdfparseroptions.md - docs/models/perrequestlimits.md - docs/models/pricing.md - docs/models/prompt.md - docs/models/prompttokensdetails.md - docs/models/providername.md - docs/models/provideroverloadedresponseerrordata.md + - docs/models/providerpreferences.md + - docs/models/providerpreferencesignore.md + - docs/models/providerpreferencesmaxprice.md + - docs/models/providerpreferencesonly.md + - docs/models/providerpreferencesorder.md + - docs/models/providerpreferencespartition.md + - docs/models/providerpreferencesprovidersort.md + - docs/models/providerpreferencesprovidersortconfig.md + - docs/models/providerpreferencessortunion.md - docs/models/providersort.md + - docs/models/providersortconfig.md + - docs/models/providersortconfigenum.md + - docs/models/providersortconfigunion.md + - docs/models/providersortunion.md - docs/models/publicendpoint.md - docs/models/publicendpointquantization.md - docs/models/publicpricing.md @@ -456,12 +463,18 @@ generatedFiles: - docs/models/responseswebsearchuserlocationtype.md - docs/models/responsetextconfig.md - docs/models/responsetextconfigverbosity.md + - docs/models/route.md - docs/models/schema0.md - docs/models/schema0enum.md + - docs/models/schema3.md + - docs/models/schema3reasoningencrypted.md + - docs/models/schema3reasoningsummary.md + - docs/models/schema3reasoningtext.md + - docs/models/schema5.md - docs/models/security.md - docs/models/servicetier.md - docs/models/serviceunavailableresponseerrordata.md - - docs/models/sort.md + - docs/models/sortenum.md - docs/models/streamoptions.md - docs/models/systemmessage.md - docs/models/systemmessagecontent.md @@ -485,6 +498,7 @@ generatedFiles: - docs/models/variables.md - docs/models/videourl1.md - docs/models/videourl2.md + - docs/models/websearchengine.md - docs/models/websearchpreviewtooluserlocation.md - docs/models/websearchpreviewtooluserlocationtype.md - docs/models/websearchstatus.md @@ -695,10 +709,15 @@ generatedFiles: - src/models/parameter.ts - src/models/payloadtoolargeresponseerrordata.ts - src/models/paymentrequiredresponseerrordata.ts + - src/models/pdfparserengine.ts + - src/models/pdfparseroptions.ts - src/models/perrequestlimits.ts - src/models/providername.ts - src/models/provideroverloadedresponseerrordata.ts + - src/models/providerpreferences.ts - src/models/providersort.ts + - src/models/providersortconfig.ts + - src/models/providersortunion.ts - src/models/publicendpoint.ts - src/models/publicpricing.ts - src/models/quantization.ts @@ -729,6 +748,7 @@ generatedFiles: - src/models/responseswebsearchuserlocation.ts - src/models/responsetextconfig.ts - src/models/schema0.ts + - src/models/schema3.ts - src/models/security.ts - src/models/serviceunavailableresponseerrordata.ts - src/models/systemmessage.ts @@ -741,6 +761,7 @@ generatedFiles: - src/models/unprocessableentityresponseerrordata.ts - src/models/urlcitation.ts - src/models/usermessage.ts + - src/models/websearchengine.ts - src/models/websearchpreviewtooluserlocation.ts - src/models/websearchstatus.ts - src/sdk/analytics.ts @@ -762,6 +783,7 @@ generatedFiles: - src/types/async.ts - src/types/blobs.ts - src/types/constdatetime.ts + - src/types/discriminatedUnion.ts - src/types/enums.ts - src/types/fp.ts - src/types/index.ts diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 20adaa57..7e1c2458 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -31,7 +31,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true typescript: - version: 0.2.11 + version: 0.3.1 acceptHeaderEnum: false additionalDependencies: dependencies: {} diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index a5f339a6..4047ff25 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. - min_throughput: + 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: >- - 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 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 - 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/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 5506188d..31a1ea0e 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. - min_throughput: + 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: >- - 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 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 - 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 52afebf4..818052e3 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,20 +2,20 @@ speakeasyVersion: 1.666.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b - sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab + sourceRevisionDigest: sha256:92f6f1568ba089ae8e52bd55d859a97e446ae232c4c9ca9302ea64705313c7a0 + sourceBlobDigest: sha256:6bbf6ab7123261f7e0604f1c640e32b5fc8fb6bb503b1bc8b12d0d78ed19fefc tags: - latest - - matt-missing-provider-schema + - matt-fix-reasoning-and-types - 1.0.0 targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b128cdb6be96021e55feea5e2dcb6e7438de706138fcde4f871b14877885445b - sourceBlobDigest: sha256:8b15f72eaabbd77f4642be28a2861fd1cfd5d8cfe96e72fb8a76832387c64fab + sourceRevisionDigest: sha256:92f6f1568ba089ae8e52bd55d859a97e446ae232c4c9ca9302ea64705313c7a0 + sourceBlobDigest: sha256:6bbf6ab7123261f7e0604f1c640e32b5fc8fb6bb503b1bc8b12d0d78ed19fefc codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:da4836f90ab924cc1ec37989c2285b212ae4aac2c5d7832c148654746c3f501d + codeSamplesRevisionDigest: sha256:7f5011aa123855cc92e9b1975ea54d834113df9dc07c7974b41ef8d49a2d4cfc workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.666.0 diff --git a/docs/models/chatgenerationparams.md b/docs/models/chatgenerationparams.md index c8019e18..a3822de5 100644 --- a/docs/models/chatgenerationparams.md +++ b/docs/models/chatgenerationparams.md @@ -21,7 +21,7 @@ let value: ChatGenerationParams = { | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `provider` | [models.ChatGenerationParamsProvider](../models/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | `plugins` | *models.ChatGenerationParamsPluginUnion*[] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | -| `route` | [models.ChatGenerationParamsRoute](../models/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` | [models.Route](../models/route.md) | :heavy_minus_sign: | N/A | | `user` | *string* | :heavy_minus_sign: | N/A | | `sessionId` | *string* | :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` | *models.Message*[] | :heavy_check_mark: | N/A | diff --git a/docs/models/chatgenerationparamspdf.md b/docs/models/chatgenerationparamspdf.md deleted file mode 100644 index 99e71e2e..00000000 --- a/docs/models/chatgenerationparamspdf.md +++ /dev/null @@ -1,15 +0,0 @@ -# ChatGenerationParamsPdf - -## Example Usage - -```typescript -import { ChatGenerationParamsPdf } from "@openrouter/sdk/models"; - -let value: ChatGenerationParamsPdf = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `engine` | [models.ChatGenerationParamsPdfEngine](../models/chatgenerationparamspdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatgenerationparamspluginfileparser.md b/docs/models/chatgenerationparamspluginfileparser.md index 281b95e2..a30c3acd 100644 --- a/docs/models/chatgenerationparamspluginfileparser.md +++ b/docs/models/chatgenerationparamspluginfileparser.md @@ -12,9 +12,8 @@ let value: ChatGenerationParamsPluginFileParser = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *"file-parser"* | :heavy_check_mark: | N/A | -| `enabled` | *boolean* | :heavy_minus_sign: | N/A | -| `maxFiles` | *number* | :heavy_minus_sign: | N/A | -| `pdf` | [models.ChatGenerationParamsPdf](../models/chatgenerationparamspdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | +| `id` | *"file-parser"* | :heavy_check_mark: | N/A | +| `enabled` | *boolean* | :heavy_minus_sign: | N/A | +| `pdf` | [models.Pdf](../models/pdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatgenerationparamspluginweb.md b/docs/models/chatgenerationparamspluginweb.md index e22d9d2f..5019fca6 100644 --- a/docs/models/chatgenerationparamspluginweb.md +++ b/docs/models/chatgenerationparamspluginweb.md @@ -12,10 +12,10 @@ let value: ChatGenerationParamsPluginWeb = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `id` | *"web"* | :heavy_check_mark: | N/A | -| `enabled` | *boolean* | :heavy_minus_sign: | N/A | -| `maxResults` | *number* | :heavy_minus_sign: | N/A | -| `searchPrompt` | *string* | :heavy_minus_sign: | N/A | -| `engine` | [models.ChatGenerationParamsEngine](../models/chatgenerationparamsengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `id` | *"web"* | :heavy_check_mark: | N/A | +| `enabled` | *boolean* | :heavy_minus_sign: | N/A | +| `maxResults` | *number* | :heavy_minus_sign: | N/A | +| `searchPrompt` | *string* | :heavy_minus_sign: | N/A | +| `engine` | [models.Engine](../models/engine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatgenerationparamsprovider.md b/docs/models/chatgenerationparamsprovider.md index 51f21fd4..dd5158f2 100644 --- a/docs/models/chatgenerationparamsprovider.md +++ b/docs/models/chatgenerationparamsprovider.md @@ -21,7 +21,9 @@ let value: ChatGenerationParamsProvider = {}; | `only` | *models.Schema0*[] | :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` | *models.Schema0*[] | :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` | [models.Quantizations](../models/quantizations.md)[] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | -| `sort` | [models.Sort](../models/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` | *models.ProviderSortUnion* | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | | `maxPrice` | [models.ChatGenerationParamsMaxPrice](../models/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. | -| `minThroughput` | *number* | :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. | -| `maxLatency` | *number* | :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 +| `preferredMinThroughput` | *number* | :heavy_minus_sign: | N/A | +| `preferredMaxLatency` | *number* | :heavy_minus_sign: | N/A | +| `minThroughput` | *number* | :heavy_minus_sign: | N/A | +| `maxLatency` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatresponsechoice.md b/docs/models/chatresponsechoice.md index 58451f44..40a6a234 100644 --- a/docs/models/chatresponsechoice.md +++ b/docs/models/chatresponsechoice.md @@ -21,4 +21,5 @@ let value: ChatResponseChoice = { | `finishReason` | [models.ChatCompletionFinishReason](../models/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A | | `index` | *number* | :heavy_check_mark: | N/A | | `message` | [models.AssistantMessage](../models/assistantmessage.md) | :heavy_check_mark: | N/A | +| `reasoningDetails` | *models.Schema3*[] | :heavy_minus_sign: | N/A | | `logprobs` | [models.ChatMessageTokenLogprobs](../models/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamingmessagechunk.md b/docs/models/chatstreamingmessagechunk.md index a14127a2..58e7d665 100644 --- a/docs/models/chatstreamingmessagechunk.md +++ b/docs/models/chatstreamingmessagechunk.md @@ -16,4 +16,5 @@ let value: ChatStreamingMessageChunk = {}; | `content` | *string* | :heavy_minus_sign: | N/A | | `reasoning` | *string* | :heavy_minus_sign: | N/A | | `refusal` | *string* | :heavy_minus_sign: | N/A | -| `toolCalls` | [models.ChatStreamingMessageToolCall](../models/chatstreamingmessagetoolcall.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `toolCalls` | [models.ChatStreamingMessageToolCall](../models/chatstreamingmessagetoolcall.md)[] | :heavy_minus_sign: | N/A | +| `reasoningDetails` | *models.Schema3*[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/effort.md b/docs/models/effort.md index 274fb326..adcb3b7a 100644 --- a/docs/models/effort.md +++ b/docs/models/effort.md @@ -5,7 +5,7 @@ ```typescript import { Effort } from "@openrouter/sdk/models"; -let value: Effort = "minimal"; +let value: Effort = "high"; ``` ## Values @@ -13,5 +13,5 @@ let value: Effort = "minimal"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | Unrecognized +"xhigh" | "high" | "medium" | "low" | "minimal" | "none" | Unrecognized ``` \ No newline at end of file diff --git a/docs/models/chatgenerationparamsengine.md b/docs/models/engine.md similarity index 58% rename from docs/models/chatgenerationparamsengine.md rename to docs/models/engine.md index 10ac475c..0c80b2fb 100644 --- a/docs/models/chatgenerationparamsengine.md +++ b/docs/models/engine.md @@ -1,11 +1,11 @@ -# ChatGenerationParamsEngine +# Engine ## Example Usage ```typescript -import { ChatGenerationParamsEngine } from "@openrouter/sdk/models"; +import { Engine } from "@openrouter/sdk/models"; -let value: ChatGenerationParamsEngine = "native"; +let value: Engine = "exa"; ``` ## Values diff --git a/docs/models/openresponsesrequest.md b/docs/models/openresponsesrequest.md index 5120d85e..de356626 100644 --- a/docs/models/openresponsesrequest.md +++ b/docs/models/openresponsesrequest.md @@ -40,6 +40,5 @@ let value: OpenResponsesRequest = {}; | `stream` | *boolean* | :heavy_minus_sign: | N/A | | | `provider` | [models.OpenResponsesRequestProvider](../models/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | | `plugins` | *models.OpenResponsesRequestPluginUnion*[] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | -| `route` | [models.OpenResponsesRequestRoute](../models/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` | *string* | :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. | | | `sessionId` | *string* | :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/models/openresponsesrequestignore.md b/docs/models/openresponsesrequestignore.md new file mode 100644 index 00000000..233062b4 --- /dev/null +++ b/docs/models/openresponsesrequestignore.md @@ -0,0 +1,17 @@ +# OpenResponsesRequestIgnore + + +## Supported Types + +### `models.ProviderName` + +```typescript +const value: models.ProviderName = "OpenAI"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/ignore.md b/docs/models/openresponsesrequestonly.md similarity index 86% rename from docs/models/ignore.md rename to docs/models/openresponsesrequestonly.md index de9c31d0..aa0bd536 100644 --- a/docs/models/ignore.md +++ b/docs/models/openresponsesrequestonly.md @@ -1,4 +1,4 @@ -# Ignore +# OpenResponsesRequestOnly ## Supported Types diff --git a/docs/models/operations/only.md b/docs/models/openresponsesrequestorder.md similarity index 86% rename from docs/models/operations/only.md rename to docs/models/openresponsesrequestorder.md index c4202205..e8180b1b 100644 --- a/docs/models/operations/only.md +++ b/docs/models/openresponsesrequestorder.md @@ -1,4 +1,4 @@ -# Only +# OpenResponsesRequestOrder ## Supported Types diff --git a/docs/models/openresponsesrequestpdf.md b/docs/models/openresponsesrequestpdf.md deleted file mode 100644 index cb33cc0e..00000000 --- a/docs/models/openresponsesrequestpdf.md +++ /dev/null @@ -1,15 +0,0 @@ -# OpenResponsesRequestPdf - -## Example Usage - -```typescript -import { OpenResponsesRequestPdf } from "@openrouter/sdk/models"; - -let value: OpenResponsesRequestPdf = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `engine` | [models.OpenResponsesRequestPdfEngine](../models/openresponsesrequestpdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/openresponsesrequestpluginfileparser.md b/docs/models/openresponsesrequestpluginfileparser.md index 2181ab51..759a754b 100644 --- a/docs/models/openresponsesrequestpluginfileparser.md +++ b/docs/models/openresponsesrequestpluginfileparser.md @@ -16,5 +16,4 @@ let value: OpenResponsesRequestPluginFileParser = { | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | `id` | *"file-parser"* | :heavy_check_mark: | N/A | | `enabled` | *boolean* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. | -| `maxFiles` | *number* | :heavy_minus_sign: | N/A | -| `pdf` | [models.OpenResponsesRequestPdf](../models/openresponsesrequestpdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `pdf` | [models.PDFParserOptions](../models/pdfparseroptions.md) | :heavy_minus_sign: | Options for PDF parsing. | \ No newline at end of file diff --git a/docs/models/openresponsesrequestpluginweb.md b/docs/models/openresponsesrequestpluginweb.md index e005ca61..333dc3c7 100644 --- a/docs/models/openresponsesrequestpluginweb.md +++ b/docs/models/openresponsesrequestpluginweb.md @@ -18,4 +18,4 @@ let value: OpenResponsesRequestPluginWeb = { | `enabled` | *boolean* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. | | `maxResults` | *number* | :heavy_minus_sign: | N/A | | `searchPrompt` | *string* | :heavy_minus_sign: | N/A | -| `engine` | [models.OpenResponsesRequestEngine](../models/openresponsesrequestengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `engine` | [models.WebSearchEngine](../models/websearchengine.md) | :heavy_minus_sign: | The search engine to use for web search. | \ No newline at end of file diff --git a/docs/models/openresponsesrequestprovider.md b/docs/models/openresponsesrequestprovider.md index aa6c009f..8162fc1a 100644 --- a/docs/models/openresponsesrequestprovider.md +++ b/docs/models/openresponsesrequestprovider.md @@ -19,11 +19,13 @@ let value: OpenResponsesRequestProvider = {}; | `dataCollection` | [models.DataCollection](../models/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` | *boolean* | :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 | | `enforceDistillableText` | *boolean* | :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` | *models.Order*[] | :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` | *models.Only*[] | :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` | *models.Ignore*[] | :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` | *models.OpenResponsesRequestOrder*[] | :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` | *models.OpenResponsesRequestOnly*[] | :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` | *models.OpenResponsesRequestIgnore*[] | :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` | [models.Quantization](../models/quantization.md)[] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | -| `sort` | [models.ProviderSort](../models/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` | *models.OpenResponsesRequestSort* | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `maxPrice` | [models.OpenResponsesRequestMaxPrice](../models/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. | | -| `minThroughput` | *number* | :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 | -| `maxLatency` | *number* | :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 +| `preferredMinThroughput` | *number* | :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 | +| `preferredMaxLatency` | *number* | :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 | +| ~~`minThroughput`~~ | *number* | :heavy_minus_sign: | : warning: ** DEPRECATED **: Use preferred_min_throughput instead..

**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. | 100 | +| ~~`maxLatency`~~ | *number* | :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/models/openresponsesrequestroute.md b/docs/models/openresponsesrequestroute.md deleted file mode 100644 index f5123d20..00000000 --- a/docs/models/openresponsesrequestroute.md +++ /dev/null @@ -1,19 +0,0 @@ -# OpenResponsesRequestRoute - -Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. - -## Example Usage - -```typescript -import { OpenResponsesRequestRoute } from "@openrouter/sdk/models"; - -let value: OpenResponsesRequestRoute = "fallback"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"fallback" | "sort" | Unrecognized -``` \ No newline at end of file diff --git a/docs/models/openresponsesrequestsort.md b/docs/models/openresponsesrequestsort.md new file mode 100644 index 00000000..84f6e6ac --- /dev/null +++ b/docs/models/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 + +### `models.ProviderSort` + +```typescript +const value: models.ProviderSort = "price"; +``` + +### `models.ProviderSortConfig` + +```typescript +const value: models.ProviderSortConfig = {}; +``` + +### `any` + +```typescript +const value: any = "price"; +``` + diff --git a/docs/models/operations/createembeddingsrequest.md b/docs/models/operations/createembeddingsrequest.md index 557bddfb..b140d86e 100644 --- a/docs/models/operations/createembeddingsrequest.md +++ b/docs/models/operations/createembeddingsrequest.md @@ -19,12 +19,12 @@ let value: CreateEmbeddingsRequest = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `input` | *operations.InputUnion* | :heavy_check_mark: | N/A | -| `model` | *string* | :heavy_check_mark: | N/A | -| `encodingFormat` | [operations.EncodingFormat](../../models/operations/encodingformat.md) | :heavy_minus_sign: | N/A | -| `dimensions` | *number* | :heavy_minus_sign: | N/A | -| `user` | *string* | :heavy_minus_sign: | N/A | -| `provider` | [operations.CreateEmbeddingsProvider](../../models/operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | -| `inputType` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `input` | *operations.InputUnion* | :heavy_check_mark: | N/A | +| `model` | *string* | :heavy_check_mark: | N/A | +| `encodingFormat` | [operations.EncodingFormat](../../models/operations/encodingformat.md) | :heavy_minus_sign: | N/A | +| `dimensions` | *number* | :heavy_minus_sign: | N/A | +| `user` | *string* | :heavy_minus_sign: | N/A | +| `provider` | [models.ProviderPreferences](../../models/providerpreferences.md) | :heavy_minus_sign: | Provider routing preferences for the request. | +| `inputType` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getparametersprovider.md b/docs/models/operations/getparametersprovider.md deleted file mode 100644 index 681997c2..00000000 --- a/docs/models/operations/getparametersprovider.md +++ /dev/null @@ -1,17 +0,0 @@ -# GetParametersProvider - -## Example Usage - -```typescript -import { GetParametersProvider } from "@openrouter/sdk/models/operations"; - -let value: GetParametersProvider = "Google AI Studio"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"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" | Unrecognized -``` \ No newline at end of file diff --git a/docs/models/operations/getparametersrequest.md b/docs/models/operations/getparametersrequest.md index 3f2605e7..15f72802 100644 --- a/docs/models/operations/getparametersrequest.md +++ b/docs/models/operations/getparametersrequest.md @@ -13,8 +13,8 @@ let value: GetParametersRequest = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `author` | *string* | :heavy_check_mark: | N/A | -| `slug` | *string* | :heavy_check_mark: | N/A | -| `provider` | [operations.GetParametersProvider](../../models/operations/getparametersprovider.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `author` | *string* | :heavy_check_mark: | N/A | | +| `slug` | *string* | :heavy_check_mark: | N/A | | +| `provider` | [models.ProviderName](../../models/providername.md) | :heavy_minus_sign: | N/A | OpenAI | \ No newline at end of file diff --git a/docs/models/operations/order.md b/docs/models/operations/order.md deleted file mode 100644 index 8a2f0898..00000000 --- a/docs/models/operations/order.md +++ /dev/null @@ -1,17 +0,0 @@ -# Order - - -## Supported Types - -### `models.ProviderName` - -```typescript -const value: models.ProviderName = "OpenAI"; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/docs/models/operations/supportedparameter.md b/docs/models/operations/supportedparameter.md index 93d4b86d..46509631 100644 --- a/docs/models/operations/supportedparameter.md +++ b/docs/models/operations/supportedparameter.md @@ -13,5 +13,5 @@ let value: SupportedParameter = "top_logprobs"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"temperature" | "top_p" | "top_k" | "min_p" | "top_a" | "frequency_penalty" | "presence_penalty" | "repetition_penalty" | "max_tokens" | "logit_bias" | "logprobs" | "top_logprobs" | "seed" | "response_format" | "structured_outputs" | "stop" | "tools" | "tool_choice" | "parallel_tool_calls" | "include_reasoning" | "reasoning" | "web_search_options" | "verbosity" | Unrecognized +"temperature" | "top_p" | "top_k" | "min_p" | "top_a" | "frequency_penalty" | "presence_penalty" | "repetition_penalty" | "max_tokens" | "logit_bias" | "logprobs" | "top_logprobs" | "seed" | "response_format" | "structured_outputs" | "stop" | "tools" | "tool_choice" | "parallel_tool_calls" | "include_reasoning" | "reasoning" | "reasoning_effort" | "web_search_options" | "verbosity" | Unrecognized ``` \ No newline at end of file diff --git a/docs/models/order.md b/docs/models/order.md deleted file mode 100644 index 8a2f0898..00000000 --- a/docs/models/order.md +++ /dev/null @@ -1,17 +0,0 @@ -# Order - - -## Supported Types - -### `models.ProviderName` - -```typescript -const value: models.ProviderName = "OpenAI"; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/docs/models/parameter.md b/docs/models/parameter.md index fd22e708..5c7a3f0c 100644 --- a/docs/models/parameter.md +++ b/docs/models/parameter.md @@ -13,5 +13,5 @@ let value: Parameter = "temperature"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"temperature" | "top_p" | "top_k" | "min_p" | "top_a" | "frequency_penalty" | "presence_penalty" | "repetition_penalty" | "max_tokens" | "logit_bias" | "logprobs" | "top_logprobs" | "seed" | "response_format" | "structured_outputs" | "stop" | "tools" | "tool_choice" | "parallel_tool_calls" | "include_reasoning" | "reasoning" | "web_search_options" | "verbosity" | Unrecognized +"temperature" | "top_p" | "top_k" | "min_p" | "top_a" | "frequency_penalty" | "presence_penalty" | "repetition_penalty" | "max_tokens" | "logit_bias" | "logprobs" | "top_logprobs" | "seed" | "response_format" | "structured_outputs" | "stop" | "tools" | "tool_choice" | "parallel_tool_calls" | "include_reasoning" | "reasoning" | "reasoning_effort" | "web_search_options" | "verbosity" | Unrecognized ``` \ No newline at end of file diff --git a/docs/models/partition.md b/docs/models/partition.md new file mode 100644 index 00000000..d95933ac --- /dev/null +++ b/docs/models/partition.md @@ -0,0 +1,17 @@ +# Partition + +## Example Usage + +```typescript +import { Partition } from "@openrouter/sdk/models"; + +let value: Partition = "none"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"model" | "none" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/pdf.md b/docs/models/pdf.md new file mode 100644 index 00000000..67850913 --- /dev/null +++ b/docs/models/pdf.md @@ -0,0 +1,15 @@ +# Pdf + +## Example Usage + +```typescript +import { Pdf } from "@openrouter/sdk/models"; + +let value: Pdf = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `engine` | [models.PdfEngine](../models/pdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/openresponsesrequestpdfengine.md b/docs/models/pdfengine.md similarity index 59% rename from docs/models/openresponsesrequestpdfengine.md rename to docs/models/pdfengine.md index 70d0f99a..5781ce26 100644 --- a/docs/models/openresponsesrequestpdfengine.md +++ b/docs/models/pdfengine.md @@ -1,11 +1,11 @@ -# OpenResponsesRequestPdfEngine +# PdfEngine ## Example Usage ```typescript -import { OpenResponsesRequestPdfEngine } from "@openrouter/sdk/models"; +import { PdfEngine } from "@openrouter/sdk/models"; -let value: OpenResponsesRequestPdfEngine = "native"; +let value: PdfEngine = "pdf-text"; ``` ## Values diff --git a/docs/models/chatgenerationparamspdfengine.md b/docs/models/pdfparserengine.md similarity index 58% rename from docs/models/chatgenerationparamspdfengine.md rename to docs/models/pdfparserengine.md index 75faf193..b509e29a 100644 --- a/docs/models/chatgenerationparamspdfengine.md +++ b/docs/models/pdfparserengine.md @@ -1,11 +1,13 @@ -# ChatGenerationParamsPdfEngine +# PDFParserEngine + +The engine to use for parsing PDF files. ## Example Usage ```typescript -import { ChatGenerationParamsPdfEngine } from "@openrouter/sdk/models"; +import { PDFParserEngine } from "@openrouter/sdk/models"; -let value: ChatGenerationParamsPdfEngine = "mistral-ocr"; +let value: PDFParserEngine = "native"; ``` ## Values diff --git a/docs/models/pdfparseroptions.md b/docs/models/pdfparseroptions.md new file mode 100644 index 00000000..73df927c --- /dev/null +++ b/docs/models/pdfparseroptions.md @@ -0,0 +1,17 @@ +# PDFParserOptions + +Options for PDF parsing. + +## Example Usage + +```typescript +import { PDFParserOptions } from "@openrouter/sdk/models"; + +let value: PDFParserOptions = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `engine` | [models.PDFParserEngine](../models/pdfparserengine.md) | :heavy_minus_sign: | The engine to use for parsing PDF files. | \ No newline at end of file diff --git a/docs/models/operations/createembeddingsprovider.md b/docs/models/providerpreferences.md similarity index 81% rename from docs/models/operations/createembeddingsprovider.md rename to docs/models/providerpreferences.md index 0f825978..ef7cdab2 100644 --- a/docs/models/operations/createembeddingsprovider.md +++ b/docs/models/providerpreferences.md @@ -1,11 +1,13 @@ -# CreateEmbeddingsProvider +# ProviderPreferences + +Provider routing preferences for the request. ## Example Usage ```typescript -import { CreateEmbeddingsProvider } from "@openrouter/sdk/models/operations"; +import { ProviderPreferences } from "@openrouter/sdk/models"; -let value: CreateEmbeddingsProvider = {}; +let value: ProviderPreferences = {}; ``` ## Fields @@ -14,14 +16,16 @@ let value: CreateEmbeddingsProvider = {}; | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `allowFallbacks` | *boolean* | :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.
| | | `requireParameters` | *boolean* | :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. | | -| `dataCollection` | [models.DataCollection](../../models/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 | +| `dataCollection` | [models.DataCollection](../models/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` | *boolean* | :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 | | `enforceDistillableText` | *boolean* | :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` | *operations.Order*[] | :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` | *operations.Only*[] | :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` | *operations.Ignore*[] | :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` | [models.Quantization](../../models/quantization.md)[] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | -| `sort` | [models.ProviderSort](../../models/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 | -| `maxPrice` | [operations.MaxPrice](../../models/operations/maxprice.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. | | -| `minThroughput` | *number* | :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 | -| `maxLatency` | *number* | :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 +| `order` | *models.ProviderPreferencesOrder*[] | :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` | *models.ProviderPreferencesOnly*[] | :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` | *models.ProviderPreferencesIgnore*[] | :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` | [models.Quantization](../models/quantization.md)[] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | +| `sort` | *models.ProviderPreferencesSortUnion* | :heavy_minus_sign: | N/A | | +| `maxPrice` | [models.ProviderPreferencesMaxPrice](../models/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. | | +| `preferredMinThroughput` | *number* | :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 | +| `preferredMaxLatency` | *number* | :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 | +| ~~`minThroughput`~~ | *number* | :heavy_minus_sign: | : warning: ** DEPRECATED **: Use preferred_min_throughput instead..

**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. | 100 | +| ~~`maxLatency`~~ | *number* | :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/models/providerpreferencesignore.md b/docs/models/providerpreferencesignore.md new file mode 100644 index 00000000..d14a7d5e --- /dev/null +++ b/docs/models/providerpreferencesignore.md @@ -0,0 +1,17 @@ +# ProviderPreferencesIgnore + + +## Supported Types + +### `models.ProviderName` + +```typescript +const value: models.ProviderName = "OpenAI"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/operations/maxprice.md b/docs/models/providerpreferencesmaxprice.md similarity index 93% rename from docs/models/operations/maxprice.md rename to docs/models/providerpreferencesmaxprice.md index be877823..916e6975 100644 --- a/docs/models/operations/maxprice.md +++ b/docs/models/providerpreferencesmaxprice.md @@ -1,13 +1,13 @@ -# MaxPrice +# ProviderPreferencesMaxPrice The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. ## Example Usage ```typescript -import { MaxPrice } from "@openrouter/sdk/models/operations"; +import { ProviderPreferencesMaxPrice } from "@openrouter/sdk/models"; -let value: MaxPrice = {}; +let value: ProviderPreferencesMaxPrice = {}; ``` ## Fields diff --git a/docs/models/operations/ignore.md b/docs/models/providerpreferencesonly.md similarity index 87% rename from docs/models/operations/ignore.md rename to docs/models/providerpreferencesonly.md index de9c31d0..9240a5ee 100644 --- a/docs/models/operations/ignore.md +++ b/docs/models/providerpreferencesonly.md @@ -1,4 +1,4 @@ -# Ignore +# ProviderPreferencesOnly ## Supported Types diff --git a/docs/models/only.md b/docs/models/providerpreferencesorder.md similarity index 86% rename from docs/models/only.md rename to docs/models/providerpreferencesorder.md index c4202205..0937f38f 100644 --- a/docs/models/only.md +++ b/docs/models/providerpreferencesorder.md @@ -1,4 +1,4 @@ -# Only +# ProviderPreferencesOrder ## Supported Types diff --git a/docs/models/providerpreferencespartition.md b/docs/models/providerpreferencespartition.md new file mode 100644 index 00000000..b47e3e07 --- /dev/null +++ b/docs/models/providerpreferencespartition.md @@ -0,0 +1,17 @@ +# ProviderPreferencesPartition + +## Example Usage + +```typescript +import { ProviderPreferencesPartition } from "@openrouter/sdk/models"; + +let value: ProviderPreferencesPartition = "model"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"model" | "none" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/providerpreferencesprovidersort.md b/docs/models/providerpreferencesprovidersort.md new file mode 100644 index 00000000..cc1cd8a3 --- /dev/null +++ b/docs/models/providerpreferencesprovidersort.md @@ -0,0 +1,17 @@ +# ProviderPreferencesProviderSort + +## Example Usage + +```typescript +import { ProviderPreferencesProviderSort } from "@openrouter/sdk/models"; + +let value: ProviderPreferencesProviderSort = "latency"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"price" | "throughput" | "latency" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/providerpreferencesprovidersortconfig.md b/docs/models/providerpreferencesprovidersortconfig.md new file mode 100644 index 00000000..8387bc41 --- /dev/null +++ b/docs/models/providerpreferencesprovidersortconfig.md @@ -0,0 +1,16 @@ +# ProviderPreferencesProviderSortConfig + +## Example Usage + +```typescript +import { ProviderPreferencesProviderSortConfig } from "@openrouter/sdk/models"; + +let value: ProviderPreferencesProviderSortConfig = {}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `by` | [models.ProviderSort](../models/providersort.md) | :heavy_minus_sign: | N/A | price | +| `partition` | [models.ProviderPreferencesPartition](../models/providerpreferencespartition.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/providerpreferencessortunion.md b/docs/models/providerpreferencessortunion.md new file mode 100644 index 00000000..e75e3fd7 --- /dev/null +++ b/docs/models/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 + +### `models.ProviderPreferencesProviderSort` + +```typescript +const value: models.ProviderPreferencesProviderSort = "throughput"; +``` + +### `models.ProviderSortConfigUnion` + +```typescript +const value: models.ProviderSortConfigUnion = "latency"; +``` + +### `models.SortEnum` + +```typescript +const value: models.SortEnum = "throughput"; +``` + diff --git a/docs/models/providersort.md b/docs/models/providersort.md index ff5658b5..c4f9aa4a 100644 --- a/docs/models/providersort.md +++ b/docs/models/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. - ## Example Usage ```typescript diff --git a/docs/models/providersortconfig.md b/docs/models/providersortconfig.md new file mode 100644 index 00000000..217c157d --- /dev/null +++ b/docs/models/providersortconfig.md @@ -0,0 +1,16 @@ +# ProviderSortConfig + +## Example Usage + +```typescript +import { ProviderSortConfig } from "@openrouter/sdk/models"; + +let value: ProviderSortConfig = {}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `by` | [models.ProviderSort](../models/providersort.md) | :heavy_minus_sign: | N/A | price | +| `partition` | [models.Partition](../models/partition.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/providersortconfigenum.md b/docs/models/providersortconfigenum.md new file mode 100644 index 00000000..61ad06a2 --- /dev/null +++ b/docs/models/providersortconfigenum.md @@ -0,0 +1,15 @@ +# ProviderSortConfigEnum + +## Example Usage + +```typescript +import { ProviderSortConfigEnum } from "@openrouter/sdk/models"; + +let value: ProviderSortConfigEnum = "throughput"; +``` + +## Values + +```typescript +"price" | "throughput" | "latency" +``` \ No newline at end of file diff --git a/docs/models/providersortconfigunion.md b/docs/models/providersortconfigunion.md new file mode 100644 index 00000000..bcd482db --- /dev/null +++ b/docs/models/providersortconfigunion.md @@ -0,0 +1,17 @@ +# ProviderSortConfigUnion + + +## Supported Types + +### `models.ProviderPreferencesProviderSortConfig` + +```typescript +const value: models.ProviderPreferencesProviderSortConfig = {}; +``` + +### `models.ProviderSortConfigEnum` + +```typescript +const value: models.ProviderSortConfigEnum = "throughput"; +``` + diff --git a/docs/models/providersortunion.md b/docs/models/providersortunion.md new file mode 100644 index 00000000..1a6cae19 --- /dev/null +++ b/docs/models/providersortunion.md @@ -0,0 +1,17 @@ +# ProviderSortUnion + + +## Supported Types + +### `models.ProviderSort` + +```typescript +const value: models.ProviderSort = "price"; +``` + +### `models.ProviderSortConfig` + +```typescript +const value: models.ProviderSortConfig = {}; +``` + diff --git a/docs/models/chatgenerationparamsroute.md b/docs/models/route.md similarity index 59% rename from docs/models/chatgenerationparamsroute.md rename to docs/models/route.md index c6db54d1..5f434fff 100644 --- a/docs/models/chatgenerationparamsroute.md +++ b/docs/models/route.md @@ -1,11 +1,11 @@ -# ChatGenerationParamsRoute +# Route ## Example Usage ```typescript -import { ChatGenerationParamsRoute } from "@openrouter/sdk/models"; +import { Route } from "@openrouter/sdk/models"; -let value: ChatGenerationParamsRoute = "sort"; +let value: Route = "fallback"; ``` ## Values diff --git a/docs/models/schema3.md b/docs/models/schema3.md new file mode 100644 index 00000000..36adb6c1 --- /dev/null +++ b/docs/models/schema3.md @@ -0,0 +1,31 @@ +# Schema3 + + +## Supported Types + +### `models.Schema3ReasoningSummary` + +```typescript +const value: models.Schema3ReasoningSummary = { + type: "reasoning.summary", + summary: "", +}; +``` + +### `models.Schema3ReasoningEncrypted` + +```typescript +const value: models.Schema3ReasoningEncrypted = { + type: "reasoning.encrypted", + data: "", +}; +``` + +### `models.Schema3ReasoningText` + +```typescript +const value: models.Schema3ReasoningText = { + type: "reasoning.text", +}; +``` + diff --git a/docs/models/schema3reasoningencrypted.md b/docs/models/schema3reasoningencrypted.md new file mode 100644 index 00000000..c3b20ccc --- /dev/null +++ b/docs/models/schema3reasoningencrypted.md @@ -0,0 +1,22 @@ +# Schema3ReasoningEncrypted + +## Example Usage + +```typescript +import { Schema3ReasoningEncrypted } from "@openrouter/sdk/models"; + +let value: Schema3ReasoningEncrypted = { + type: "reasoning.encrypted", + data: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | +| `type` | *"reasoning.encrypted"* | :heavy_check_mark: | N/A | +| `data` | *string* | :heavy_check_mark: | N/A | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `format` | [models.Schema5](../models/schema5.md) | :heavy_minus_sign: | N/A | +| `index` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/schema3reasoningsummary.md b/docs/models/schema3reasoningsummary.md new file mode 100644 index 00000000..33cd68c6 --- /dev/null +++ b/docs/models/schema3reasoningsummary.md @@ -0,0 +1,22 @@ +# Schema3ReasoningSummary + +## Example Usage + +```typescript +import { Schema3ReasoningSummary } from "@openrouter/sdk/models"; + +let value: Schema3ReasoningSummary = { + type: "reasoning.summary", + summary: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | +| `type` | *"reasoning.summary"* | :heavy_check_mark: | N/A | +| `summary` | *string* | :heavy_check_mark: | N/A | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `format` | [models.Schema5](../models/schema5.md) | :heavy_minus_sign: | N/A | +| `index` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/schema3reasoningtext.md b/docs/models/schema3reasoningtext.md new file mode 100644 index 00000000..b5190d09 --- /dev/null +++ b/docs/models/schema3reasoningtext.md @@ -0,0 +1,22 @@ +# Schema3ReasoningText + +## Example Usage + +```typescript +import { Schema3ReasoningText } from "@openrouter/sdk/models"; + +let value: Schema3ReasoningText = { + type: "reasoning.text", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | +| `type` | *"reasoning.text"* | :heavy_check_mark: | N/A | +| `text` | *string* | :heavy_minus_sign: | N/A | +| `signature` | *string* | :heavy_minus_sign: | N/A | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `format` | [models.Schema5](../models/schema5.md) | :heavy_minus_sign: | N/A | +| `index` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/schema5.md b/docs/models/schema5.md new file mode 100644 index 00000000..fc01ed81 --- /dev/null +++ b/docs/models/schema5.md @@ -0,0 +1,17 @@ +# Schema5 + +## Example Usage + +```typescript +import { Schema5 } from "@openrouter/sdk/models"; + +let value: Schema5 = "google-gemini-v1"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"unknown" | "openai-responses-v1" | "xai-responses-v1" | "anthropic-claude-v1" | "google-gemini-v1" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/sort.md b/docs/models/sortenum.md similarity index 70% rename from docs/models/sort.md rename to docs/models/sortenum.md index 73fb6fa3..ecee27db 100644 --- a/docs/models/sort.md +++ b/docs/models/sortenum.md @@ -1,11 +1,11 @@ -# Sort +# SortEnum ## Example Usage ```typescript -import { Sort } from "@openrouter/sdk/models"; +import { SortEnum } from "@openrouter/sdk/models"; -let value: Sort = "throughput"; +let value: SortEnum = "throughput"; ``` ## Values diff --git a/docs/models/openresponsesrequestengine.md b/docs/models/websearchengine.md similarity index 57% rename from docs/models/openresponsesrequestengine.md rename to docs/models/websearchengine.md index 7e49a7e0..d1e25e50 100644 --- a/docs/models/openresponsesrequestengine.md +++ b/docs/models/websearchengine.md @@ -1,11 +1,13 @@ -# OpenResponsesRequestEngine +# WebSearchEngine + +The search engine to use for web search. ## Example Usage ```typescript -import { OpenResponsesRequestEngine } from "@openrouter/sdk/models"; +import { WebSearchEngine } from "@openrouter/sdk/models"; -let value: OpenResponsesRequestEngine = "native"; +let value: WebSearchEngine = "native"; ``` ## Values diff --git a/jsr.json b/jsr.json index 12698201..cc849ab0 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@openrouter/sdk", - "version": "0.2.11", + "version": "0.3.1", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index 8e1152aa..b765ee3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/sdk", - "version": "0.2.11", + "version": "0.3.1", "author": "OpenRouter", "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.", "keywords": [ diff --git a/src/lib/config.ts b/src/lib/config.ts index 4465a07f..a67b19f1 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -69,7 +69,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "1.0.0", - sdkVersion: "0.2.11", + sdkVersion: "0.3.1", genVersion: "2.768.0", - userAgent: "speakeasy-sdk/typescript 0.2.11 2.768.0 1.0.0 @openrouter/sdk", + userAgent: "speakeasy-sdk/typescript 0.3.1 2.768.0 1.0.0 @openrouter/sdk", } as const; diff --git a/src/models/chatgenerationparams.ts b/src/models/chatgenerationparams.ts index 5c13ea9f..b9660761 100644 --- a/src/models/chatgenerationparams.ts +++ b/src/models/chatgenerationparams.ts @@ -16,6 +16,11 @@ import { Message$Outbound, Message$outboundSchema, } from "./message.js"; +import { + ProviderSortUnion, + ProviderSortUnion$Outbound, + ProviderSortUnion$outboundSchema, +} from "./providersortunion.js"; import { ReasoningSummaryVerbosity, ReasoningSummaryVerbosity$outboundSchema, @@ -62,13 +67,6 @@ export const Quantizations = { } as const; export type Quantizations = OpenEnum; -export const Sort = { - Price: "price", - Throughput: "throughput", - Latency: "latency", -} as const; -export type Sort = OpenEnum; - /** * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. */ @@ -123,18 +121,14 @@ export type ChatGenerationParamsProvider = { /** * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. */ - sort?: Sort | null | undefined; + sort?: ProviderSortUnion | null | undefined; /** * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. */ maxPrice?: ChatGenerationParamsMaxPrice | undefined; - /** - * The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. - */ + preferredMinThroughput?: number | null | undefined; + preferredMaxLatency?: number | null | undefined; minThroughput?: number | null | undefined; - /** - * The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. - */ maxLatency?: number | null | undefined; }; @@ -143,40 +137,35 @@ export type ChatGenerationParamsPluginResponseHealing = { enabled?: boolean | undefined; }; -export const ChatGenerationParamsPdfEngine = { +export const PdfEngine = { MistralOcr: "mistral-ocr", PdfText: "pdf-text", Native: "native", } as const; -export type ChatGenerationParamsPdfEngine = OpenEnum< - typeof ChatGenerationParamsPdfEngine ->; +export type PdfEngine = OpenEnum; -export type ChatGenerationParamsPdf = { - engine?: ChatGenerationParamsPdfEngine | undefined; +export type Pdf = { + engine?: PdfEngine | undefined; }; export type ChatGenerationParamsPluginFileParser = { id: "file-parser"; enabled?: boolean | undefined; - maxFiles?: number | undefined; - pdf?: ChatGenerationParamsPdf | undefined; + pdf?: Pdf | undefined; }; -export const ChatGenerationParamsEngine = { +export const Engine = { Native: "native", Exa: "exa", } as const; -export type ChatGenerationParamsEngine = OpenEnum< - typeof ChatGenerationParamsEngine ->; +export type Engine = OpenEnum; export type ChatGenerationParamsPluginWeb = { id: "web"; enabled?: boolean | undefined; maxResults?: number | undefined; searchPrompt?: string | undefined; - engine?: ChatGenerationParamsEngine | undefined; + engine?: Engine | undefined; }; export type ChatGenerationParamsPluginModeration = { @@ -189,21 +178,19 @@ export type ChatGenerationParamsPluginUnion = | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing; -export const ChatGenerationParamsRoute = { +export const Route = { Fallback: "fallback", Sort: "sort", } as const; -export type ChatGenerationParamsRoute = OpenEnum< - typeof ChatGenerationParamsRoute ->; +export type Route = OpenEnum; export const Effort = { - None: "none", - Minimal: "minimal", - Low: "low", - Medium: "medium", - High: "high", Xhigh: "xhigh", + High: "high", + Medium: "medium", + Low: "low", + Minimal: "minimal", + None: "none", } as const; export type Effort = OpenEnum; @@ -253,10 +240,7 @@ export type ChatGenerationParams = { | ChatGenerationParamsPluginResponseHealing > | undefined; - /** - * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. - */ - route?: ChatGenerationParamsRoute | null | undefined; + route?: Route | null | undefined; user?: string | undefined; /** * 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. @@ -302,10 +286,6 @@ export const ChatGenerationParamsDataCollection$outboundSchema: z.ZodType< export const Quantizations$outboundSchema: z.ZodType = openEnums.outboundSchema(Quantizations); -/** @internal */ -export const Sort$outboundSchema: z.ZodType = openEnums - .outboundSchema(Sort); - /** @internal */ export type ChatGenerationParamsMaxPrice$Outbound = { prompt?: any | undefined; @@ -348,8 +328,10 @@ export type ChatGenerationParamsProvider$Outbound = { only?: Array | null | undefined; ignore?: Array | null | undefined; quantizations?: Array | null | undefined; - sort?: string | null | undefined; + sort?: ProviderSortUnion$Outbound | null | undefined; max_price?: ChatGenerationParamsMaxPrice$Outbound | undefined; + preferred_min_throughput?: number | null | undefined; + preferred_max_latency?: number | null | undefined; min_throughput?: number | null | undefined; max_latency?: number | null | undefined; }; @@ -369,9 +351,11 @@ export const ChatGenerationParamsProvider$outboundSchema: z.ZodType< only: z.nullable(z.array(Schema0$outboundSchema)).optional(), ignore: z.nullable(z.array(Schema0$outboundSchema)).optional(), quantizations: z.nullable(z.array(Quantizations$outboundSchema)).optional(), - sort: z.nullable(Sort$outboundSchema).optional(), + sort: z.nullable(ProviderSortUnion$outboundSchema).optional(), maxPrice: z.lazy(() => ChatGenerationParamsMaxPrice$outboundSchema) .optional(), + preferredMinThroughput: z.nullable(z.number()).optional(), + preferredMaxLatency: z.nullable(z.number()).optional(), minThroughput: z.nullable(z.number()).optional(), maxLatency: z.nullable(z.number()).optional(), }).transform((v) => { @@ -381,6 +365,8 @@ export const ChatGenerationParamsProvider$outboundSchema: z.ZodType< dataCollection: "data_collection", enforceDistillableText: "enforce_distillable_text", maxPrice: "max_price", + preferredMinThroughput: "preferred_min_throughput", + preferredMaxLatency: "preferred_max_latency", minThroughput: "min_throughput", maxLatency: "max_latency", }); @@ -424,38 +410,28 @@ export function chatGenerationParamsPluginResponseHealingToJSON( } /** @internal */ -export const ChatGenerationParamsPdfEngine$outboundSchema: z.ZodType< - string, - ChatGenerationParamsPdfEngine -> = openEnums.outboundSchema(ChatGenerationParamsPdfEngine); +export const PdfEngine$outboundSchema: z.ZodType = openEnums + .outboundSchema(PdfEngine); /** @internal */ -export type ChatGenerationParamsPdf$Outbound = { +export type Pdf$Outbound = { engine?: string | undefined; }; /** @internal */ -export const ChatGenerationParamsPdf$outboundSchema: z.ZodType< - ChatGenerationParamsPdf$Outbound, - ChatGenerationParamsPdf -> = z.object({ - engine: ChatGenerationParamsPdfEngine$outboundSchema.optional(), +export const Pdf$outboundSchema: z.ZodType = z.object({ + engine: PdfEngine$outboundSchema.optional(), }); -export function chatGenerationParamsPdfToJSON( - chatGenerationParamsPdf: ChatGenerationParamsPdf, -): string { - return JSON.stringify( - ChatGenerationParamsPdf$outboundSchema.parse(chatGenerationParamsPdf), - ); +export function pdfToJSON(pdf: Pdf): string { + return JSON.stringify(Pdf$outboundSchema.parse(pdf)); } /** @internal */ export type ChatGenerationParamsPluginFileParser$Outbound = { id: "file-parser"; enabled?: boolean | undefined; - max_files?: number | undefined; - pdf?: ChatGenerationParamsPdf$Outbound | undefined; + pdf?: Pdf$Outbound | undefined; }; /** @internal */ @@ -465,12 +441,7 @@ export const ChatGenerationParamsPluginFileParser$outboundSchema: z.ZodType< > = z.object({ id: z.literal("file-parser"), enabled: z.boolean().optional(), - maxFiles: z.number().optional(), - pdf: z.lazy(() => ChatGenerationParamsPdf$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - maxFiles: "max_files", - }); + pdf: z.lazy(() => Pdf$outboundSchema).optional(), }); export function chatGenerationParamsPluginFileParserToJSON( @@ -484,10 +455,8 @@ export function chatGenerationParamsPluginFileParserToJSON( } /** @internal */ -export const ChatGenerationParamsEngine$outboundSchema: z.ZodType< - string, - ChatGenerationParamsEngine -> = openEnums.outboundSchema(ChatGenerationParamsEngine); +export const Engine$outboundSchema: z.ZodType = openEnums + .outboundSchema(Engine); /** @internal */ export type ChatGenerationParamsPluginWeb$Outbound = { @@ -507,7 +476,7 @@ export const ChatGenerationParamsPluginWeb$outboundSchema: z.ZodType< enabled: z.boolean().optional(), maxResults: z.number().optional(), searchPrompt: z.string().optional(), - engine: ChatGenerationParamsEngine$outboundSchema.optional(), + engine: Engine$outboundSchema.optional(), }).transform((v) => { return remap$(v, { maxResults: "max_results", @@ -577,10 +546,8 @@ export function chatGenerationParamsPluginUnionToJSON( } /** @internal */ -export const ChatGenerationParamsRoute$outboundSchema: z.ZodType< - string, - ChatGenerationParamsRoute -> = openEnums.outboundSchema(ChatGenerationParamsRoute); +export const Route$outboundSchema: z.ZodType = openEnums + .outboundSchema(Route); /** @internal */ export const Effort$outboundSchema: z.ZodType = openEnums @@ -804,7 +771,7 @@ export const ChatGenerationParams$outboundSchema: z.ZodType< z.lazy(() => ChatGenerationParamsPluginResponseHealing$outboundSchema), ]), ).optional(), - route: z.nullable(ChatGenerationParamsRoute$outboundSchema).optional(), + route: z.nullable(Route$outboundSchema).optional(), user: z.string().optional(), sessionId: z.string().optional(), messages: z.array(Message$outboundSchema), diff --git a/src/models/chatresponsechoice.ts b/src/models/chatresponsechoice.ts index d48b6d72..047d5f3f 100644 --- a/src/models/chatresponsechoice.ts +++ b/src/models/chatresponsechoice.ts @@ -19,11 +19,13 @@ import { ChatMessageTokenLogprobs$inboundSchema, } from "./chatmessagetokenlogprobs.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; +import { Schema3, Schema3$inboundSchema } from "./schema3.js"; export type ChatResponseChoice = { finishReason: ChatCompletionFinishReason | null; index: number; message: AssistantMessage; + reasoningDetails?: Array | undefined; logprobs?: ChatMessageTokenLogprobs | null | undefined; }; @@ -35,10 +37,12 @@ export const ChatResponseChoice$inboundSchema: z.ZodType< finish_reason: z.nullable(ChatCompletionFinishReason$inboundSchema), index: z.number(), message: AssistantMessage$inboundSchema, + reasoning_details: z.array(Schema3$inboundSchema).optional(), logprobs: z.nullable(ChatMessageTokenLogprobs$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "finish_reason": "finishReason", + "reasoning_details": "reasoningDetails", }); }); diff --git a/src/models/chatstreamingmessagechunk.ts b/src/models/chatstreamingmessagechunk.ts index 8956b9d4..a1813c97 100644 --- a/src/models/chatstreamingmessagechunk.ts +++ b/src/models/chatstreamingmessagechunk.ts @@ -12,6 +12,7 @@ import { ChatStreamingMessageToolCall$inboundSchema, } from "./chatstreamingmessagetoolcall.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; +import { Schema3, Schema3$inboundSchema } from "./schema3.js"; export const ChatStreamingMessageChunkRole = { Assistant: "assistant", @@ -26,6 +27,7 @@ export type ChatStreamingMessageChunk = { reasoning?: string | null | undefined; refusal?: string | null | undefined; toolCalls?: Array | undefined; + reasoningDetails?: Array | undefined; }; /** @internal */ @@ -43,9 +45,11 @@ export const ChatStreamingMessageChunk$inboundSchema: z.ZodType< reasoning: z.nullable(z.string()).optional(), refusal: z.nullable(z.string()).optional(), tool_calls: z.array(ChatStreamingMessageToolCall$inboundSchema).optional(), + reasoning_details: z.array(Schema3$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "tool_calls": "toolCalls", + "reasoning_details": "reasoningDetails", }); }); diff --git a/src/models/index.ts b/src/models/index.ts index 43c69cc1..75a97006 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -99,10 +99,15 @@ export * from "./outputmodality.js"; export * from "./parameter.js"; export * from "./payloadtoolargeresponseerrordata.js"; export * from "./paymentrequiredresponseerrordata.js"; +export * from "./pdfparserengine.js"; +export * from "./pdfparseroptions.js"; export * from "./perrequestlimits.js"; export * from "./providername.js"; export * from "./provideroverloadedresponseerrordata.js"; +export * from "./providerpreferences.js"; export * from "./providersort.js"; +export * from "./providersortconfig.js"; +export * from "./providersortunion.js"; export * from "./publicendpoint.js"; export * from "./publicpricing.js"; export * from "./quantization.js"; @@ -133,6 +138,7 @@ export * from "./responseswebsearchcalloutput.js"; export * from "./responseswebsearchuserlocation.js"; export * from "./responsetextconfig.js"; export * from "./schema0.js"; +export * from "./schema3.js"; export * from "./security.js"; export * from "./serviceunavailableresponseerrordata.js"; export * from "./systemmessage.js"; @@ -145,5 +151,6 @@ export * from "./unauthorizedresponseerrordata.js"; export * from "./unprocessableentityresponseerrordata.js"; export * from "./urlcitation.js"; export * from "./usermessage.js"; +export * from "./websearchengine.js"; export * from "./websearchpreviewtooluserlocation.js"; export * from "./websearchstatus.js"; diff --git a/src/models/openresponsesrequest.ts b/src/models/openresponsesrequest.ts index 439ce04a..c53f8ce5 100644 --- a/src/models/openresponsesrequest.ts +++ b/src/models/openresponsesrequest.ts @@ -59,9 +59,23 @@ import { OpenResponsesWebSearchTool$Outbound, OpenResponsesWebSearchTool$outboundSchema, } from "./openresponseswebsearchtool.js"; +import { + PDFParserOptions, + PDFParserOptions$Outbound, + PDFParserOptions$outboundSchema, +} from "./pdfparseroptions.js"; import { ProviderName, ProviderName$outboundSchema } from "./providername.js"; import { ProviderSort, ProviderSort$outboundSchema } from "./providersort.js"; +import { + ProviderSortConfig, + ProviderSortConfig$Outbound, + ProviderSortConfig$outboundSchema, +} from "./providersortconfig.js"; import { Quantization, Quantization$outboundSchema } from "./quantization.js"; +import { + WebSearchEngine, + WebSearchEngine$outboundSchema, +} from "./websearchengine.js"; /** * Function tool definition @@ -92,11 +106,16 @@ export const Truncation = { } as const; export type Truncation = OpenEnum; -export type Order = ProviderName | string; +export type OpenResponsesRequestOrder = ProviderName | string; -export type Only = ProviderName | string; +export type OpenResponsesRequestOnly = ProviderName | string; -export type Ignore = ProviderName | string; +export type OpenResponsesRequestIgnore = ProviderName | string; + +/** + * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + */ +export type OpenResponsesRequestSort = ProviderSort | ProviderSortConfig | any; /** * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. @@ -176,17 +195,29 @@ export type OpenResponsesRequestProvider = { /** * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. */ - sort?: ProviderSort | null | undefined; + sort?: ProviderSort | ProviderSortConfig | any | null | undefined; /** * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. */ maxPrice?: OpenResponsesRequestMaxPrice | undefined; /** - * The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. + * Preferred minimum throughput (in tokens per second). 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. + */ + preferredMinThroughput?: number | null | undefined; + /** + * 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. + */ + preferredMaxLatency?: number | null | undefined; + /** + * **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. + * + * @deprecated field: Use preferred_min_throughput instead.. */ minThroughput?: number | null | undefined; /** - * The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. + * **DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency. + * + * @deprecated field: Use preferred_max_latency instead.. */ maxLatency?: number | null | undefined; }; @@ -199,37 +230,18 @@ export type OpenResponsesRequestPluginResponseHealing = { enabled?: boolean | undefined; }; -export const OpenResponsesRequestPdfEngine = { - MistralOcr: "mistral-ocr", - PdfText: "pdf-text", - Native: "native", -} as const; -export type OpenResponsesRequestPdfEngine = OpenEnum< - typeof OpenResponsesRequestPdfEngine ->; - -export type OpenResponsesRequestPdf = { - engine?: OpenResponsesRequestPdfEngine | undefined; -}; - export type OpenResponsesRequestPluginFileParser = { id: "file-parser"; /** * Set to false to disable the file-parser plugin for this request. Defaults to true. */ enabled?: boolean | undefined; - maxFiles?: number | undefined; - pdf?: OpenResponsesRequestPdf | undefined; + /** + * Options for PDF parsing. + */ + pdf?: PDFParserOptions | undefined; }; -export const OpenResponsesRequestEngine = { - Native: "native", - Exa: "exa", -} as const; -export type OpenResponsesRequestEngine = OpenEnum< - typeof OpenResponsesRequestEngine ->; - export type OpenResponsesRequestPluginWeb = { id: "web"; /** @@ -238,7 +250,10 @@ export type OpenResponsesRequestPluginWeb = { enabled?: boolean | undefined; maxResults?: number | undefined; searchPrompt?: string | undefined; - engine?: OpenResponsesRequestEngine | undefined; + /** + * The search engine to use for web search. + */ + engine?: WebSearchEngine | undefined; }; export type OpenResponsesRequestPluginModeration = { @@ -251,20 +266,6 @@ export type OpenResponsesRequestPluginUnion = | OpenResponsesRequestPluginFileParser | OpenResponsesRequestPluginResponseHealing; -/** - * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. - */ -export const OpenResponsesRequestRoute = { - Fallback: "fallback", - Sort: "sort", -} as const; -/** - * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. - */ -export type OpenResponsesRequestRoute = OpenEnum< - typeof OpenResponsesRequestRoute ->; - /** * Request schema for Responses endpoint */ @@ -328,10 +329,6 @@ export type OpenResponsesRequest = { | OpenResponsesRequestPluginResponseHealing > | undefined; - /** - * Routing strategy for multiple models: "fallback" (default) uses secondary models as backups, "sort" sorts all endpoints together by routing criteria. - */ - route?: OpenResponsesRequestRoute | null | undefined; /** * 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. */ @@ -413,40 +410,78 @@ export const Truncation$outboundSchema: z.ZodType = openEnums.outboundSchema(Truncation); /** @internal */ -export type Order$Outbound = string | string; +export type OpenResponsesRequestOrder$Outbound = string | string; /** @internal */ -export const Order$outboundSchema: z.ZodType = z.union([ - ProviderName$outboundSchema, - z.string(), -]); +export const OpenResponsesRequestOrder$outboundSchema: z.ZodType< + OpenResponsesRequestOrder$Outbound, + OpenResponsesRequestOrder +> = z.union([ProviderName$outboundSchema, z.string()]); -export function orderToJSON(order: Order): string { - return JSON.stringify(Order$outboundSchema.parse(order)); +export function openResponsesRequestOrderToJSON( + openResponsesRequestOrder: OpenResponsesRequestOrder, +): string { + return JSON.stringify( + OpenResponsesRequestOrder$outboundSchema.parse(openResponsesRequestOrder), + ); } /** @internal */ -export type Only$Outbound = string | string; +export type OpenResponsesRequestOnly$Outbound = string | string; /** @internal */ -export const Only$outboundSchema: z.ZodType = z.union([ - ProviderName$outboundSchema, - z.string(), -]); +export const OpenResponsesRequestOnly$outboundSchema: z.ZodType< + OpenResponsesRequestOnly$Outbound, + OpenResponsesRequestOnly +> = z.union([ProviderName$outboundSchema, z.string()]); -export function onlyToJSON(only: Only): string { - return JSON.stringify(Only$outboundSchema.parse(only)); +export function openResponsesRequestOnlyToJSON( + openResponsesRequestOnly: OpenResponsesRequestOnly, +): string { + return JSON.stringify( + OpenResponsesRequestOnly$outboundSchema.parse(openResponsesRequestOnly), + ); } /** @internal */ -export type Ignore$Outbound = string | string; +export type OpenResponsesRequestIgnore$Outbound = string | string; /** @internal */ -export const Ignore$outboundSchema: z.ZodType = z - .union([ProviderName$outboundSchema, z.string()]); +export const OpenResponsesRequestIgnore$outboundSchema: z.ZodType< + OpenResponsesRequestIgnore$Outbound, + OpenResponsesRequestIgnore +> = z.union([ProviderName$outboundSchema, z.string()]); -export function ignoreToJSON(ignore: Ignore): string { - return JSON.stringify(Ignore$outboundSchema.parse(ignore)); +export function openResponsesRequestIgnoreToJSON( + openResponsesRequestIgnore: OpenResponsesRequestIgnore, +): string { + return JSON.stringify( + OpenResponsesRequestIgnore$outboundSchema.parse(openResponsesRequestIgnore), + ); +} + +/** @internal */ +export type OpenResponsesRequestSort$Outbound = + | string + | ProviderSortConfig$Outbound + | any; + +/** @internal */ +export const OpenResponsesRequestSort$outboundSchema: z.ZodType< + OpenResponsesRequestSort$Outbound, + OpenResponsesRequestSort +> = z.union([ + ProviderSort$outboundSchema, + ProviderSortConfig$outboundSchema, + z.any(), +]); + +export function openResponsesRequestSortToJSON( + openResponsesRequestSort: OpenResponsesRequestSort, +): string { + return JSON.stringify( + OpenResponsesRequestSort$outboundSchema.parse(openResponsesRequestSort), + ); } /** @internal */ @@ -491,8 +526,10 @@ export type OpenResponsesRequestProvider$Outbound = { only?: Array | null | undefined; ignore?: Array | null | undefined; quantizations?: Array | null | undefined; - sort?: string | null | undefined; + sort?: string | ProviderSortConfig$Outbound | any | null | undefined; max_price?: OpenResponsesRequestMaxPrice$Outbound | undefined; + preferred_min_throughput?: number | null | undefined; + preferred_max_latency?: number | null | undefined; min_throughput?: number | null | undefined; max_latency?: number | null | undefined; }; @@ -515,9 +552,17 @@ export const OpenResponsesRequestProvider$outboundSchema: z.ZodType< z.array(z.union([ProviderName$outboundSchema, z.string()])), ).optional(), quantizations: z.nullable(z.array(Quantization$outboundSchema)).optional(), - sort: z.nullable(ProviderSort$outboundSchema).optional(), + sort: z.nullable( + z.union([ + ProviderSort$outboundSchema, + ProviderSortConfig$outboundSchema, + z.any(), + ]), + ).optional(), maxPrice: z.lazy(() => OpenResponsesRequestMaxPrice$outboundSchema) .optional(), + preferredMinThroughput: z.nullable(z.number()).optional(), + preferredMaxLatency: z.nullable(z.number()).optional(), minThroughput: z.nullable(z.number()).optional(), maxLatency: z.nullable(z.number()).optional(), }).transform((v) => { @@ -527,6 +572,8 @@ export const OpenResponsesRequestProvider$outboundSchema: z.ZodType< dataCollection: "data_collection", enforceDistillableText: "enforce_distillable_text", maxPrice: "max_price", + preferredMinThroughput: "preferred_min_throughput", + preferredMaxLatency: "preferred_max_latency", minThroughput: "min_throughput", maxLatency: "max_latency", }); @@ -569,39 +616,11 @@ export function openResponsesRequestPluginResponseHealingToJSON( ); } -/** @internal */ -export const OpenResponsesRequestPdfEngine$outboundSchema: z.ZodType< - string, - OpenResponsesRequestPdfEngine -> = openEnums.outboundSchema(OpenResponsesRequestPdfEngine); - -/** @internal */ -export type OpenResponsesRequestPdf$Outbound = { - engine?: string | undefined; -}; - -/** @internal */ -export const OpenResponsesRequestPdf$outboundSchema: z.ZodType< - OpenResponsesRequestPdf$Outbound, - OpenResponsesRequestPdf -> = z.object({ - engine: OpenResponsesRequestPdfEngine$outboundSchema.optional(), -}); - -export function openResponsesRequestPdfToJSON( - openResponsesRequestPdf: OpenResponsesRequestPdf, -): string { - return JSON.stringify( - OpenResponsesRequestPdf$outboundSchema.parse(openResponsesRequestPdf), - ); -} - /** @internal */ export type OpenResponsesRequestPluginFileParser$Outbound = { id: "file-parser"; enabled?: boolean | undefined; - max_files?: number | undefined; - pdf?: OpenResponsesRequestPdf$Outbound | undefined; + pdf?: PDFParserOptions$Outbound | undefined; }; /** @internal */ @@ -611,12 +630,7 @@ export const OpenResponsesRequestPluginFileParser$outboundSchema: z.ZodType< > = z.object({ id: z.literal("file-parser"), enabled: z.boolean().optional(), - maxFiles: z.number().optional(), - pdf: z.lazy(() => OpenResponsesRequestPdf$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - maxFiles: "max_files", - }); + pdf: PDFParserOptions$outboundSchema.optional(), }); export function openResponsesRequestPluginFileParserToJSON( @@ -629,12 +643,6 @@ export function openResponsesRequestPluginFileParserToJSON( ); } -/** @internal */ -export const OpenResponsesRequestEngine$outboundSchema: z.ZodType< - string, - OpenResponsesRequestEngine -> = openEnums.outboundSchema(OpenResponsesRequestEngine); - /** @internal */ export type OpenResponsesRequestPluginWeb$Outbound = { id: "web"; @@ -653,7 +661,7 @@ export const OpenResponsesRequestPluginWeb$outboundSchema: z.ZodType< enabled: z.boolean().optional(), maxResults: z.number().optional(), searchPrompt: z.string().optional(), - engine: OpenResponsesRequestEngine$outboundSchema.optional(), + engine: WebSearchEngine$outboundSchema.optional(), }).transform((v) => { return remap$(v, { maxResults: "max_results", @@ -722,12 +730,6 @@ export function openResponsesRequestPluginUnionToJSON( ); } -/** @internal */ -export const OpenResponsesRequestRoute$outboundSchema: z.ZodType< - string, - OpenResponsesRequestRoute -> = openEnums.outboundSchema(OpenResponsesRequestRoute); - /** @internal */ export type OpenResponsesRequest$Outbound = { input?: OpenResponsesInput$Outbound | undefined; @@ -771,7 +773,6 @@ export type OpenResponsesRequest$Outbound = { | OpenResponsesRequestPluginResponseHealing$Outbound > | undefined; - route?: string | null | undefined; user?: string | undefined; session_id?: string | undefined; }; @@ -825,7 +826,6 @@ export const OpenResponsesRequest$outboundSchema: z.ZodType< z.lazy(() => OpenResponsesRequestPluginResponseHealing$outboundSchema), ]), ).optional(), - route: z.nullable(OpenResponsesRequestRoute$outboundSchema).optional(), user: z.string().optional(), sessionId: z.string().optional(), }).transform((v) => { diff --git a/src/models/operations/createembeddings.ts b/src/models/operations/createembeddings.ts index 6075f50d..ceb5e6bf 100644 --- a/src/models/operations/createembeddings.ts +++ b/src/models/operations/createembeddings.ts @@ -44,102 +44,6 @@ export const EncodingFormat = { } as const; export type EncodingFormat = OpenEnum; -export type Order = models.ProviderName | string; - -export type Only = models.ProviderName | string; - -export type Ignore = models.ProviderName | string; - -/** - * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - */ -export type MaxPrice = { - /** - * A value in string format that is a large number - */ - prompt?: string | undefined; - /** - * A value in string format that is a large number - */ - completion?: string | undefined; - /** - * A value in string format that is a large number - */ - image?: string | undefined; - /** - * A value in string format that is a large number - */ - audio?: string | undefined; - /** - * A value in string format that is a large number - */ - request?: string | undefined; -}; - -export type CreateEmbeddingsProvider = { - /** - * Whether to allow backup providers to serve requests - * - * @remarks - * - 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. - */ - allowFallbacks?: boolean | null | undefined; - /** - * 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. - */ - requireParameters?: boolean | null | undefined; - /** - * Data collection setting. If no available model provider meets the requirement, your request will return an error. - * - * @remarks - * - 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. - */ - dataCollection?: models.DataCollection | null | undefined; - /** - * Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. - */ - zdr?: boolean | null | undefined; - /** - * Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. - */ - enforceDistillableText?: boolean | null | undefined; - /** - * 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. - */ - order?: Array | null | undefined; - /** - * List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. - */ - only?: Array | null | undefined; - /** - * List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. - */ - ignore?: Array | null | undefined; - /** - * A list of quantization levels to filter the provider by. - */ - quantizations?: Array | null | undefined; - /** - * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - */ - sort?: models.ProviderSort | null | undefined; - /** - * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - */ - maxPrice?: MaxPrice | undefined; - /** - * The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used. - */ - minThroughput?: number | null | undefined; - /** - * The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used. - */ - maxLatency?: number | null | undefined; -}; - export type CreateEmbeddingsRequest = { input: | string @@ -151,7 +55,10 @@ export type CreateEmbeddingsRequest = { encodingFormat?: EncodingFormat | undefined; dimensions?: number | undefined; user?: string | undefined; - provider?: CreateEmbeddingsProvider | undefined; + /** + * Provider routing preferences for the request. + */ + provider?: models.ProviderPreferences | undefined; inputType?: string | undefined; }; @@ -312,128 +219,6 @@ export function inputUnionToJSON(inputUnion: InputUnion): string { export const EncodingFormat$outboundSchema: z.ZodType = openEnums.outboundSchema(EncodingFormat); -/** @internal */ -export type Order$Outbound = string | string; - -/** @internal */ -export const Order$outboundSchema: z.ZodType = z.union([ - models.ProviderName$outboundSchema, - z.string(), -]); - -export function orderToJSON(order: Order): string { - return JSON.stringify(Order$outboundSchema.parse(order)); -} - -/** @internal */ -export type Only$Outbound = string | string; - -/** @internal */ -export const Only$outboundSchema: z.ZodType = z.union([ - models.ProviderName$outboundSchema, - z.string(), -]); - -export function onlyToJSON(only: Only): string { - return JSON.stringify(Only$outboundSchema.parse(only)); -} - -/** @internal */ -export type Ignore$Outbound = string | string; - -/** @internal */ -export const Ignore$outboundSchema: z.ZodType = z - .union([models.ProviderName$outboundSchema, z.string()]); - -export function ignoreToJSON(ignore: Ignore): string { - return JSON.stringify(Ignore$outboundSchema.parse(ignore)); -} - -/** @internal */ -export type MaxPrice$Outbound = { - prompt?: string | undefined; - completion?: string | undefined; - image?: string | undefined; - audio?: string | undefined; - request?: string | undefined; -}; - -/** @internal */ -export const MaxPrice$outboundSchema: z.ZodType = z - .object({ - prompt: z.string().optional(), - completion: z.string().optional(), - image: z.string().optional(), - audio: z.string().optional(), - request: z.string().optional(), - }); - -export function maxPriceToJSON(maxPrice: MaxPrice): string { - return JSON.stringify(MaxPrice$outboundSchema.parse(maxPrice)); -} - -/** @internal */ -export type CreateEmbeddingsProvider$Outbound = { - allow_fallbacks?: boolean | null | undefined; - require_parameters?: boolean | null | undefined; - data_collection?: string | null | undefined; - zdr?: boolean | null | undefined; - enforce_distillable_text?: boolean | null | undefined; - order?: Array | null | undefined; - only?: Array | null | undefined; - ignore?: Array | null | undefined; - quantizations?: Array | null | undefined; - sort?: string | null | undefined; - max_price?: MaxPrice$Outbound | undefined; - min_throughput?: number | null | undefined; - max_latency?: number | null | undefined; -}; - -/** @internal */ -export const CreateEmbeddingsProvider$outboundSchema: z.ZodType< - CreateEmbeddingsProvider$Outbound, - CreateEmbeddingsProvider -> = z.object({ - allowFallbacks: z.nullable(z.boolean()).optional(), - requireParameters: z.nullable(z.boolean()).optional(), - dataCollection: z.nullable(models.DataCollection$outboundSchema).optional(), - zdr: z.nullable(z.boolean()).optional(), - enforceDistillableText: z.nullable(z.boolean()).optional(), - order: z.nullable( - z.array(z.union([models.ProviderName$outboundSchema, z.string()])), - ).optional(), - only: z.nullable( - z.array(z.union([models.ProviderName$outboundSchema, z.string()])), - ).optional(), - ignore: z.nullable( - z.array(z.union([models.ProviderName$outboundSchema, z.string()])), - ).optional(), - quantizations: z.nullable(z.array(models.Quantization$outboundSchema)) - .optional(), - sort: z.nullable(models.ProviderSort$outboundSchema).optional(), - maxPrice: z.lazy(() => MaxPrice$outboundSchema).optional(), - minThroughput: z.nullable(z.number()).optional(), - maxLatency: z.nullable(z.number()).optional(), -}).transform((v) => { - return remap$(v, { - allowFallbacks: "allow_fallbacks", - requireParameters: "require_parameters", - dataCollection: "data_collection", - enforceDistillableText: "enforce_distillable_text", - maxPrice: "max_price", - minThroughput: "min_throughput", - maxLatency: "max_latency", - }); -}); - -export function createEmbeddingsProviderToJSON( - createEmbeddingsProvider: CreateEmbeddingsProvider, -): string { - return JSON.stringify( - CreateEmbeddingsProvider$outboundSchema.parse(createEmbeddingsProvider), - ); -} - /** @internal */ export type CreateEmbeddingsRequest$Outbound = { input: @@ -446,7 +231,7 @@ export type CreateEmbeddingsRequest$Outbound = { encoding_format?: string | undefined; dimensions?: number | undefined; user?: string | undefined; - provider?: CreateEmbeddingsProvider$Outbound | undefined; + provider?: models.ProviderPreferences$Outbound | undefined; input_type?: string | undefined; }; @@ -466,7 +251,7 @@ export const CreateEmbeddingsRequest$outboundSchema: z.ZodType< encodingFormat: EncodingFormat$outboundSchema.optional(), dimensions: z.int().optional(), user: z.string().optional(), - provider: z.lazy(() => CreateEmbeddingsProvider$outboundSchema).optional(), + provider: models.ProviderPreferences$outboundSchema.optional(), inputType: z.string().optional(), }).transform((v) => { return remap$(v, { diff --git a/src/models/operations/getparameters.ts b/src/models/operations/getparameters.ts index 63268d09..4a987678 100644 --- a/src/models/operations/getparameters.ts +++ b/src/models/operations/getparameters.ts @@ -9,88 +9,16 @@ import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import * as models from "../index.js"; export type GetParametersSecurity = { bearer: string; }; -export const GetParametersProvider = { - Ai21: "AI21", - AionLabs: "AionLabs", - Alibaba: "Alibaba", - AmazonBedrock: "Amazon Bedrock", - AmazonNova: "Amazon Nova", - Anthropic: "Anthropic", - ArceeAI: "Arcee AI", - AtlasCloud: "AtlasCloud", - Avian: "Avian", - Azure: "Azure", - BaseTen: "BaseTen", - BytePlus: "BytePlus", - BlackForestLabs: "Black Forest Labs", - Cerebras: "Cerebras", - Chutes: "Chutes", - Cirrascale: "Cirrascale", - Clarifai: "Clarifai", - Cloudflare: "Cloudflare", - Cohere: "Cohere", - Crusoe: "Crusoe", - DeepInfra: "DeepInfra", - DeepSeek: "DeepSeek", - Featherless: "Featherless", - Fireworks: "Fireworks", - Friendli: "Friendli", - GMICloud: "GMICloud", - GoPomelo: "GoPomelo", - Google: "Google", - GoogleAIStudio: "Google AI Studio", - Groq: "Groq", - Hyperbolic: "Hyperbolic", - Inception: "Inception", - InferenceNet: "InferenceNet", - Infermatic: "Infermatic", - Inflection: "Inflection", - Liquid: "Liquid", - Mara: "Mara", - Mancer2: "Mancer 2", - Minimax: "Minimax", - ModelRun: "ModelRun", - Mistral: "Mistral", - Modular: "Modular", - MoonshotAI: "Moonshot AI", - Morph: "Morph", - NCompass: "NCompass", - Nebius: "Nebius", - NextBit: "NextBit", - Novita: "Novita", - Nvidia: "Nvidia", - OpenAI: "OpenAI", - OpenInference: "OpenInference", - Parasail: "Parasail", - Perplexity: "Perplexity", - Phala: "Phala", - Relace: "Relace", - SambaNova: "SambaNova", - SiliconFlow: "SiliconFlow", - Sourceful: "Sourceful", - Stealth: "Stealth", - StreamLake: "StreamLake", - Switchpoint: "Switchpoint", - Targon: "Targon", - Together: "Together", - Venice: "Venice", - WandB: "WandB", - Xiaomi: "Xiaomi", - XAI: "xAI", - ZAi: "Z.AI", - FakeProvider: "FakeProvider", -} as const; -export type GetParametersProvider = OpenEnum; - export type GetParametersRequest = { author: string; slug: string; - provider?: GetParametersProvider | undefined; + provider?: models.ProviderName | undefined; }; export const SupportedParameter = { @@ -115,6 +43,7 @@ export const SupportedParameter = { ParallelToolCalls: "parallel_tool_calls", IncludeReasoning: "include_reasoning", Reasoning: "reasoning", + ReasoningEffort: "reasoning_effort", WebSearchOptions: "web_search_options", Verbosity: "verbosity", } as const; @@ -165,12 +94,6 @@ export function getParametersSecurityToJSON( ); } -/** @internal */ -export const GetParametersProvider$outboundSchema: z.ZodType< - string, - GetParametersProvider -> = openEnums.outboundSchema(GetParametersProvider); - /** @internal */ export type GetParametersRequest$Outbound = { author: string; @@ -185,7 +108,7 @@ export const GetParametersRequest$outboundSchema: z.ZodType< > = z.object({ author: z.string(), slug: z.string(), - provider: GetParametersProvider$outboundSchema.optional(), + provider: models.ProviderName$outboundSchema.optional(), }); export function getParametersRequestToJSON( diff --git a/src/models/parameter.ts b/src/models/parameter.ts index 9753ec38..51cddbfd 100644 --- a/src/models/parameter.ts +++ b/src/models/parameter.ts @@ -28,6 +28,7 @@ export const Parameter = { ParallelToolCalls: "parallel_tool_calls", IncludeReasoning: "include_reasoning", Reasoning: "reasoning", + ReasoningEffort: "reasoning_effort", WebSearchOptions: "web_search_options", Verbosity: "verbosity", } as const; diff --git a/src/models/pdfparserengine.ts b/src/models/pdfparserengine.ts new file mode 100644 index 00000000..2d7b48ee --- /dev/null +++ b/src/models/pdfparserengine.ts @@ -0,0 +1,26 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; + +/** + * The engine to use for parsing PDF files. + */ +export const PDFParserEngine = { + MistralOcr: "mistral-ocr", + PdfText: "pdf-text", + Native: "native", +} as const; +/** + * The engine to use for parsing PDF files. + */ +export type PDFParserEngine = OpenEnum; + +/** @internal */ +export const PDFParserEngine$outboundSchema: z.ZodType< + string, + PDFParserEngine +> = openEnums.outboundSchema(PDFParserEngine); diff --git a/src/models/pdfparseroptions.ts b/src/models/pdfparseroptions.ts new file mode 100644 index 00000000..f68c84b8 --- /dev/null +++ b/src/models/pdfparseroptions.ts @@ -0,0 +1,40 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import { + PDFParserEngine, + PDFParserEngine$outboundSchema, +} from "./pdfparserengine.js"; + +/** + * Options for PDF parsing. + */ +export type PDFParserOptions = { + /** + * The engine to use for parsing PDF files. + */ + engine?: PDFParserEngine | undefined; +}; + +/** @internal */ +export type PDFParserOptions$Outbound = { + engine?: string | undefined; +}; + +/** @internal */ +export const PDFParserOptions$outboundSchema: z.ZodType< + PDFParserOptions$Outbound, + PDFParserOptions +> = z.object({ + engine: PDFParserEngine$outboundSchema.optional(), +}); + +export function pdfParserOptionsToJSON( + pdfParserOptions: PDFParserOptions, +): string { + return JSON.stringify( + PDFParserOptions$outboundSchema.parse(pdfParserOptions), + ); +} diff --git a/src/models/providerpreferences.ts b/src/models/providerpreferences.ts new file mode 100644 index 00000000..b58a7cfa --- /dev/null +++ b/src/models/providerpreferences.ts @@ -0,0 +1,438 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import * as openEnums from "../types/enums.js"; +import { ClosedEnum, OpenEnum } from "../types/enums.js"; +import { + DataCollection, + DataCollection$outboundSchema, +} from "./datacollection.js"; +import { ProviderName, ProviderName$outboundSchema } from "./providername.js"; +import { ProviderSort, ProviderSort$outboundSchema } from "./providersort.js"; +import { Quantization, Quantization$outboundSchema } from "./quantization.js"; + +export type ProviderPreferencesOrder = ProviderName | string; + +export type ProviderPreferencesOnly = ProviderName | string; + +export type ProviderPreferencesIgnore = ProviderName | string; + +export const SortEnum = { + Price: "price", + Throughput: "throughput", + Latency: "latency", +} as const; +export type SortEnum = OpenEnum; + +export const ProviderSortConfigEnum = { + Price: "price", + Throughput: "throughput", + Latency: "latency", +} as const; +export type ProviderSortConfigEnum = ClosedEnum; + +export const ProviderPreferencesPartition = { + Model: "model", + None: "none", +} as const; +export type ProviderPreferencesPartition = OpenEnum< + typeof ProviderPreferencesPartition +>; + +export type ProviderPreferencesProviderSortConfig = { + by?: ProviderSort | null | undefined; + partition?: ProviderPreferencesPartition | null | undefined; +}; + +export type ProviderSortConfigUnion = + | ProviderPreferencesProviderSortConfig + | ProviderSortConfigEnum; + +export const ProviderPreferencesProviderSort = { + Price: "price", + Throughput: "throughput", + Latency: "latency", +} as const; +export type ProviderPreferencesProviderSort = OpenEnum< + typeof ProviderPreferencesProviderSort +>; + +/** + * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + */ +export type ProviderPreferencesSortUnion = + | ProviderPreferencesProviderSort + | ProviderPreferencesProviderSortConfig + | ProviderSortConfigEnum + | SortEnum; + +/** + * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. + */ +export type ProviderPreferencesMaxPrice = { + /** + * A value in string format that is a large number + */ + prompt?: string | undefined; + /** + * A value in string format that is a large number + */ + completion?: string | undefined; + /** + * A value in string format that is a large number + */ + image?: string | undefined; + /** + * A value in string format that is a large number + */ + audio?: string | undefined; + /** + * A value in string format that is a large number + */ + request?: string | undefined; +}; + +/** + * Provider routing preferences for the request. + */ +export type ProviderPreferences = { + /** + * Whether to allow backup providers to serve requests + * + * @remarks + * - 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. + */ + allowFallbacks?: boolean | null | undefined; + /** + * 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. + */ + requireParameters?: boolean | null | undefined; + /** + * Data collection setting. If no available model provider meets the requirement, your request will return an error. + * + * @remarks + * - 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. + */ + dataCollection?: DataCollection | null | undefined; + /** + * Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. + */ + zdr?: boolean | null | undefined; + /** + * Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. + */ + enforceDistillableText?: boolean | null | undefined; + /** + * 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. + */ + order?: Array | null | undefined; + /** + * List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. + */ + only?: Array | null | undefined; + /** + * List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. + */ + ignore?: Array | null | undefined; + /** + * A list of quantization levels to filter the provider by. + */ + quantizations?: Array | null | undefined; + sort?: + | ProviderPreferencesProviderSort + | ProviderPreferencesProviderSortConfig + | ProviderSortConfigEnum + | SortEnum + | null + | undefined; + /** + * The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. + */ + maxPrice?: ProviderPreferencesMaxPrice | undefined; + /** + * 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. + */ + preferredMinThroughput?: number | null | undefined; + /** + * 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. + */ + preferredMaxLatency?: number | null | undefined; + /** + * **DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput. + * + * @deprecated field: Use preferred_min_throughput instead.. + */ + minThroughput?: number | null | undefined; + /** + * **DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency. + * + * @deprecated field: Use preferred_max_latency instead.. + */ + maxLatency?: number | null | undefined; +}; + +/** @internal */ +export type ProviderPreferencesOrder$Outbound = string | string; + +/** @internal */ +export const ProviderPreferencesOrder$outboundSchema: z.ZodType< + ProviderPreferencesOrder$Outbound, + ProviderPreferencesOrder +> = z.union([ProviderName$outboundSchema, z.string()]); + +export function providerPreferencesOrderToJSON( + providerPreferencesOrder: ProviderPreferencesOrder, +): string { + return JSON.stringify( + ProviderPreferencesOrder$outboundSchema.parse(providerPreferencesOrder), + ); +} + +/** @internal */ +export type ProviderPreferencesOnly$Outbound = string | string; + +/** @internal */ +export const ProviderPreferencesOnly$outboundSchema: z.ZodType< + ProviderPreferencesOnly$Outbound, + ProviderPreferencesOnly +> = z.union([ProviderName$outboundSchema, z.string()]); + +export function providerPreferencesOnlyToJSON( + providerPreferencesOnly: ProviderPreferencesOnly, +): string { + return JSON.stringify( + ProviderPreferencesOnly$outboundSchema.parse(providerPreferencesOnly), + ); +} + +/** @internal */ +export type ProviderPreferencesIgnore$Outbound = string | string; + +/** @internal */ +export const ProviderPreferencesIgnore$outboundSchema: z.ZodType< + ProviderPreferencesIgnore$Outbound, + ProviderPreferencesIgnore +> = z.union([ProviderName$outboundSchema, z.string()]); + +export function providerPreferencesIgnoreToJSON( + providerPreferencesIgnore: ProviderPreferencesIgnore, +): string { + return JSON.stringify( + ProviderPreferencesIgnore$outboundSchema.parse(providerPreferencesIgnore), + ); +} + +/** @internal */ +export const SortEnum$outboundSchema: z.ZodType = openEnums + .outboundSchema(SortEnum); + +/** @internal */ +export const ProviderSortConfigEnum$outboundSchema: z.ZodEnum< + typeof ProviderSortConfigEnum +> = z.enum(ProviderSortConfigEnum); + +/** @internal */ +export const ProviderPreferencesPartition$outboundSchema: z.ZodType< + string, + ProviderPreferencesPartition +> = openEnums.outboundSchema(ProviderPreferencesPartition); + +/** @internal */ +export type ProviderPreferencesProviderSortConfig$Outbound = { + by?: string | null | undefined; + partition?: string | null | undefined; +}; + +/** @internal */ +export const ProviderPreferencesProviderSortConfig$outboundSchema: z.ZodType< + ProviderPreferencesProviderSortConfig$Outbound, + ProviderPreferencesProviderSortConfig +> = z.object({ + by: z.nullable(ProviderSort$outboundSchema).optional(), + partition: z.nullable(ProviderPreferencesPartition$outboundSchema).optional(), +}); + +export function providerPreferencesProviderSortConfigToJSON( + providerPreferencesProviderSortConfig: ProviderPreferencesProviderSortConfig, +): string { + return JSON.stringify( + ProviderPreferencesProviderSortConfig$outboundSchema.parse( + providerPreferencesProviderSortConfig, + ), + ); +} + +/** @internal */ +export type ProviderSortConfigUnion$Outbound = + | ProviderPreferencesProviderSortConfig$Outbound + | string; + +/** @internal */ +export const ProviderSortConfigUnion$outboundSchema: z.ZodType< + ProviderSortConfigUnion$Outbound, + ProviderSortConfigUnion +> = z.union([ + z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema), + ProviderSortConfigEnum$outboundSchema, +]); + +export function providerSortConfigUnionToJSON( + providerSortConfigUnion: ProviderSortConfigUnion, +): string { + return JSON.stringify( + ProviderSortConfigUnion$outboundSchema.parse(providerSortConfigUnion), + ); +} + +/** @internal */ +export const ProviderPreferencesProviderSort$outboundSchema: z.ZodType< + string, + ProviderPreferencesProviderSort +> = openEnums.outboundSchema(ProviderPreferencesProviderSort); + +/** @internal */ +export type ProviderPreferencesSortUnion$Outbound = + | string + | ProviderPreferencesProviderSortConfig$Outbound + | string + | string; + +/** @internal */ +export const ProviderPreferencesSortUnion$outboundSchema: z.ZodType< + ProviderPreferencesSortUnion$Outbound, + ProviderPreferencesSortUnion +> = z.union([ + ProviderPreferencesProviderSort$outboundSchema, + z.union([ + z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema), + ProviderSortConfigEnum$outboundSchema, + ]), + SortEnum$outboundSchema, +]); + +export function providerPreferencesSortUnionToJSON( + providerPreferencesSortUnion: ProviderPreferencesSortUnion, +): string { + return JSON.stringify( + ProviderPreferencesSortUnion$outboundSchema.parse( + providerPreferencesSortUnion, + ), + ); +} + +/** @internal */ +export type ProviderPreferencesMaxPrice$Outbound = { + prompt?: string | undefined; + completion?: string | undefined; + image?: string | undefined; + audio?: string | undefined; + request?: string | undefined; +}; + +/** @internal */ +export const ProviderPreferencesMaxPrice$outboundSchema: z.ZodType< + ProviderPreferencesMaxPrice$Outbound, + ProviderPreferencesMaxPrice +> = z.object({ + prompt: z.string().optional(), + completion: z.string().optional(), + image: z.string().optional(), + audio: z.string().optional(), + request: z.string().optional(), +}); + +export function providerPreferencesMaxPriceToJSON( + providerPreferencesMaxPrice: ProviderPreferencesMaxPrice, +): string { + return JSON.stringify( + ProviderPreferencesMaxPrice$outboundSchema.parse( + providerPreferencesMaxPrice, + ), + ); +} + +/** @internal */ +export type ProviderPreferences$Outbound = { + allow_fallbacks?: boolean | null | undefined; + require_parameters?: boolean | null | undefined; + data_collection?: string | null | undefined; + zdr?: boolean | null | undefined; + enforce_distillable_text?: boolean | null | undefined; + order?: Array | null | undefined; + only?: Array | null | undefined; + ignore?: Array | null | undefined; + quantizations?: Array | null | undefined; + sort?: + | string + | ProviderPreferencesProviderSortConfig$Outbound + | string + | string + | null + | undefined; + max_price?: ProviderPreferencesMaxPrice$Outbound | undefined; + preferred_min_throughput?: number | null | undefined; + preferred_max_latency?: number | null | undefined; + min_throughput?: number | null | undefined; + max_latency?: number | null | undefined; +}; + +/** @internal */ +export const ProviderPreferences$outboundSchema: z.ZodType< + ProviderPreferences$Outbound, + ProviderPreferences +> = z.object({ + allowFallbacks: z.nullable(z.boolean()).optional(), + requireParameters: z.nullable(z.boolean()).optional(), + dataCollection: z.nullable(DataCollection$outboundSchema).optional(), + zdr: z.nullable(z.boolean()).optional(), + enforceDistillableText: z.nullable(z.boolean()).optional(), + order: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))) + .optional(), + only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))) + .optional(), + ignore: z.nullable( + z.array(z.union([ProviderName$outboundSchema, z.string()])), + ).optional(), + quantizations: z.nullable(z.array(Quantization$outboundSchema)).optional(), + sort: z.nullable( + z.union([ + ProviderPreferencesProviderSort$outboundSchema, + z.union([ + z.lazy(() => ProviderPreferencesProviderSortConfig$outboundSchema), + ProviderSortConfigEnum$outboundSchema, + ]), + SortEnum$outboundSchema, + ]), + ).optional(), + maxPrice: z.lazy(() => ProviderPreferencesMaxPrice$outboundSchema).optional(), + preferredMinThroughput: z.nullable(z.number()).optional(), + preferredMaxLatency: z.nullable(z.number()).optional(), + minThroughput: z.nullable(z.number()).optional(), + maxLatency: z.nullable(z.number()).optional(), +}).transform((v) => { + return remap$(v, { + allowFallbacks: "allow_fallbacks", + requireParameters: "require_parameters", + dataCollection: "data_collection", + enforceDistillableText: "enforce_distillable_text", + maxPrice: "max_price", + preferredMinThroughput: "preferred_min_throughput", + preferredMaxLatency: "preferred_max_latency", + minThroughput: "min_throughput", + maxLatency: "max_latency", + }); +}); + +export function providerPreferencesToJSON( + providerPreferences: ProviderPreferences, +): string { + return JSON.stringify( + ProviderPreferences$outboundSchema.parse(providerPreferences), + ); +} diff --git a/src/models/providersort.ts b/src/models/providersort.ts index 74a9a5cb..763d4a5f 100644 --- a/src/models/providersort.ts +++ b/src/models/providersort.ts @@ -6,17 +6,11 @@ import * as z from "zod/v4"; import * as openEnums from "../types/enums.js"; import { OpenEnum } from "../types/enums.js"; -/** - * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - */ export const ProviderSort = { Price: "price", Throughput: "throughput", Latency: "latency", } as const; -/** - * The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - */ export type ProviderSort = OpenEnum; /** @internal */ diff --git a/src/models/providersortconfig.ts b/src/models/providersortconfig.ts new file mode 100644 index 00000000..978c094c --- /dev/null +++ b/src/models/providersortconfig.ts @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { ProviderSort, ProviderSort$outboundSchema } from "./providersort.js"; + +export const Partition = { + Model: "model", + None: "none", +} as const; +export type Partition = OpenEnum; + +export type ProviderSortConfig = { + by?: ProviderSort | null | undefined; + partition?: Partition | null | undefined; +}; + +/** @internal */ +export const Partition$outboundSchema: z.ZodType = openEnums + .outboundSchema(Partition); + +/** @internal */ +export type ProviderSortConfig$Outbound = { + by?: string | null | undefined; + partition?: string | null | undefined; +}; + +/** @internal */ +export const ProviderSortConfig$outboundSchema: z.ZodType< + ProviderSortConfig$Outbound, + ProviderSortConfig +> = z.object({ + by: z.nullable(ProviderSort$outboundSchema).optional(), + partition: z.nullable(Partition$outboundSchema).optional(), +}); + +export function providerSortConfigToJSON( + providerSortConfig: ProviderSortConfig, +): string { + return JSON.stringify( + ProviderSortConfig$outboundSchema.parse(providerSortConfig), + ); +} diff --git a/src/models/providersortunion.ts b/src/models/providersortunion.ts new file mode 100644 index 00000000..461955ca --- /dev/null +++ b/src/models/providersortunion.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import { ProviderSort, ProviderSort$outboundSchema } from "./providersort.js"; +import { + ProviderSortConfig, + ProviderSortConfig$Outbound, + ProviderSortConfig$outboundSchema, +} from "./providersortconfig.js"; + +export type ProviderSortUnion = ProviderSort | ProviderSortConfig; + +/** @internal */ +export type ProviderSortUnion$Outbound = string | ProviderSortConfig$Outbound; + +/** @internal */ +export const ProviderSortUnion$outboundSchema: z.ZodType< + ProviderSortUnion$Outbound, + ProviderSortUnion +> = z.union([ProviderSort$outboundSchema, ProviderSortConfig$outboundSchema]); + +export function providerSortUnionToJSON( + providerSortUnion: ProviderSortUnion, +): string { + return JSON.stringify( + ProviderSortUnion$outboundSchema.parse(providerSortUnion), + ); +} diff --git a/src/models/schema3.ts b/src/models/schema3.ts new file mode 100644 index 00000000..4c60f355 --- /dev/null +++ b/src/models/schema3.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export const Schema5 = { + Unknown: "unknown", + OpenaiResponsesV1: "openai-responses-v1", + XaiResponsesV1: "xai-responses-v1", + AnthropicClaudeV1: "anthropic-claude-v1", + GoogleGeminiV1: "google-gemini-v1", +} as const; +export type Schema5 = OpenEnum; + +export type Schema3ReasoningText = { + type: "reasoning.text"; + text?: string | null | undefined; + signature?: string | null | undefined; + id?: string | null | undefined; + format?: Schema5 | null | undefined; + index?: number | undefined; +}; + +export type Schema3ReasoningEncrypted = { + type: "reasoning.encrypted"; + data: string; + id?: string | null | undefined; + format?: Schema5 | null | undefined; + index?: number | undefined; +}; + +export type Schema3ReasoningSummary = { + type: "reasoning.summary"; + summary: string; + id?: string | null | undefined; + format?: Schema5 | null | undefined; + index?: number | undefined; +}; + +export type Schema3 = + | Schema3ReasoningSummary + | Schema3ReasoningEncrypted + | Schema3ReasoningText; + +/** @internal */ +export const Schema5$inboundSchema: z.ZodType = openEnums + .inboundSchema(Schema5); + +/** @internal */ +export const Schema3ReasoningText$inboundSchema: z.ZodType< + Schema3ReasoningText, + unknown +> = z.object({ + type: z.literal("reasoning.text"), + text: z.nullable(z.string()).optional(), + signature: z.nullable(z.string()).optional(), + id: z.nullable(z.string()).optional(), + format: z.nullable(Schema5$inboundSchema).optional(), + index: z.number().optional(), +}); + +export function schema3ReasoningTextFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Schema3ReasoningText$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Schema3ReasoningText' from JSON`, + ); +} + +/** @internal */ +export const Schema3ReasoningEncrypted$inboundSchema: z.ZodType< + Schema3ReasoningEncrypted, + unknown +> = z.object({ + type: z.literal("reasoning.encrypted"), + data: z.string(), + id: z.nullable(z.string()).optional(), + format: z.nullable(Schema5$inboundSchema).optional(), + index: z.number().optional(), +}); + +export function schema3ReasoningEncryptedFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Schema3ReasoningEncrypted$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Schema3ReasoningEncrypted' from JSON`, + ); +} + +/** @internal */ +export const Schema3ReasoningSummary$inboundSchema: z.ZodType< + Schema3ReasoningSummary, + unknown +> = z.object({ + type: z.literal("reasoning.summary"), + summary: z.string(), + id: z.nullable(z.string()).optional(), + format: z.nullable(Schema5$inboundSchema).optional(), + index: z.number().optional(), +}); + +export function schema3ReasoningSummaryFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Schema3ReasoningSummary$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Schema3ReasoningSummary' from JSON`, + ); +} + +/** @internal */ +export const Schema3$inboundSchema: z.ZodType = z.union([ + z.lazy(() => Schema3ReasoningSummary$inboundSchema), + z.lazy(() => Schema3ReasoningEncrypted$inboundSchema), + z.lazy(() => Schema3ReasoningText$inboundSchema), +]); + +export function schema3FromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Schema3$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Schema3' from JSON`, + ); +} diff --git a/src/models/websearchengine.ts b/src/models/websearchengine.ts new file mode 100644 index 00000000..f486570b --- /dev/null +++ b/src/models/websearchengine.ts @@ -0,0 +1,25 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; + +/** + * The search engine to use for web search. + */ +export const WebSearchEngine = { + Native: "native", + Exa: "exa", +} as const; +/** + * The search engine to use for web search. + */ +export type WebSearchEngine = OpenEnum; + +/** @internal */ +export const WebSearchEngine$outboundSchema: z.ZodType< + string, + WebSearchEngine +> = openEnums.outboundSchema(WebSearchEngine); diff --git a/src/types/discriminatedUnion.ts b/src/types/discriminatedUnion.ts new file mode 100644 index 00000000..d8774298 --- /dev/null +++ b/src/types/discriminatedUnion.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4"; +import { startCountingUnrecognized } from "./unrecognized.js"; + +const UNKNOWN = Symbol("UNKNOWN"); + +export type Unknown = + & { + [K in Discriminator]: UnknownValue; + } + & { + raw: unknown; + isUnknown: true; + }; + +export function isUnknown( + value: unknown, +): value is Unknown { + return typeof value === "object" && value !== null && UNKNOWN in value; +} + +/** + * Forward-compatible discriminated union parser. + * + * If the input does not match one of the predefined options, it will be + * captured and available as `{ raw: , [discriminator]: "UNKNOWN", isUnknown: true }`. + * + * @param inputPropertyName - The discriminator property name in the input payload + * @param options - Map of discriminator values to their corresponding schemas + * @param opts - Optional configuration object + * @param opts.unknownValue - The value to use for the discriminator when the input is unknown (default: "UNKNOWN") + * @param opts.outputPropertyName - Output property name if the sanitized (camelCase) property name differs from inputPropertyName + */ +export function discriminatedUnion< + InputDiscriminator extends string, + TOptions extends Readonly>, + UnknownValue extends string = "UNKNOWN", + OutputDiscriminator extends string = InputDiscriminator, +>( + inputPropertyName: InputDiscriminator, + options: TOptions, + opts: { + unknownValue?: UnknownValue; + outputPropertyName?: OutputDiscriminator; + } = {}, +): z.ZodType< + | z.output + | Unknown, + unknown +> { + const { unknownValue = "UNKNOWN" as UnknownValue, outputPropertyName } = opts; + return z.unknown().transform((input) => { + const fallback = Object.defineProperties( + { + raw: input, + [outputPropertyName ?? inputPropertyName]: unknownValue, + isUnknown: true as const, + }, + { [UNKNOWN]: { value: true, enumerable: false, configurable: false } }, + ); + + const isObject = typeof input === "object" && input !== null; + if (!isObject) return fallback; + + const discriminator = input[inputPropertyName as keyof typeof input]; + if (typeof discriminator !== "string") return fallback; + if (!(discriminator in options)) return fallback; + + const schema = options[discriminator]; + if (!schema) return fallback; + + // Start counters before parsing to track nested unrecognized/zeroDefault values + const unrecognizedCtr = startCountingUnrecognized(); + + const result = schema.safeParse(input); + if (!result.success) { + // Parse failed - don't propagate any counts from the failed attempt + unrecognizedCtr.end(0); + + return fallback; + } + + // Parse succeeded - propagate the actual counts + unrecognizedCtr.end(); + + if (outputPropertyName) { + (result.data as any)[outputPropertyName] = discriminator; + } + + return result.data; + }) as any; +}