diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1d3a900..871eab6 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d management: - docChecksum: 7136b263714e485a5a96ee056b6e3f36 + docChecksum: 52c044061097671980a3ac37a4839b7f docVersion: 1.0.0 speakeasyVersion: 1.666.0 generationVersion: 2.768.0 - releaseVersion: 0.1.3 - configChecksum: d03f8606816d7028a10e566c4ff2ac44 + releaseVersion: 0.5.0 + configChecksum: 4bcc2dd9900ba2408612f6fa04918561 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true @@ -60,25 +60,7 @@ generatedFiles: - docs/components/chatcompletionfinishreason.md - docs/components/chaterrorerror.md - docs/components/chatgenerationparams.md - - docs/components/chatgenerationparamsdatacollection.md - docs/components/chatgenerationparamsimageconfig.md - - docs/components/chatgenerationparamsmaxprice.md - - docs/components/chatgenerationparamspluginautorouter.md - - docs/components/chatgenerationparamspluginfileparser.md - - docs/components/chatgenerationparamspluginmoderation.md - - docs/components/chatgenerationparamspluginresponsehealing.md - - docs/components/chatgenerationparamspluginunion.md - - docs/components/chatgenerationparamspluginweb.md - - docs/components/chatgenerationparamspreferredmaxlatency.md - - docs/components/chatgenerationparamspreferredmaxlatencyunion.md - - docs/components/chatgenerationparamspreferredminthroughput.md - - docs/components/chatgenerationparamspreferredminthroughputunion.md - - docs/components/chatgenerationparamsprovider.md - - docs/components/chatgenerationparamsresponseformatjsonobject.md - - docs/components/chatgenerationparamsresponseformatpython.md - - docs/components/chatgenerationparamsresponseformattext.md - - docs/components/chatgenerationparamsresponseformatunion.md - - docs/components/chatgenerationparamsstop.md - docs/components/chatgenerationtokenusage.md - docs/components/chatmessagecontentitem.md - docs/components/chatmessagecontentitemaudio.md @@ -109,23 +91,15 @@ generatedFiles: - docs/components/chatstreamoptions.md - docs/components/code.md - docs/components/codeenum.md - - docs/components/completionchoice.md - - docs/components/completioncreateparams.md - - docs/components/completioncreateparamsresponseformatjsonobject.md - - docs/components/completioncreateparamsresponseformatpython.md - - docs/components/completioncreateparamsresponseformattext.md - - docs/components/completioncreateparamsresponseformatunion.md - - docs/components/completioncreateparamsstop.md - - docs/components/completionfinishreason.md - - docs/components/completionlogprobs.md - - docs/components/completionresponse.md + - docs/components/completion.md - docs/components/completiontokensdetails.md - - docs/components/completionusage.md - docs/components/costdetails.md - docs/components/createchargerequest.md - docs/components/datacollection.md - docs/components/debug.md - docs/components/defaultparameters.md + - docs/components/developermessage.md + - docs/components/developermessagecontent.md - docs/components/edgenetworktimeoutresponseerrordata.md - docs/components/effort.md - docs/components/endpointstatus.md @@ -150,8 +124,6 @@ generatedFiles: - docs/components/listendpointsresponse.md - docs/components/logprob.md - docs/components/message.md - - docs/components/messagecontent.md - - docs/components/messagedeveloper.md - docs/components/modality.md - docs/components/model.md - docs/components/modelarchitecture.md @@ -273,13 +245,6 @@ generatedFiles: - docs/components/openresponsesrequestmaxprice.md - docs/components/openresponsesrequestonly.md - docs/components/openresponsesrequestorder.md - - docs/components/openresponsesrequestpluginautorouter.md - - docs/components/openresponsesrequestpluginfileparser.md - - docs/components/openresponsesrequestpluginmoderation.md - - docs/components/openresponsesrequestpluginresponsehealing.md - - docs/components/openresponsesrequestpluginunion.md - - docs/components/openresponsesrequestpluginweb.md - - docs/components/openresponsesrequestprovider.md - docs/components/openresponsesrequestsort.md - docs/components/openresponsesrequesttoolfunction.md - docs/components/openresponsesrequesttoolunion.md @@ -342,11 +307,18 @@ generatedFiles: - docs/components/percentilestats.md - docs/components/percentilethroughputcutoffs.md - docs/components/perrequestlimits.md + - docs/components/plugin.md + - docs/components/pluginautorouter.md + - docs/components/pluginfileparser.md + - docs/components/pluginmoderation.md + - docs/components/pluginresponsehealing.md + - docs/components/pluginweb.md - docs/components/preferredmaxlatency.md - docs/components/preferredminthroughput.md - docs/components/pricing.md - docs/components/prompt.md - docs/components/prompttokensdetails.md + - docs/components/provider.md - docs/components/providername.md - docs/components/provideroverloadedresponseerrordata.md - docs/components/providerpreferences.md @@ -367,7 +339,6 @@ generatedFiles: - docs/components/publicendpointquantization.md - docs/components/publicpricing.md - docs/components/quantization.md - - docs/components/quantizations.md - docs/components/reason.md - docs/components/reasoning.md - docs/components/reasoningsummarytext.md @@ -376,7 +347,11 @@ generatedFiles: - docs/components/reasoningtextcontent.md - docs/components/reasoningtextcontenttype.md - docs/components/requesttimeoutresponseerrordata.md + - docs/components/responseformat.md + - docs/components/responseformatjsonobject.md - docs/components/responseformatjsonschema.md + - docs/components/responseformatpython.md + - docs/components/responseformattext.md - docs/components/responseformattextconfig.md - docs/components/responseformattextgrammar.md - docs/components/responseinputaudio.md @@ -438,17 +413,30 @@ generatedFiles: - docs/components/responsetextconfigverbosity.md - docs/components/route.md - docs/components/schema0.md - - docs/components/schema0enum.md - - docs/components/schema2.md - - docs/components/schema2reasoningencrypted.md - - docs/components/schema2reasoningsummary.md - - docs/components/schema2reasoningtext.md - - docs/components/schema4.md + - docs/components/schema10.md + - docs/components/schema14.md + - docs/components/schema15.md + - docs/components/schema15union.md + - docs/components/schema17.md + - docs/components/schema17autorouter.md + - docs/components/schema17fileparser.md + - docs/components/schema17moderation.md + - docs/components/schema17responsehealing.md + - docs/components/schema17web.md + - docs/components/schema19.md + - docs/components/schema19reasoningencrypted.md + - docs/components/schema19reasoningsummary.md + - docs/components/schema19reasoningtext.md + - docs/components/schema21.md + - docs/components/schema3.md + - docs/components/schema5.md + - docs/components/schema5enum.md + - docs/components/schema8.md - docs/components/security.md - docs/components/servicetier.md - docs/components/serviceunavailableresponseerrordata.md - docs/components/sortenum.md - - docs/components/streamoptions.md + - docs/components/stop.md - docs/components/systemmessage.md - docs/components/systemmessagecontent.md - docs/components/tokenizer.md @@ -606,6 +594,8 @@ generatedFiles: - docs/operations/metadata.md - docs/operations/object.md - docs/operations/objectembedding.md + - docs/operations/providername.md + - docs/operations/providerresponse.md - docs/operations/ratelimit.md - docs/operations/sendchatcompletionrequestresponse.md - docs/operations/transferintent.md @@ -627,7 +617,6 @@ generatedFiles: - docs/sdks/analytics/README.md - docs/sdks/apikeys/README.md - docs/sdks/chat/README.md - - docs/sdks/completions/README.md - docs/sdks/credits/README.md - docs/sdks/embeddings/README.md - docs/sdks/endpoints/README.md @@ -651,10 +640,12 @@ generatedFiles: - src/openrouter/basesdk.py - src/openrouter/beta.py - src/openrouter/chat.py - - src/openrouter/completions.py - src/openrouter/components/__init__.py - - src/openrouter/components/_schema0.py - - src/openrouter/components/_schema2.py + - src/openrouter/components/_schema10.py + - src/openrouter/components/_schema14.py + - src/openrouter/components/_schema17.py + - src/openrouter/components/_schema19.py + - src/openrouter/components/_schema5.py - src/openrouter/components/activityitem.py - src/openrouter/components/assistantmessage.py - src/openrouter/components/badgatewayresponseerrordata.py @@ -679,14 +670,10 @@ generatedFiles: - src/openrouter/components/chatstreamingmessagetoolcall.py - src/openrouter/components/chatstreamingresponsechunk.py - src/openrouter/components/chatstreamoptions.py - - src/openrouter/components/completionchoice.py - - src/openrouter/components/completioncreateparams.py - - src/openrouter/components/completionlogprobs.py - - src/openrouter/components/completionresponse.py - - src/openrouter/components/completionusage.py - src/openrouter/components/createchargerequest.py - src/openrouter/components/datacollection.py - src/openrouter/components/defaultparameters.py + - src/openrouter/components/developermessage.py - src/openrouter/components/edgenetworktimeoutresponseerrordata.py - src/openrouter/components/endpointstatus.py - src/openrouter/components/filecitation.py @@ -1021,7 +1008,7 @@ examples: id: "" responses: "200": - application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto"}} + application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto", "provider_responses": []}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "402": @@ -1063,6 +1050,8 @@ examples: application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} listEndpoints: speakeasy-default-list-endpoints: parameters: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 81e4708..3f2cfba 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -31,7 +31,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.1.3 + version: 0.5.0 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 232f496..d514e42 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -2,7 +2,7 @@ openapi: 3.1.0 info: title: OpenRouter API version: 1.0.0 - description: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features + description: OpenAI-compatible API with additional OpenRouter features contact: name: OpenRouter Support url: https://openrouter.ai/docs @@ -3542,6 +3542,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -3598,6 +3599,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -3645,7 +3647,7 @@ components: - type: 'null' BigNumberUnion: type: string - description: A value in string format that is a large number + description: Price per million prompt tokens example: 1000 PercentileThroughputCutoffs: type: object @@ -3964,13 +3966,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. @@ -4393,7 +4403,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded stop_sequence: type: string nullable: true @@ -4849,7 +4858,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded stop_sequence: type: string nullable: true @@ -6514,6 +6522,21 @@ components: - role - content description: Anthropic message with OpenRouter extensions + AnthropicOutputConfig: + type: object + properties: + effort: + type: string + nullable: true + enum: + - low + - medium + - high + description: >- + How much effort the model should put into its response. Higher effort levels may result in more thorough + analysis but take longer. Valid values are `low`, `medium`, or `high`. + example: medium + description: Configuration for controlling output behavior. Currently supports the effort parameter for Claude Opus 4.5. AnthropicMessagesRequest: type: object properties: @@ -7022,13 +7045,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. @@ -7146,6 +7177,8 @@ components: type: array items: type: string + output_config: + $ref: '#/components/schemas/AnthropicOutputConfig' required: - model - max_tokens @@ -7373,13 +7406,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. @@ -7392,31 +7433,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -7874,31 +7941,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -8102,6 +8195,103 @@ components: p90: 28.3 p99: 15.1 __schema0: + anyOf: + - type: object + properties: + allow_fallbacks: + 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. + $ref: '#/components/schemas/__schema1' + require_parameters: + 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. + $ref: '#/components/schemas/__schema1' + data_collection: + description: >- + 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. + $ref: '#/components/schemas/__schema3' + zdr: + anyOf: + - type: boolean + - type: 'null' + enforce_distillable_text: + anyOf: + - type: boolean + - type: 'null' + order: + 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. + $ref: '#/components/schemas/__schema4' + only: + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed + provider settings for this request. + $ref: '#/components/schemas/__schema4' + ignore: + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored + provider settings for this request. + $ref: '#/components/schemas/__schema4' + quantizations: + description: A list of quantization levels to filter the provider by. + $ref: '#/components/schemas/__schema8' + sort: + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing + is performed. + $ref: '#/components/schemas/__schema9' + max_price: + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, + for prompt and completion. + $ref: '#/components/schemas/__schema10' + preferred_min_throughput: + description: >- + Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with + percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized + in routing. When using fallback models, this may cause a fallback model to be used instead of the + primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + preferred_max_latency: + description: >- + Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with + percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized + in routing. When using fallback models, this may cause a fallback model to be used instead of the + primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + additionalProperties: false + - type: 'null' + __schema1: + anyOf: + - type: boolean + - type: 'null' + __schema3: + anyOf: + - type: string + enum: + - deny + - allow + - type: 'null' + __schema4: + anyOf: + - $ref: '#/components/schemas/__schema5' + - type: 'null' + __schema5: type: array items: anyOf: @@ -8110,6 +8300,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -8166,6 +8357,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -8178,12 +8370,150 @@ components: - Z.AI - FakeProvider - type: string - __schema1: + __schema8: anyOf: - - type: number - - type: string - - type: number - __schema2: + - type: array + items: + type: string + enum: + - int4 + - int8 + - fp4 + - fp6 + - fp8 + - fp16 + - bf16 + - fp32 + - unknown + - type: 'null' + __schema9: + anyOf: + - $ref: '#/components/schemas/ProviderSortUnion' + - type: 'null' + __schema10: + type: object + properties: + prompt: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + completion: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + image: + $ref: '#/components/schemas/__schema14' + audio: + $ref: '#/components/schemas/__schema14' + request: + $ref: '#/components/schemas/__schema14' + __schema11: + type: number + __schema13: {} + __schema14: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + __schema15: + anyOf: + - anyOf: + - type: number + - type: object + properties: + p50: + anyOf: + - type: number + - type: 'null' + p75: + anyOf: + - type: number + - type: 'null' + p90: + anyOf: + - type: number + - type: 'null' + p99: + anyOf: + - type: number + - type: 'null' + - type: 'null' + __schema17: + type: array + items: + oneOf: + - type: object + properties: + id: + type: string + const: auto-router + enabled: + type: boolean + allowed_models: + type: array + items: + type: string + required: + - id + - type: object + properties: + id: + type: string + const: moderation + required: + - id + - type: object + properties: + id: + type: string + const: web + enabled: + type: boolean + max_results: + type: number + search_prompt: + type: string + engine: + type: string + enum: + - native + - exa + required: + - id + - type: object + properties: + id: + type: string + const: file-parser + enabled: + type: boolean + pdf: + type: object + properties: + engine: + type: string + enum: + - mistral-ocr + - pdf-text + - native + required: + - id + - type: object + properties: + id: + type: string + const: response-healing + enabled: + type: boolean + required: + - id + type: object + __schema18: + type: string + maxLength: 128 + __schema19: oneOf: - type: object properties: @@ -8193,11 +8523,11 @@ components: summary: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - summary @@ -8209,11 +8539,11 @@ components: data: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - data @@ -8231,19 +8561,19 @@ components: - type: string - type: 'null' id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type type: object - __schema3: + __schema20: anyOf: - type: string - type: 'null' - __schema4: + __schema21: anyOf: - type: string enum: @@ -8254,9 +8584,7 @@ components: - anthropic-claude-v1 - google-gemini-v1 - type: 'null' - __schema5: - type: number - __schema6: + __schema25: anyOf: - $ref: '#/components/schemas/ChatCompletionFinishReason' - type: 'null' @@ -8584,6 +8912,23 @@ components: required: - role - content + DeveloperMessage: + type: object + properties: + role: + type: string + const: developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + name: + type: string + required: + - role + - content AssistantMessage: type: object properties: @@ -8615,7 +8960,7 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' images: type: array items: @@ -8654,25 +8999,18 @@ components: oneOf: - $ref: '#/components/schemas/SystemMessage' - $ref: '#/components/schemas/UserMessage' - - type: object - properties: - role: - type: string - const: developer - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content + - $ref: '#/components/schemas/DeveloperMessage' - $ref: '#/components/schemas/AssistantMessage' - $ref: '#/components/schemas/ToolResponseMessage' type: object + discriminator: + propertyName: role + mapping: + system: '#/components/schemas/SystemMessage' + user: '#/components/schemas/UserMessage' + developer: '#/components/schemas/DeveloperMessage' + assistant: '#/components/schemas/AssistantMessage' + tool: '#/components/schemas/ToolResponseMessage' ToolDefinitionJson: type: object properties: @@ -8736,242 +9074,10 @@ components: properties: provider: description: When multiple model providers are available, optionally indicate your routing preference. - anyOf: - - type: object - properties: - allow_fallbacks: - 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. - anyOf: - - type: boolean - - type: 'null' - require_parameters: - 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. - anyOf: - - type: boolean - - type: 'null' - data_collection: - description: >- - 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. - anyOf: - - type: string - enum: - - deny - - allow - - type: 'null' - zdr: - anyOf: - - type: boolean - - type: 'null' - enforce_distillable_text: - anyOf: - - type: boolean - - type: 'null' - order: - 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. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - only: - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed - provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - ignore: - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored - provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - quantizations: - description: A list of quantization levels to filter the provider by. - anyOf: - - type: array - items: - type: string - enum: - - int4 - - int8 - - fp4 - - fp6 - - fp8 - - fp16 - - bf16 - - fp32 - - unknown - - type: 'null' - sort: - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load - balancing is performed. - anyOf: - - $ref: '#/components/schemas/ProviderSortUnion' - - type: 'null' - max_price: - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million - tokens, for prompt and completion. - type: object - properties: - prompt: - $ref: '#/components/schemas/__schema1' - completion: - $ref: '#/components/schemas/__schema1' - image: - $ref: '#/components/schemas/__schema1' - audio: - $ref: '#/components/schemas/__schema1' - request: - $ref: '#/components/schemas/__schema1' - preferred_min_throughput: - description: >- - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object - with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are - deprioritized in routing. When using fallback models, this may cause a fallback model to be used - instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - preferred_max_latency: - description: >- - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with - percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are - deprioritized in routing. When using fallback models, this may cause a fallback model to be used - instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - additionalProperties: false - - type: 'null' + $ref: '#/components/schemas/__schema0' plugins: description: Plugins you want to enable for this request, including their settings. - type: array - items: - oneOf: - - type: object - properties: - id: - type: string - const: auto-router - enabled: - type: boolean - allowed_models: - type: array - items: - type: string - required: - - id - - type: object - properties: - id: - type: string - const: moderation - required: - - id - - type: object - properties: - id: - type: string - const: web - enabled: - type: boolean - max_results: - type: number - search_prompt: - type: string - engine: - type: string - enum: - - native - - exa - required: - - id - - type: object - properties: - id: - type: string - const: file-parser - enabled: - type: boolean - pdf: - type: object - properties: - engine: - type: string - enum: - - mistral-ocr - - pdf-text - - native - required: - - id - - type: object - properties: - id: - type: string - const: response-healing - enabled: - type: boolean - required: - - id - type: object + $ref: '#/components/schemas/__schema17' route: anyOf: - type: string @@ -8986,8 +9092,7 @@ components: 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. - type: string - maxLength: 128 + $ref: '#/components/schemas/__schema18' messages: minItems: 1 type: array @@ -9102,7 +9207,7 @@ components: - maxItems: 4 type: array items: - type: string + $ref: '#/components/schemas/ModelName' - type: 'null' stream: default: false @@ -9144,6 +9249,8 @@ components: anyOf: - type: string - type: number + - type: array + items: {} modalities: type: array items: @@ -9161,7 +9268,7 @@ components: type: object properties: finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number message: @@ -9219,14 +9326,14 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' ChatStreamingChoice: type: object properties: delta: $ref: '#/components/schemas/ChatStreamingMessageChunk' finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number logprobs: @@ -9341,263 +9448,6 @@ components: required: - data additionalProperties: false - CompletionFinishReason: - anyOf: - - type: string - enum: - - stop - - length - - content_filter - - type: 'null' - CompletionLogprobs: - type: object - properties: - tokens: - type: array - items: - type: string - token_logprobs: - type: array - items: - type: number - top_logprobs: - anyOf: - - type: array - items: - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - text_offset: - type: array - items: - type: number - required: - - tokens - - token_logprobs - - top_logprobs - - text_offset - CompletionUsage: - type: object - properties: - prompt_tokens: - type: number - completion_tokens: - type: number - total_tokens: - type: number - required: - - prompt_tokens - - completion_tokens - - total_tokens - CompletionCreateParams: - type: object - properties: - model: - $ref: '#/components/schemas/ModelName' - models: - type: array - items: - $ref: '#/components/schemas/ModelName' - prompt: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - type: number - - type: array - items: - type: array - items: - type: number - best_of: - anyOf: - - type: integer - minimum: 1 - maximum: 20 - - type: 'null' - echo: - anyOf: - - type: boolean - - type: 'null' - frequency_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - logit_bias: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - logprobs: - anyOf: - - type: integer - minimum: 0 - maximum: 5 - - type: 'null' - max_tokens: - anyOf: - - type: integer - minimum: 1 - maximum: 9007199254740991 - - type: 'null' - 'n': - anyOf: - - type: integer - minimum: 1 - maximum: 128 - - type: 'null' - presence_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - seed: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: 'null' - stop: - anyOf: - - anyOf: - - type: string - - type: array - items: - type: string - - type: 'null' - stream: - default: false - type: boolean - stream_options: - anyOf: - - type: object - properties: - include_usage: - anyOf: - - type: boolean - - type: 'null' - - type: 'null' - suffix: - anyOf: - - type: string - - type: 'null' - temperature: - anyOf: - - type: number - minimum: 0 - maximum: 2 - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - - type: 'null' - user: - type: string - metadata: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: string - - type: 'null' - response_format: - anyOf: - - oneOf: - - type: object - properties: - type: - type: string - const: text - required: - - type - - type: object - properties: - type: - type: string - const: json_object - required: - - type - - $ref: '#/components/schemas/ResponseFormatJSONSchema' - - $ref: '#/components/schemas/ResponseFormatTextGrammar' - - type: object - properties: - type: - type: string - const: python - required: - - type - type: object - - type: 'null' - required: - - prompt - CompletionChoice: - type: object - properties: - text: - type: string - index: - type: number - logprobs: - anyOf: - - $ref: '#/components/schemas/CompletionLogprobs' - - type: 'null' - finish_reason: - $ref: '#/components/schemas/CompletionFinishReason' - native_finish_reason: - type: string - reasoning: - anyOf: - - type: string - - type: 'null' - required: - - text - - index - - logprobs - - finish_reason - CompletionResponse: - type: object - properties: - id: - type: string - object: - type: string - const: text_completion - created: - type: number - model: - type: string - provider: - type: string - system_fingerprint: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/CompletionChoice' - usage: - $ref: '#/components/schemas/CompletionUsage' - required: - - id - - object - - created - - model - - choices - additionalProperties: false parameters: {} securitySchemes: apiKey: @@ -9724,7 +9574,7 @@ paths: x-speakeasy-name-override: create x-speakeasy-stream-request-field: stream tags: - - anthropic.messages + - Anthropic Messages summary: Create a message description: >- Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended @@ -10612,6 +10462,131 @@ paths: nullable: true description: Router used for the request (e.g., openrouter/auto) example: openrouter/auto + provider_responses: + type: array + nullable: true + items: + type: object + properties: + id: + type: string + endpoint_id: + type: string + model_permaslug: + type: string + provider_name: + type: string + enum: + - AnyScale + - Atoma + - Cent-ML + - CrofAI + - Enfer + - GoPomelo + - HuggingFace + - Hyperbolic 2 + - InoCloud + - Kluster + - Lambda + - Lepton + - Lynn 2 + - Lynn + - Mancer + - Meta + - Modal + - Nineteen + - OctoAI + - Recursal + - Reflection + - Replicate + - SambaNova 2 + - SF Compute + - Targon + - Together 2 + - Ubicloud + - 01.AI + - AI21 + - AionLabs + - Alibaba + - Ambient + - 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 + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - Inceptron + - 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 + - Seed + - SiliconFlow + - Sourceful + - StepFun + - Stealth + - StreamLake + - Switchpoint + - Together + - Upstage + - Venice + - WandB + - Xiaomi + - xAI + - Z.AI + - FakeProvider + status: + type: number + nullable: true + latency: + type: number + is_byok: + type: boolean + required: + - status + description: List of provider responses for this generation, including fallback attempts required: - id - upstream_id @@ -10646,6 +10621,7 @@ paths: - external_user - api_type - router + - provider_responses description: Generation data required: - data @@ -10790,7 +10766,13 @@ paths: tags: - Models x-speakeasy-name-override: listForUser - summary: List models filtered by user provider preferences + description: >- + List models filtered by user provider preferences, [privacy + settings](https://openrouter.ai/docs/guides/privacy/logging), and + [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through + `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region + routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). + summary: List models filtered by user provider preferences, privacy settings, and guardrails security: - bearer: [] responses: @@ -10806,6 +10788,12 @@ paths: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + '404': + description: Not Found - No eligible endpoints found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' '500': description: Internal Server Error content: @@ -13812,55 +13800,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ChatError' - /completions: - post: - summary: Create a completion - x-speakeasy-group: completions - x-speakeasy-name-override: generate - x-speakeasy-stream-request-field: stream - description: Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - tags: - - Completions - requestBody: - required: true - description: Completion request parameters - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionCreateParams' - responses: - '200': - description: Successful completion response - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionResponse' - description: Completion response - '400': - description: Bad request - invalid parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '401': - description: Unauthorized - invalid API key - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '429': - description: Too many requests - rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - operationId: createCompletions servers: - url: https://openrouter.ai/api/v1 description: Production server @@ -13875,10 +13814,10 @@ tags: description: API key management endpoints - name: Analytics description: Analytics and usage endpoints + - name: Anthropic Messages + description: Anthropic Messages endpoints - name: Chat description: Chat completion endpoints - - name: Completions - description: Text completion endpoints - name: Credits description: Credit management endpoints - name: Embeddings @@ -13895,8 +13834,6 @@ tags: description: OAuth authentication endpoints - name: Providers description: Provider information endpoints - - name: anthropic.messages - description: anthropic.messages endpoints - name: beta.responses description: beta.responses endpoints x-fern-base-path: / diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index e183d3f..9f02aab 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -2,7 +2,7 @@ openapi: 3.1.0 info: title: OpenRouter API version: 1.0.0 - description: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features + description: OpenAI-compatible API with additional OpenRouter features contact: name: OpenRouter Support url: https://openrouter.ai/docs @@ -3561,6 +3561,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -3617,6 +3618,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -3668,7 +3670,7 @@ components: - type: 'null' BigNumberUnion: type: string - description: A value in string format that is a large number + description: Price per million prompt tokens example: 1000 PercentileThroughputCutoffs: type: object @@ -3974,13 +3976,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request 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: @@ -4397,7 +4407,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded x-speakeasy-unknown-values: allow stop_sequence: type: string @@ -4857,7 +4866,6 @@ components: - tool_use - pause_turn - refusal - - model_context_window_exceeded x-speakeasy-unknown-values: allow stop_sequence: type: string @@ -6542,6 +6550,21 @@ components: - role - content description: Anthropic message with OpenRouter extensions + AnthropicOutputConfig: + type: object + properties: + effort: + type: string + nullable: true + enum: + - low + - medium + - high + description: >- + How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer. Valid values are `low`, `medium`, or `high`. + example: medium + x-speakeasy-unknown-values: allow + description: Configuration for controlling output behavior. Currently supports the effort parameter for Claude Opus 4.5. AnthropicMessagesRequest: type: object properties: @@ -7047,13 +7070,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request 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: @@ -7164,6 +7195,8 @@ components: type: array items: type: string + output_config: + $ref: '#/components/schemas/AnthropicOutputConfig' required: - model - max_tokens @@ -7384,13 +7417,21 @@ components: prompt: $ref: '#/components/schemas/BigNumberUnion' completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request 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: @@ -7402,31 +7443,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -7890,31 +7957,57 @@ components: type: object properties: prompt: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number completion: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number request: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_token: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number image_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number audio_output: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_audio_cache: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number web_search: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number internal_reasoning: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_read: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number input_cache_write: - $ref: '#/components/schemas/BigNumberUnion' + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: A number or string value representing a large number discount: type: number required: @@ -8116,6 +8209,89 @@ components: p90: 28.3 p99: 15.1 __schema0: + anyOf: + - type: object + properties: + allow_fallbacks: + 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. + + $ref: '#/components/schemas/__schema1' + require_parameters: + 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. + $ref: '#/components/schemas/__schema1' + data_collection: + description: >- + 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. + $ref: '#/components/schemas/__schema3' + zdr: + anyOf: + - type: boolean + - type: 'null' + enforce_distillable_text: + anyOf: + - type: boolean + - type: 'null' + order: + 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. + $ref: '#/components/schemas/__schema4' + only: + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. + $ref: '#/components/schemas/__schema4' + ignore: + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. + $ref: '#/components/schemas/__schema4' + quantizations: + description: A list of quantization levels to filter the provider by. + $ref: '#/components/schemas/__schema8' + sort: + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + $ref: '#/components/schemas/__schema9' + max_price: + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. + $ref: '#/components/schemas/__schema10' + preferred_min_throughput: + description: >- + Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + preferred_max_latency: + description: >- + Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. + $ref: '#/components/schemas/__schema15' + additionalProperties: false + - type: 'null' + __schema1: + anyOf: + - type: boolean + - type: 'null' + __schema3: + anyOf: + - type: string + enum: + - deny + - allow + x-speakeasy-unknown-values: allow + - type: 'null' + __schema4: + anyOf: + - $ref: '#/components/schemas/__schema5' + - type: 'null' + __schema5: type: array items: anyOf: @@ -8124,6 +8300,7 @@ components: - AI21 - AionLabs - Alibaba + - Ambient - Amazon Bedrock - Amazon Nova - Anthropic @@ -8180,6 +8357,7 @@ components: - Seed - SiliconFlow - Sourceful + - StepFun - Stealth - StreamLake - Switchpoint @@ -8193,12 +8371,153 @@ components: - FakeProvider x-speakeasy-unknown-values: allow - type: string - __schema1: + __schema8: anyOf: - - type: number - - type: string - - type: number - __schema2: + - type: array + items: + type: string + enum: + - int4 + - int8 + - fp4 + - fp6 + - fp8 + - fp16 + - bf16 + - fp32 + - unknown + x-speakeasy-unknown-values: allow + - type: 'null' + __schema9: + anyOf: + - $ref: '#/components/schemas/ProviderSortUnion' + - type: 'null' + __schema10: + type: object + properties: + prompt: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + completion: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + image: + $ref: '#/components/schemas/__schema14' + audio: + $ref: '#/components/schemas/__schema14' + request: + $ref: '#/components/schemas/__schema14' + __schema11: + type: number + __schema13: {} + __schema14: + anyOf: + - $ref: '#/components/schemas/__schema11' + - $ref: '#/components/schemas/ModelName' + - $ref: '#/components/schemas/__schema13' + __schema15: + anyOf: + - anyOf: + - type: number + - type: object + properties: + p50: + anyOf: + - type: number + - type: 'null' + p75: + anyOf: + - type: number + - type: 'null' + p90: + anyOf: + - type: number + - type: 'null' + p99: + anyOf: + - type: number + - type: 'null' + - type: 'null' + __schema17: + type: array + items: + oneOf: + - type: object + properties: + id: + type: string + const: auto-router + enabled: + type: boolean + allowed_models: + type: array + items: + type: string + required: + - id + - type: object + properties: + id: + type: string + const: moderation + required: + - id + - type: object + properties: + id: + type: string + const: web + enabled: + type: boolean + max_results: + type: number + search_prompt: + type: string + engine: + type: string + enum: + - native + - exa + x-speakeasy-unknown-values: allow + required: + - id + - type: object + properties: + id: + type: string + const: file-parser + enabled: + type: boolean + pdf: + type: object + properties: + engine: + type: string + enum: + - mistral-ocr + - pdf-text + - native + x-speakeasy-unknown-values: allow + required: + - id + - type: object + properties: + id: + type: string + const: response-healing + enabled: + type: boolean + required: + - id + type: object + __schema18: + type: string + maxLength: 128 + __schema19: oneOf: - type: object properties: @@ -8208,11 +8527,11 @@ components: summary: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - summary @@ -8224,11 +8543,11 @@ components: data: type: string id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type - data @@ -8246,19 +8565,19 @@ components: - type: string - type: 'null' id: - $ref: '#/components/schemas/__schema3' + $ref: '#/components/schemas/__schema20' format: - $ref: '#/components/schemas/__schema4' + $ref: '#/components/schemas/__schema21' index: - $ref: '#/components/schemas/__schema5' + $ref: '#/components/schemas/__schema11' required: - type type: object - __schema3: + __schema20: anyOf: - type: string - type: 'null' - __schema4: + __schema21: anyOf: - type: string enum: @@ -8270,9 +8589,7 @@ components: - google-gemini-v1 x-speakeasy-unknown-values: allow - type: 'null' - __schema5: - type: number - __schema6: + __schema25: anyOf: - $ref: '#/components/schemas/ChatCompletionFinishReason' - type: 'null' @@ -8603,6 +8920,23 @@ components: required: - role - content + DeveloperMessage: + type: object + properties: + role: + type: string + const: developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + name: + type: string + required: + - role + - content AssistantMessage: type: object properties: @@ -8634,7 +8968,7 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' images: type: array items: @@ -8673,25 +9007,18 @@ components: oneOf: - $ref: '#/components/schemas/SystemMessage' - $ref: '#/components/schemas/UserMessage' - - type: object - properties: - role: - type: string - const: developer - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content + - $ref: '#/components/schemas/DeveloperMessage' - $ref: '#/components/schemas/AssistantMessage' - $ref: '#/components/schemas/ToolResponseMessage' type: object + discriminator: + propertyName: role + mapping: + system: '#/components/schemas/SystemMessage' + user: '#/components/schemas/UserMessage' + developer: '#/components/schemas/DeveloperMessage' + assistant: '#/components/schemas/AssistantMessage' + tool: '#/components/schemas/ToolResponseMessage' ToolDefinitionJson: type: object properties: @@ -8755,231 +9082,10 @@ components: properties: provider: description: When multiple model providers are available, optionally indicate your routing preference. - anyOf: - - type: object - properties: - allow_fallbacks: - 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. - - anyOf: - - type: boolean - - type: 'null' - require_parameters: - 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. - anyOf: - - type: boolean - - type: 'null' - data_collection: - description: >- - 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. - anyOf: - - type: string - enum: - - deny - - allow - x-speakeasy-unknown-values: allow - - type: 'null' - zdr: - anyOf: - - type: boolean - - type: 'null' - enforce_distillable_text: - anyOf: - - type: boolean - - type: 'null' - order: - 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. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - only: - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - ignore: - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. - anyOf: - - $ref: '#/components/schemas/__schema0' - - type: 'null' - quantizations: - description: A list of quantization levels to filter the provider by. - anyOf: - - type: array - items: - type: string - enum: - - int4 - - int8 - - fp4 - - fp6 - - fp8 - - fp16 - - bf16 - - fp32 - - unknown - x-speakeasy-unknown-values: allow - - type: 'null' - sort: - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - anyOf: - - $ref: '#/components/schemas/ProviderSortUnion' - - type: 'null' - max_price: - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - type: object - properties: - prompt: - $ref: '#/components/schemas/__schema1' - completion: - $ref: '#/components/schemas/__schema1' - image: - $ref: '#/components/schemas/__schema1' - audio: - $ref: '#/components/schemas/__schema1' - request: - $ref: '#/components/schemas/__schema1' - preferred_min_throughput: - description: >- - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - preferred_max_latency: - description: >- - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - additionalProperties: false - - type: 'null' + $ref: '#/components/schemas/__schema0' plugins: description: Plugins you want to enable for this request, including their settings. - type: array - items: - oneOf: - - type: object - properties: - id: - type: string - const: auto-router - enabled: - type: boolean - allowed_models: - type: array - items: - type: string - required: - - id - - type: object - properties: - id: - type: string - const: moderation - required: - - id - - type: object - properties: - id: - type: string - const: web - enabled: - type: boolean - max_results: - type: number - search_prompt: - type: string - engine: - type: string - enum: - - native - - exa - x-speakeasy-unknown-values: allow - required: - - id - - type: object - properties: - id: - type: string - const: file-parser - enabled: - type: boolean - pdf: - type: object - properties: - engine: - type: string - enum: - - mistral-ocr - - pdf-text - - native - x-speakeasy-unknown-values: allow - required: - - id - - type: object - properties: - id: - type: string - const: response-healing - enabled: - type: boolean - required: - - id - type: object + $ref: '#/components/schemas/__schema17' route: anyOf: - type: string @@ -8993,8 +9099,7 @@ components: session_id: description: >- 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. - type: string - maxLength: 128 + $ref: '#/components/schemas/__schema18' messages: minItems: 1 type: array @@ -9110,7 +9215,7 @@ components: - maxItems: 4 type: array items: - type: string + $ref: '#/components/schemas/ModelName' - type: 'null' stream: default: false @@ -9152,6 +9257,8 @@ components: anyOf: - type: string - type: number + - type: array + items: {} modalities: type: array items: @@ -9170,7 +9277,7 @@ components: type: object properties: finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number message: @@ -9228,14 +9335,14 @@ components: reasoning_details: type: array items: - $ref: '#/components/schemas/__schema2' + $ref: '#/components/schemas/__schema19' ChatStreamingChoice: type: object properties: delta: $ref: '#/components/schemas/ChatStreamingMessageChunk' finish_reason: - $ref: '#/components/schemas/__schema6' + $ref: '#/components/schemas/__schema25' index: type: number logprobs: @@ -9350,264 +9457,6 @@ components: required: - data additionalProperties: false - CompletionFinishReason: - anyOf: - - type: string - enum: - - stop - - length - - content_filter - x-speakeasy-unknown-values: allow - - type: 'null' - CompletionLogprobs: - type: object - properties: - tokens: - type: array - items: - type: string - token_logprobs: - type: array - items: - type: number - top_logprobs: - anyOf: - - type: array - items: - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - text_offset: - type: array - items: - type: number - required: - - tokens - - token_logprobs - - top_logprobs - - text_offset - CompletionUsage: - type: object - properties: - prompt_tokens: - type: number - completion_tokens: - type: number - total_tokens: - type: number - required: - - prompt_tokens - - completion_tokens - - total_tokens - CompletionCreateParams: - type: object - properties: - model: - $ref: '#/components/schemas/ModelName' - models: - type: array - items: - $ref: '#/components/schemas/ModelName' - prompt: - anyOf: - - type: string - - type: array - items: - type: string - - type: array - items: - type: number - - type: array - items: - type: array - items: - type: number - best_of: - anyOf: - - type: integer - minimum: 1 - maximum: 20 - - type: 'null' - echo: - anyOf: - - type: boolean - - type: 'null' - frequency_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - logit_bias: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - logprobs: - anyOf: - - type: integer - minimum: 0 - maximum: 5 - - type: 'null' - max_tokens: - anyOf: - - type: integer - minimum: 1 - maximum: 9007199254740991 - - type: 'null' - 'n': - anyOf: - - type: integer - minimum: 1 - maximum: 128 - - type: 'null' - presence_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - seed: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: 'null' - stop: - anyOf: - - anyOf: - - type: string - - type: array - items: - type: string - - type: 'null' - stream: - default: false - type: boolean - stream_options: - anyOf: - - type: object - properties: - include_usage: - anyOf: - - type: boolean - - type: 'null' - - type: 'null' - suffix: - anyOf: - - type: string - - type: 'null' - temperature: - anyOf: - - type: number - minimum: 0 - maximum: 2 - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - - type: 'null' - user: - type: string - metadata: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: string - - type: 'null' - response_format: - anyOf: - - oneOf: - - type: object - properties: - type: - type: string - const: text - required: - - type - - type: object - properties: - type: - type: string - const: json_object - required: - - type - - $ref: '#/components/schemas/ResponseFormatJSONSchema' - - $ref: '#/components/schemas/ResponseFormatTextGrammar' - - type: object - properties: - type: - type: string - const: python - required: - - type - type: object - - type: 'null' - required: - - prompt - CompletionChoice: - type: object - properties: - text: - type: string - index: - type: number - logprobs: - anyOf: - - $ref: '#/components/schemas/CompletionLogprobs' - - type: 'null' - finish_reason: - $ref: '#/components/schemas/CompletionFinishReason' - native_finish_reason: - type: string - reasoning: - anyOf: - - type: string - - type: 'null' - required: - - text - - index - - logprobs - - finish_reason - CompletionResponse: - type: object - properties: - id: - type: string - object: - type: string - const: text_completion - created: - type: number - model: - type: string - provider: - type: string - system_fingerprint: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/CompletionChoice' - usage: - $ref: '#/components/schemas/CompletionUsage' - required: - - id - - object - - created - - model - - choices - additionalProperties: false parameters: {AppIdentifier: {name: HTTP-Referer, in: header, schema: {type: string}, description: "The app identifier should be your app's URL and is used as the primary identifier for rankings.\nThis is used to track API usage per application.\n"}, AppDisplayName: {name: X-Title, in: header, schema: {type: string}, description: "The app display name allows you to customize how your app appears in OpenRouter's dashboard.\n"}} securitySchemes: apiKey: @@ -9734,7 +9583,7 @@ paths: x-speakeasy-name-override: create x-speakeasy-stream-request-field: stream tags: - - anthropic.messages + - Anthropic Messages summary: Create a message description: >- Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking. @@ -10621,6 +10470,132 @@ paths: nullable: true description: Router used for the request (e.g., openrouter/auto) example: openrouter/auto + provider_responses: + type: array + nullable: true + items: + type: object + properties: + id: + type: string + endpoint_id: + type: string + model_permaslug: + type: string + provider_name: + type: string + enum: + - AnyScale + - Atoma + - Cent-ML + - CrofAI + - Enfer + - GoPomelo + - HuggingFace + - Hyperbolic 2 + - InoCloud + - Kluster + - Lambda + - Lepton + - Lynn 2 + - Lynn + - Mancer + - Meta + - Modal + - Nineteen + - OctoAI + - Recursal + - Reflection + - Replicate + - SambaNova 2 + - SF Compute + - Targon + - Together 2 + - Ubicloud + - 01.AI + - AI21 + - AionLabs + - Alibaba + - Ambient + - 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 + - Google + - Google AI Studio + - Groq + - Hyperbolic + - Inception + - Inceptron + - 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 + - Seed + - SiliconFlow + - Sourceful + - StepFun + - Stealth + - StreamLake + - Switchpoint + - Together + - Upstage + - Venice + - WandB + - Xiaomi + - xAI + - Z.AI + - FakeProvider + x-speakeasy-unknown-values: allow + status: + type: number + nullable: true + latency: + type: number + is_byok: + type: boolean + required: + - status + description: List of provider responses for this generation, including fallback attempts required: - id - upstream_id @@ -10655,6 +10630,7 @@ paths: - external_user - api_type - router + - provider_responses description: Generation data required: - data @@ -10787,7 +10763,9 @@ paths: tags: - Models x-speakeasy-name-override: listForUser - summary: List models filtered by user provider preferences + description: >- + List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). + summary: List models filtered by user provider preferences, privacy settings, and guardrails security: - bearer: [] responses: @@ -10803,6 +10781,12 @@ paths: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' + '404': + description: Not Found - No eligible endpoints found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' '500': description: Internal Server Error content: @@ -13802,55 +13786,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ChatError' - /completions: - post: - summary: Create a completion - x-speakeasy-group: completions - x-speakeasy-name-override: generate - x-speakeasy-stream-request-field: stream - description: Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - tags: - - Completions - requestBody: - required: true - description: Completion request parameters - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionCreateParams' - responses: - '200': - description: Successful completion response - content: - application/json: - schema: - $ref: '#/components/schemas/CompletionResponse' - description: Completion response - '400': - description: Bad request - invalid parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '401': - description: Unauthorized - invalid API key - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '429': - description: Too many requests - rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - operationId: createCompletions servers: - url: https://openrouter.ai/api/v1 description: Production server @@ -13865,10 +13800,10 @@ tags: description: API key management endpoints - name: Analytics description: Analytics and usage endpoints + - name: Anthropic Messages + description: Anthropic Messages endpoints - name: Chat description: Chat completion endpoints - - name: Completions - description: Text completion endpoints - name: Credits description: Credit management endpoints - name: Embeddings @@ -13885,8 +13820,6 @@ tags: description: OAuth authentication endpoints - name: Providers description: Provider information endpoints - - name: anthropic.messages - description: anthropic.messages endpoints - name: beta.responses description: beta.responses endpoints x-fern-base-path: / diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ff94a13..14cc4ad 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -8,19 +8,20 @@ sources: - latest OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:291e215687f85db05005d79dd87602a75b8086f39a841700fdbaaff7690b4f76 - sourceBlobDigest: sha256:166639d08f0ae9687cea532ed8a93db59e63293c6a6f4d17d63f015b60d643d2 + sourceRevisionDigest: sha256:9726bd1a602e2f5f3665445896ccad693820754350ead01d7aef39e0dedeb3dc + sourceBlobDigest: sha256:f8e66605c401e126a5f39b6e0272dd792182257c5162fdfbf7c5a815c516c581 tags: - latest + - main - 1.0.0 targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:291e215687f85db05005d79dd87602a75b8086f39a841700fdbaaff7690b4f76 - sourceBlobDigest: sha256:166639d08f0ae9687cea532ed8a93db59e63293c6a6f4d17d63f015b60d643d2 + sourceRevisionDigest: sha256:9726bd1a602e2f5f3665445896ccad693820754350ead01d7aef39e0dedeb3dc + sourceBlobDigest: sha256:f8e66605c401e126a5f39b6e0272dd792182257c5162fdfbf7c5a815c516c581 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f19eae09ec90a23147935f07a86f75dbbc998e6bac3b820351a1e5f147fec590 + codeSamplesRevisionDigest: sha256:6719e0045ac51c8ab2461cbd23189a7b289fad9032460c92183e5845f9e43f61 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.666.0 diff --git a/docs/components/assistantmessage.md b/docs/components/assistantmessage.md index 532cbb2..127aee3 100644 --- a/docs/components/assistantmessage.md +++ b/docs/components/assistantmessage.md @@ -11,5 +11,5 @@ | `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A | | `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A | +| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A | | `images` | List[[components.Image](../components/image.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparams.md b/docs/components/chatgenerationparams.md index f01af13..577c2ab 100644 --- a/docs/components/chatgenerationparams.md +++ b/docs/components/chatgenerationparams.md @@ -3,34 +3,34 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | -| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | -| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | -| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A | -| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A | -| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | -| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `provider` | [OptionalNullable[components.Schema0]](../components/schema0.md) | :heavy_minus_sign: | N/A | +| `plugins` | List[[components.Schema17](../components/schema17.md)] | :heavy_minus_sign: | N/A | +| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A | +| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `models` | List[*str*] | :heavy_minus_sign: | N/A | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A | +| `response_format` | [Optional[components.ResponseFormat]](../components/responseformat.md) | :heavy_minus_sign: | N/A | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | +| `stop` | [OptionalNullable[components.Stop]](../components/stop.md) | :heavy_minus_sign: | N/A | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | +| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A | +| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | +| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsimageconfig.md b/docs/components/chatgenerationparamsimageconfig.md index 18403aa..d5a692a 100644 --- a/docs/components/chatgenerationparamsimageconfig.md +++ b/docs/components/chatgenerationparamsimageconfig.md @@ -15,3 +15,9 @@ value: str = /* values here */ value: float = /* values here */ ``` +### `List[Any]` + +```python +value: List[Any] = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamsmaxprice.md b/docs/components/chatgenerationparamsmaxprice.md deleted file mode 100644 index b3a2bf4..0000000 --- a/docs/components/chatgenerationparamsmaxprice.md +++ /dev/null @@ -1,14 +0,0 @@ -# ChatGenerationParamsMaxPrice - -The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `prompt` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `completion` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `image` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `audio` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `request` | *Optional[Any]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspluginunion.md b/docs/components/chatgenerationparamspluginunion.md deleted file mode 100644 index 5457d76..0000000 --- a/docs/components/chatgenerationparamspluginunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# ChatGenerationParamsPluginUnion - - -## Supported Types - -### `components.ChatGenerationParamsPluginAutoRouter` - -```python -value: components.ChatGenerationParamsPluginAutoRouter = /* values here */ -``` - -### `components.ChatGenerationParamsPluginModeration` - -```python -value: components.ChatGenerationParamsPluginModeration = /* values here */ -``` - -### `components.ChatGenerationParamsPluginWeb` - -```python -value: components.ChatGenerationParamsPluginWeb = /* values here */ -``` - -### `components.ChatGenerationParamsPluginFileParser` - -```python -value: components.ChatGenerationParamsPluginFileParser = /* values here */ -``` - -### `components.ChatGenerationParamsPluginResponseHealing` - -```python -value: components.ChatGenerationParamsPluginResponseHealing = /* values here */ -``` - diff --git a/docs/components/chatgenerationparamspreferredmaxlatencyunion.md b/docs/components/chatgenerationparamspreferredmaxlatencyunion.md deleted file mode 100644 index 3b22111..0000000 --- a/docs/components/chatgenerationparamspreferredmaxlatencyunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# ChatGenerationParamsPreferredMaxLatencyUnion - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `components.ChatGenerationParamsPreferredMaxLatency` - -```python -value: components.ChatGenerationParamsPreferredMaxLatency = /* values here */ -``` - diff --git a/docs/components/chatgenerationparamspreferredminthroughput.md b/docs/components/chatgenerationparamspreferredminthroughput.md deleted file mode 100644 index 260394d..0000000 --- a/docs/components/chatgenerationparamspreferredminthroughput.md +++ /dev/null @@ -1,11 +0,0 @@ -# ChatGenerationParamsPreferredMinThroughput - - -## Fields - -| Field | Type | Required | Description | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspreferredminthroughputunion.md b/docs/components/chatgenerationparamspreferredminthroughputunion.md deleted file mode 100644 index 3803e24..0000000 --- a/docs/components/chatgenerationparamspreferredminthroughputunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# ChatGenerationParamsPreferredMinThroughputUnion - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `components.ChatGenerationParamsPreferredMinThroughput` - -```python -value: components.ChatGenerationParamsPreferredMinThroughput = /* values here */ -``` - diff --git a/docs/components/chatgenerationparamsprovider.md b/docs/components/chatgenerationparamsprovider.md deleted file mode 100644 index 3d486fa..0000000 --- a/docs/components/chatgenerationparamsprovider.md +++ /dev/null @@ -1,20 +0,0 @@ -# ChatGenerationParamsProvider - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| -| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | -| `data_collection` | [OptionalNullable[components.ChatGenerationParamsDataCollection]](../components/chatgenerationparamsdatacollection.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. | -| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `order` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | -| `only` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | -| `ignore` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | -| `quantizations` | List[[components.Quantizations](../components/quantizations.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | -| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | -| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | -| `preferred_min_throughput` | [OptionalNullable[components.ChatGenerationParamsPreferredMinThroughputUnion]](../components/chatgenerationparamspreferredminthroughputunion.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | -| `preferred_max_latency` | [OptionalNullable[components.ChatGenerationParamsPreferredMaxLatencyUnion]](../components/chatgenerationparamspreferredmaxlatencyunion.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsresponseformatunion.md b/docs/components/chatgenerationparamsresponseformatunion.md deleted file mode 100644 index 19f2e8c..0000000 --- a/docs/components/chatgenerationparamsresponseformatunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# ChatGenerationParamsResponseFormatUnion - - -## Supported Types - -### `components.ChatGenerationParamsResponseFormatText` - -```python -value: components.ChatGenerationParamsResponseFormatText = /* values here */ -``` - -### `components.ChatGenerationParamsResponseFormatJSONObject` - -```python -value: components.ChatGenerationParamsResponseFormatJSONObject = /* values here */ -``` - -### `components.ResponseFormatJSONSchema` - -```python -value: components.ResponseFormatJSONSchema = /* values here */ -``` - -### `components.ResponseFormatTextGrammar` - -```python -value: components.ResponseFormatTextGrammar = /* values here */ -``` - -### `components.ChatGenerationParamsResponseFormatPython` - -```python -value: components.ChatGenerationParamsResponseFormatPython = /* values here */ -``` - diff --git a/docs/components/chatstreamingmessagechunk.md b/docs/components/chatstreamingmessagechunk.md index eb70467..8c62a97 100644 --- a/docs/components/chatstreamingmessagechunk.md +++ b/docs/components/chatstreamingmessagechunk.md @@ -10,4 +10,4 @@ | `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A | -| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completion.md b/docs/components/completion.md new file mode 100644 index 0000000..ce9609b --- /dev/null +++ b/docs/components/completion.md @@ -0,0 +1,23 @@ +# Completion + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/components/completionchoice.md b/docs/components/completionchoice.md deleted file mode 100644 index cb489be..0000000 --- a/docs/components/completionchoice.md +++ /dev/null @@ -1,13 +0,0 @@ -# CompletionChoice - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `text` | *str* | :heavy_check_mark: | N/A | -| `index` | *float* | :heavy_check_mark: | N/A | -| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A | -| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A | -| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparams.md b/docs/components/completioncreateparams.md deleted file mode 100644 index 7f7c9f4..0000000 --- a/docs/components/completioncreateparams.md +++ /dev/null @@ -1,28 +0,0 @@ -# CompletionCreateParams - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `prompt` | [components.Prompt](../components/prompt.md) | :heavy_check_mark: | N/A | -| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.StreamOptions]](../components/streamoptions.md) | :heavy_minus_sign: | N/A | -| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformatjsonobject.md b/docs/components/completioncreateparamsresponseformatjsonobject.md deleted file mode 100644 index a5c6d3b..0000000 --- a/docs/components/completioncreateparamsresponseformatjsonobject.md +++ /dev/null @@ -1,8 +0,0 @@ -# CompletionCreateParamsResponseFormatJSONObject - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformatpython.md b/docs/components/completioncreateparamsresponseformatpython.md deleted file mode 100644 index e0bcf67..0000000 --- a/docs/components/completioncreateparamsresponseformatpython.md +++ /dev/null @@ -1,8 +0,0 @@ -# CompletionCreateParamsResponseFormatPython - - -## Fields - -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `type` | *Literal["python"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformattext.md b/docs/components/completioncreateparamsresponseformattext.md deleted file mode 100644 index bb80891..0000000 --- a/docs/components/completioncreateparamsresponseformattext.md +++ /dev/null @@ -1,8 +0,0 @@ -# CompletionCreateParamsResponseFormatText - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `type` | *Literal["text"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completioncreateparamsresponseformatunion.md b/docs/components/completioncreateparamsresponseformatunion.md deleted file mode 100644 index 53050dc..0000000 --- a/docs/components/completioncreateparamsresponseformatunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# CompletionCreateParamsResponseFormatUnion - - -## Supported Types - -### `components.CompletionCreateParamsResponseFormatText` - -```python -value: components.CompletionCreateParamsResponseFormatText = /* values here */ -``` - -### `components.CompletionCreateParamsResponseFormatJSONObject` - -```python -value: components.CompletionCreateParamsResponseFormatJSONObject = /* values here */ -``` - -### `components.ResponseFormatJSONSchema` - -```python -value: components.ResponseFormatJSONSchema = /* values here */ -``` - -### `components.ResponseFormatTextGrammar` - -```python -value: components.ResponseFormatTextGrammar = /* values here */ -``` - -### `components.CompletionCreateParamsResponseFormatPython` - -```python -value: components.CompletionCreateParamsResponseFormatPython = /* values here */ -``` - diff --git a/docs/components/completionfinishreason.md b/docs/components/completionfinishreason.md deleted file mode 100644 index 4a4e249..0000000 --- a/docs/components/completionfinishreason.md +++ /dev/null @@ -1,10 +0,0 @@ -# CompletionFinishReason - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `STOP` | stop | -| `LENGTH` | length | -| `CONTENT_FILTER` | content_filter | \ No newline at end of file diff --git a/docs/components/completionlogprobs.md b/docs/components/completionlogprobs.md deleted file mode 100644 index 9a8b558..0000000 --- a/docs/components/completionlogprobs.md +++ /dev/null @@ -1,11 +0,0 @@ -# CompletionLogprobs - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `tokens` | List[*str*] | :heavy_check_mark: | N/A | -| `token_logprobs` | List[*float*] | :heavy_check_mark: | N/A | -| `top_logprobs` | List[Dict[str, *float*]] | :heavy_check_mark: | N/A | -| `text_offset` | List[*float*] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/completionresponse.md b/docs/components/completionresponse.md deleted file mode 100644 index 3e9a9bd..0000000 --- a/docs/components/completionresponse.md +++ /dev/null @@ -1,15 +0,0 @@ -# CompletionResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `id` | *str* | :heavy_check_mark: | N/A | -| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A | -| `created` | *float* | :heavy_check_mark: | N/A | -| `model` | *str* | :heavy_check_mark: | N/A | -| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A | -| `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/completionusage.md b/docs/components/completionusage.md deleted file mode 100644 index e9e3983..0000000 --- a/docs/components/completionusage.md +++ /dev/null @@ -1,10 +0,0 @@ -# CompletionUsage - - -## Fields - -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `prompt_tokens` | *float* | :heavy_check_mark: | N/A | -| `completion_tokens` | *float* | :heavy_check_mark: | N/A | -| `total_tokens` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/developermessage.md b/docs/components/developermessage.md new file mode 100644 index 0000000..e767787 --- /dev/null +++ b/docs/components/developermessage.md @@ -0,0 +1,10 @@ +# DeveloperMessage + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A | +| `content` | [components.DeveloperMessageContent](../components/developermessagecontent.md) | :heavy_check_mark: | N/A | +| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/messagecontent.md b/docs/components/developermessagecontent.md similarity index 89% rename from docs/components/messagecontent.md rename to docs/components/developermessagecontent.md index 6bbe93b..6a804dd 100644 --- a/docs/components/messagecontent.md +++ b/docs/components/developermessagecontent.md @@ -1,4 +1,4 @@ -# MessageContent +# DeveloperMessageContent ## Supported Types diff --git a/docs/components/message.md b/docs/components/message.md index 060be6a..fb33171 100644 --- a/docs/components/message.md +++ b/docs/components/message.md @@ -15,10 +15,10 @@ value: components.SystemMessage = /* values here */ value: components.UserMessage = /* values here */ ``` -### `components.MessageDeveloper` +### `components.DeveloperMessage` ```python -value: components.MessageDeveloper = /* values here */ +value: components.DeveloperMessage = /* values here */ ``` ### `components.AssistantMessage` diff --git a/docs/components/messagedeveloper.md b/docs/components/messagedeveloper.md deleted file mode 100644 index 8eb4529..0000000 --- a/docs/components/messagedeveloper.md +++ /dev/null @@ -1,10 +0,0 @@ -# MessageDeveloper - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A | -| `content` | [components.MessageContent](../components/messagecontent.md) | :heavy_check_mark: | N/A | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/openresponsesrequest.md b/docs/components/openresponsesrequest.md index 072b47f..5eb4cc6 100644 --- a/docs/components/openresponsesrequest.md +++ b/docs/components/openresponsesrequest.md @@ -37,7 +37,7 @@ Request schema for Responses endpoint | `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | \ No newline at end of file diff --git a/docs/components/openresponsesrequestmaxprice.md b/docs/components/openresponsesrequestmaxprice.md index e3e7a4c..0b5bbdc 100644 --- a/docs/components/openresponsesrequestmaxprice.md +++ b/docs/components/openresponsesrequestmaxprice.md @@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 | +| `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginunion.md b/docs/components/openresponsesrequestpluginunion.md deleted file mode 100644 index e164b2e..0000000 --- a/docs/components/openresponsesrequestpluginunion.md +++ /dev/null @@ -1,35 +0,0 @@ -# OpenResponsesRequestPluginUnion - - -## Supported Types - -### `components.OpenResponsesRequestPluginAutoRouter` - -```python -value: components.OpenResponsesRequestPluginAutoRouter = /* values here */ -``` - -### `components.OpenResponsesRequestPluginModeration` - -```python -value: components.OpenResponsesRequestPluginModeration = /* values here */ -``` - -### `components.OpenResponsesRequestPluginWeb` - -```python -value: components.OpenResponsesRequestPluginWeb = /* values here */ -``` - -### `components.OpenResponsesRequestPluginFileParser` - -```python -value: components.OpenResponsesRequestPluginFileParser = /* values here */ -``` - -### `components.OpenResponsesRequestPluginResponseHealing` - -```python -value: components.OpenResponsesRequestPluginResponseHealing = /* values here */ -``` - diff --git a/docs/components/plugin.md b/docs/components/plugin.md new file mode 100644 index 0000000..7fd669e --- /dev/null +++ b/docs/components/plugin.md @@ -0,0 +1,35 @@ +# Plugin + + +## Supported Types + +### `components.PluginAutoRouter` + +```python +value: components.PluginAutoRouter = /* values here */ +``` + +### `components.PluginModeration` + +```python +value: components.PluginModeration = /* values here */ +``` + +### `components.PluginWeb` + +```python +value: components.PluginWeb = /* values here */ +``` + +### `components.PluginFileParser` + +```python +value: components.PluginFileParser = /* values here */ +``` + +### `components.PluginResponseHealing` + +```python +value: components.PluginResponseHealing = /* values here */ +``` + diff --git a/docs/components/openresponsesrequestpluginautorouter.md b/docs/components/pluginautorouter.md similarity index 99% rename from docs/components/openresponsesrequestpluginautorouter.md rename to docs/components/pluginautorouter.md index 21de153..917f1cc 100644 --- a/docs/components/openresponsesrequestpluginautorouter.md +++ b/docs/components/pluginautorouter.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginAutoRouter +# PluginAutoRouter ## Fields diff --git a/docs/components/openresponsesrequestpluginfileparser.md b/docs/components/pluginfileparser.md similarity index 97% rename from docs/components/openresponsesrequestpluginfileparser.md rename to docs/components/pluginfileparser.md index 34d0801..c36d2a1 100644 --- a/docs/components/openresponsesrequestpluginfileparser.md +++ b/docs/components/pluginfileparser.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginFileParser +# PluginFileParser ## Fields diff --git a/docs/components/openresponsesrequestpluginmoderation.md b/docs/components/pluginmoderation.md similarity index 94% rename from docs/components/openresponsesrequestpluginmoderation.md rename to docs/components/pluginmoderation.md index 69b87cc..e1b99e8 100644 --- a/docs/components/openresponsesrequestpluginmoderation.md +++ b/docs/components/pluginmoderation.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginModeration +# PluginModeration ## Fields diff --git a/docs/components/openresponsesrequestpluginresponsehealing.md b/docs/components/pluginresponsehealing.md similarity index 97% rename from docs/components/openresponsesrequestpluginresponsehealing.md rename to docs/components/pluginresponsehealing.md index f99d182..93aa3d7 100644 --- a/docs/components/openresponsesrequestpluginresponsehealing.md +++ b/docs/components/pluginresponsehealing.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginResponseHealing +# PluginResponseHealing ## Fields diff --git a/docs/components/openresponsesrequestpluginweb.md b/docs/components/pluginweb.md similarity index 98% rename from docs/components/openresponsesrequestpluginweb.md rename to docs/components/pluginweb.md index 2223caf..8738bd0 100644 --- a/docs/components/openresponsesrequestpluginweb.md +++ b/docs/components/pluginweb.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestPluginWeb +# PluginWeb ## Fields diff --git a/docs/components/pricing.md b/docs/components/pricing.md index 1c4d87a..a997dda 100644 --- a/docs/components/pricing.md +++ b/docs/components/pricing.md @@ -3,19 +3,19 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | +| `prompt` | *str* | :heavy_check_mark: | N/A | 1000 | +| `completion` | *str* | :heavy_check_mark: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/prompt.md b/docs/components/prompt.md index c700709..f242343 100644 --- a/docs/components/prompt.md +++ b/docs/components/prompt.md @@ -3,27 +3,21 @@ ## Supported Types +### `float` + +```python +value: float = /* values here */ +``` + ### `str` ```python value: str = /* values here */ ``` -### `List[str]` +### `Any` ```python -value: List[str] = /* values here */ -``` - -### `List[float]` - -```python -value: List[float] = /* values here */ -``` - -### `List[List[float]]` - -```python -value: List[List[float]] = /* values here */ +value: Any = /* values here */ ``` diff --git a/docs/components/openresponsesrequestprovider.md b/docs/components/provider.md similarity index 99% rename from docs/components/openresponsesrequestprovider.md rename to docs/components/provider.md index 5fde781..37b891f 100644 --- a/docs/components/openresponsesrequestprovider.md +++ b/docs/components/provider.md @@ -1,4 +1,4 @@ -# OpenResponsesRequestProvider +# Provider When multiple model providers are available, optionally indicate your routing preference. diff --git a/docs/components/providername.md b/docs/components/providername.md index 5b56801..acc3a29 100644 --- a/docs/components/providername.md +++ b/docs/components/providername.md @@ -8,6 +8,7 @@ | `AI21` | AI21 | | `AION_LABS` | AionLabs | | `ALIBABA` | Alibaba | +| `AMBIENT` | Ambient | | `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_NOVA` | Amazon Nova | | `ANTHROPIC` | Anthropic | @@ -64,6 +65,7 @@ | `SEED` | Seed | | `SILICON_FLOW` | SiliconFlow | | `SOURCEFUL` | Sourceful | +| `STEP_FUN` | StepFun | | `STEALTH` | Stealth | | `STREAM_LAKE` | StreamLake | | `SWITCHPOINT` | Switchpoint | diff --git a/docs/components/providerpreferencesmaxprice.md b/docs/components/providerpreferencesmaxprice.md index 99f99dc..fb14872 100644 --- a/docs/components/providerpreferencesmaxprice.md +++ b/docs/components/providerpreferencesmaxprice.md @@ -5,10 +5,10 @@ The object specifying the maximum price you want to pay for this request. USD pr ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 | +| `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | \ No newline at end of file diff --git a/docs/components/publicpricing.md b/docs/components/publicpricing.md index 7a4eba7..c7ac704 100644 --- a/docs/components/publicpricing.md +++ b/docs/components/publicpricing.md @@ -5,19 +5,19 @@ Pricing information for the model ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | -| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | -| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | +| `prompt` | *str* | :heavy_check_mark: | N/A | 1000 | +| `completion` | *str* | :heavy_check_mark: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/responseformat.md b/docs/components/responseformat.md new file mode 100644 index 0000000..e9e9fda --- /dev/null +++ b/docs/components/responseformat.md @@ -0,0 +1,35 @@ +# ResponseFormat + + +## Supported Types + +### `components.ResponseFormatText` + +```python +value: components.ResponseFormatText = /* values here */ +``` + +### `components.ResponseFormatJSONObject` + +```python +value: components.ResponseFormatJSONObject = /* values here */ +``` + +### `components.ResponseFormatJSONSchema` + +```python +value: components.ResponseFormatJSONSchema = /* values here */ +``` + +### `components.ResponseFormatTextGrammar` + +```python +value: components.ResponseFormatTextGrammar = /* values here */ +``` + +### `components.ResponseFormatPython` + +```python +value: components.ResponseFormatPython = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamsresponseformatjsonobject.md b/docs/components/responseformatjsonobject.md similarity index 87% rename from docs/components/chatgenerationparamsresponseformatjsonobject.md rename to docs/components/responseformatjsonobject.md index 4c9c696..88c50c4 100644 --- a/docs/components/chatgenerationparamsresponseformatjsonobject.md +++ b/docs/components/responseformatjsonobject.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsResponseFormatJSONObject +# ResponseFormatJSONObject ## Fields diff --git a/docs/components/chatgenerationparamsresponseformatpython.md b/docs/components/responseformatpython.md similarity index 86% rename from docs/components/chatgenerationparamsresponseformatpython.md rename to docs/components/responseformatpython.md index 5b1274c..ca9fc95 100644 --- a/docs/components/chatgenerationparamsresponseformatpython.md +++ b/docs/components/responseformatpython.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsResponseFormatPython +# ResponseFormatPython ## Fields diff --git a/docs/components/chatgenerationparamsresponseformattext.md b/docs/components/responseformattext.md similarity index 86% rename from docs/components/chatgenerationparamsresponseformattext.md rename to docs/components/responseformattext.md index 9efb0d8..1b66a78 100644 --- a/docs/components/chatgenerationparamsresponseformattext.md +++ b/docs/components/responseformattext.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsResponseFormatText +# ResponseFormatText ## Fields diff --git a/docs/components/schema0.md b/docs/components/schema0.md index 3ce25f2..0da3160 100644 --- a/docs/components/schema0.md +++ b/docs/components/schema0.md @@ -1,17 +1,20 @@ # Schema0 -## Supported Types - -### `components.Schema0Enum` - -```python -value: components.Schema0Enum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` +## Fields +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `data_collection` | [OptionalNullable[components.Schema3]](../components/schema3.md) | :heavy_minus_sign: | N/A | +| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `order` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | +| `only` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | +| `ignore` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | +| `quantizations` | List[[components.Schema8](../components/schema8.md)] | :heavy_minus_sign: | N/A | +| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | N/A | +| `max_price` | [Optional[components.Schema10]](../components/schema10.md) | :heavy_minus_sign: | N/A | +| `preferred_min_throughput` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A | +| `preferred_max_latency` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema10.md b/docs/components/schema10.md new file mode 100644 index 0000000..5a5bcf1 --- /dev/null +++ b/docs/components/schema10.md @@ -0,0 +1,12 @@ +# Schema10 + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `prompt` | [Optional[components.Prompt]](../components/prompt.md) | :heavy_minus_sign: | N/A | +| `completion` | [Optional[components.Completion]](../components/completion.md) | :heavy_minus_sign: | N/A | +| `image` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | +| `audio` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | +| `request` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema14.md b/docs/components/schema14.md new file mode 100644 index 0000000..7fdac48 --- /dev/null +++ b/docs/components/schema14.md @@ -0,0 +1,23 @@ +# Schema14 + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamspreferredmaxlatency.md b/docs/components/schema15.md similarity index 94% rename from docs/components/chatgenerationparamspreferredmaxlatency.md rename to docs/components/schema15.md index 323b2f9..dc0a8de 100644 --- a/docs/components/chatgenerationparamspreferredmaxlatency.md +++ b/docs/components/schema15.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPreferredMaxLatency +# Schema15 ## Fields diff --git a/docs/components/schema15union.md b/docs/components/schema15union.md new file mode 100644 index 0000000..261a8d1 --- /dev/null +++ b/docs/components/schema15union.md @@ -0,0 +1,17 @@ +# Schema15Union + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `components.Schema15` + +```python +value: components.Schema15 = /* values here */ +``` + diff --git a/docs/components/schema17.md b/docs/components/schema17.md new file mode 100644 index 0000000..e166914 --- /dev/null +++ b/docs/components/schema17.md @@ -0,0 +1,35 @@ +# Schema17 + + +## Supported Types + +### `components.Schema17AutoRouter` + +```python +value: components.Schema17AutoRouter = /* values here */ +``` + +### `components.Schema17Moderation` + +```python +value: components.Schema17Moderation = /* values here */ +``` + +### `components.Schema17Web` + +```python +value: components.Schema17Web = /* values here */ +``` + +### `components.Schema17FileParser` + +```python +value: components.Schema17FileParser = /* values here */ +``` + +### `components.Schema17ResponseHealing` + +```python +value: components.Schema17ResponseHealing = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamspluginautorouter.md b/docs/components/schema17autorouter.md similarity index 93% rename from docs/components/chatgenerationparamspluginautorouter.md rename to docs/components/schema17autorouter.md index 7326614..8f53379 100644 --- a/docs/components/chatgenerationparamspluginautorouter.md +++ b/docs/components/schema17autorouter.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginAutoRouter +# Schema17AutoRouter ## Fields diff --git a/docs/components/chatgenerationparamspluginfileparser.md b/docs/components/schema17fileparser.md similarity index 96% rename from docs/components/chatgenerationparamspluginfileparser.md rename to docs/components/schema17fileparser.md index 9d53438..b5a71fd 100644 --- a/docs/components/chatgenerationparamspluginfileparser.md +++ b/docs/components/schema17fileparser.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginFileParser +# Schema17FileParser ## Fields diff --git a/docs/components/chatgenerationparamspluginmoderation.md b/docs/components/schema17moderation.md similarity index 89% rename from docs/components/chatgenerationparamspluginmoderation.md rename to docs/components/schema17moderation.md index 55494d5..6f449d8 100644 --- a/docs/components/chatgenerationparamspluginmoderation.md +++ b/docs/components/schema17moderation.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginModeration +# Schema17Moderation ## Fields diff --git a/docs/components/chatgenerationparamspluginresponsehealing.md b/docs/components/schema17responsehealing.md similarity index 92% rename from docs/components/chatgenerationparamspluginresponsehealing.md rename to docs/components/schema17responsehealing.md index 17faf76..5ef1030 100644 --- a/docs/components/chatgenerationparamspluginresponsehealing.md +++ b/docs/components/schema17responsehealing.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginResponseHealing +# Schema17ResponseHealing ## Fields diff --git a/docs/components/chatgenerationparamspluginweb.md b/docs/components/schema17web.md similarity index 98% rename from docs/components/chatgenerationparamspluginweb.md rename to docs/components/schema17web.md index e495619..beccd42 100644 --- a/docs/components/chatgenerationparamspluginweb.md +++ b/docs/components/schema17web.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsPluginWeb +# Schema17Web ## Fields diff --git a/docs/components/schema19.md b/docs/components/schema19.md new file mode 100644 index 0000000..2d61cb8 --- /dev/null +++ b/docs/components/schema19.md @@ -0,0 +1,23 @@ +# Schema19 + + +## Supported Types + +### `components.Schema19ReasoningSummary` + +```python +value: components.Schema19ReasoningSummary = /* values here */ +``` + +### `components.Schema19ReasoningEncrypted` + +```python +value: components.Schema19ReasoningEncrypted = /* values here */ +``` + +### `components.Schema19ReasoningText` + +```python +value: components.Schema19ReasoningText = /* values here */ +``` + diff --git a/docs/components/schema19reasoningencrypted.md b/docs/components/schema19reasoningencrypted.md new file mode 100644 index 0000000..269b7a5 --- /dev/null +++ b/docs/components/schema19reasoningencrypted.md @@ -0,0 +1,12 @@ +# Schema19ReasoningEncrypted + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A | +| `data` | *str* | :heavy_check_mark: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema19reasoningsummary.md b/docs/components/schema19reasoningsummary.md new file mode 100644 index 0000000..a921b0d --- /dev/null +++ b/docs/components/schema19reasoningsummary.md @@ -0,0 +1,12 @@ +# Schema19ReasoningSummary + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A | +| `summary` | *str* | :heavy_check_mark: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema19reasoningtext.md b/docs/components/schema19reasoningtext.md new file mode 100644 index 0000000..0790712 --- /dev/null +++ b/docs/components/schema19reasoningtext.md @@ -0,0 +1,13 @@ +# Schema19ReasoningText + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A | +| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema2.md b/docs/components/schema2.md deleted file mode 100644 index 42b74cf..0000000 --- a/docs/components/schema2.md +++ /dev/null @@ -1,23 +0,0 @@ -# Schema2 - - -## Supported Types - -### `components.Schema2ReasoningSummary` - -```python -value: components.Schema2ReasoningSummary = /* values here */ -``` - -### `components.Schema2ReasoningEncrypted` - -```python -value: components.Schema2ReasoningEncrypted = /* values here */ -``` - -### `components.Schema2ReasoningText` - -```python -value: components.Schema2ReasoningText = /* values here */ -``` - diff --git a/docs/components/schema4.md b/docs/components/schema21.md similarity index 97% rename from docs/components/schema4.md rename to docs/components/schema21.md index 9e927db..91687e4 100644 --- a/docs/components/schema4.md +++ b/docs/components/schema21.md @@ -1,4 +1,4 @@ -# Schema4 +# Schema21 ## Values diff --git a/docs/components/schema2reasoningencrypted.md b/docs/components/schema2reasoningencrypted.md deleted file mode 100644 index 0cc8c33..0000000 --- a/docs/components/schema2reasoningencrypted.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema2ReasoningEncrypted - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A | -| `data` | *str* | :heavy_check_mark: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema2reasoningsummary.md b/docs/components/schema2reasoningsummary.md deleted file mode 100644 index 82ec98d..0000000 --- a/docs/components/schema2reasoningsummary.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema2ReasoningSummary - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A | -| `summary` | *str* | :heavy_check_mark: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema2reasoningtext.md b/docs/components/schema2reasoningtext.md deleted file mode 100644 index 3d1ff9a..0000000 --- a/docs/components/schema2reasoningtext.md +++ /dev/null @@ -1,13 +0,0 @@ -# Schema2ReasoningText - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A | -| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsdatacollection.md b/docs/components/schema3.md similarity index 72% rename from docs/components/chatgenerationparamsdatacollection.md rename to docs/components/schema3.md index 0546069..53d01d6 100644 --- a/docs/components/chatgenerationparamsdatacollection.md +++ b/docs/components/schema3.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsDataCollection +# Schema3 ## Values diff --git a/docs/components/completioncreateparamsstop.md b/docs/components/schema5.md similarity index 51% rename from docs/components/completioncreateparamsstop.md rename to docs/components/schema5.md index da48725..0c115ca 100644 --- a/docs/components/completioncreateparamsstop.md +++ b/docs/components/schema5.md @@ -1,17 +1,17 @@ -# CompletionCreateParamsStop +# Schema5 ## Supported Types +### `components.Schema5Enum` + +```python +value: components.Schema5Enum = /* values here */ +``` + ### `str` ```python value: str = /* values here */ ``` -### `List[str]` - -```python -value: List[str] = /* values here */ -``` - diff --git a/docs/components/schema0enum.md b/docs/components/schema5enum.md similarity index 96% rename from docs/components/schema0enum.md rename to docs/components/schema5enum.md index f1c6708..d6fa747 100644 --- a/docs/components/schema0enum.md +++ b/docs/components/schema5enum.md @@ -1,4 +1,4 @@ -# Schema0Enum +# Schema5Enum ## Values @@ -8,6 +8,7 @@ | `AI21` | AI21 | | `AION_LABS` | AionLabs | | `ALIBABA` | Alibaba | +| `AMBIENT` | Ambient | | `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_NOVA` | Amazon Nova | | `ANTHROPIC` | Anthropic | @@ -64,6 +65,7 @@ | `SEED` | Seed | | `SILICON_FLOW` | SiliconFlow | | `SOURCEFUL` | Sourceful | +| `STEP_FUN` | StepFun | | `STEALTH` | Stealth | | `STREAM_LAKE` | StreamLake | | `SWITCHPOINT` | Switchpoint | diff --git a/docs/components/quantizations.md b/docs/components/schema8.md similarity index 94% rename from docs/components/quantizations.md rename to docs/components/schema8.md index 5c0aecc..fbf6c51 100644 --- a/docs/components/quantizations.md +++ b/docs/components/schema8.md @@ -1,4 +1,4 @@ -# Quantizations +# Schema8 ## Values diff --git a/docs/components/chatgenerationparamsstop.md b/docs/components/stop.md similarity index 84% rename from docs/components/chatgenerationparamsstop.md rename to docs/components/stop.md index 9725523..9cfdaa0 100644 --- a/docs/components/chatgenerationparamsstop.md +++ b/docs/components/stop.md @@ -1,4 +1,4 @@ -# ChatGenerationParamsStop +# Stop ## Supported Types diff --git a/docs/components/streamoptions.md b/docs/components/streamoptions.md deleted file mode 100644 index a2e5702..0000000 --- a/docs/components/streamoptions.md +++ /dev/null @@ -1,8 +0,0 @@ -# StreamOptions - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `include_usage` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/getgenerationdata.md b/docs/operations/getgenerationdata.md index 5317aaa..f8c54d1 100644 --- a/docs/operations/getgenerationdata.md +++ b/docs/operations/getgenerationdata.md @@ -5,38 +5,39 @@ Generation data ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | -| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 | -| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 | -| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 | -| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 | -| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 | -| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b | -| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 | -| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true | -| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false | -| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic | -| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 | -| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 | -| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 | -| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop | -| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 | -| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 | -| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 | -| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 | -| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 | -| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 | -| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 | -| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 | -| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 | -| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 | -| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 | -| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ | -| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 | -| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false | -| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop | -| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | -| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | | -| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | +| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 | +| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 | +| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 | +| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 | +| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 | +| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b | +| `app_id` | *Nullable[float]* | :heavy_check_mark: | ID of the app that made the request | 12345 | +| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true | +| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false | +| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic | +| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 | +| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 | +| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 | +| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop | +| `tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the prompt | 10 | +| `tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Number of tokens in the completion | 25 | +| `native_tokens_prompt` | *Nullable[float]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 | +| `native_tokens_completion` | *Nullable[float]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 | +| `native_tokens_completion_images` | *Nullable[float]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 | +| `native_tokens_reasoning` | *Nullable[float]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 | +| `native_tokens_cached` | *Nullable[float]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 | +| `num_media_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the prompt | 1 | +| `num_input_audio_prompt` | *Nullable[float]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 | +| `num_media_completion` | *Nullable[float]* | :heavy_check_mark: | Number of media items in the completion | 0 | +| `num_search_results` | *Nullable[float]* | :heavy_check_mark: | Number of search results included | 5 | +| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ | +| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 | +| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false | +| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop | +| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | +| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | | +| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto | +| `provider_responses` | List[[operations.ProviderResponse](../operations/providerresponse.md)] | :heavy_check_mark: | List of provider responses for this generation, including fallback attempts | | \ No newline at end of file diff --git a/docs/operations/providername.md b/docs/operations/providername.md new file mode 100644 index 0000000..d9111d6 --- /dev/null +++ b/docs/operations/providername.md @@ -0,0 +1,107 @@ +# ProviderName + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `ANY_SCALE` | AnyScale | +| `ATOMA` | Atoma | +| `CENT_ML` | Cent-ML | +| `CROF_AI` | CrofAI | +| `ENFER` | Enfer | +| `GO_POMELO` | GoPomelo | +| `HUGGING_FACE` | HuggingFace | +| `HYPERBOLIC_2` | Hyperbolic 2 | +| `INO_CLOUD` | InoCloud | +| `KLUSTER` | Kluster | +| `LAMBDA` | Lambda | +| `LEPTON` | Lepton | +| `LYNN_2` | Lynn 2 | +| `LYNN` | Lynn | +| `MANCER` | Mancer | +| `META` | Meta | +| `MODAL` | Modal | +| `NINETEEN` | Nineteen | +| `OCTO_AI` | OctoAI | +| `RECURSAL` | Recursal | +| `REFLECTION` | Reflection | +| `REPLICATE` | Replicate | +| `SAMBA_NOVA_2` | SambaNova 2 | +| `SF_COMPUTE` | SF Compute | +| `TARGON` | Targon | +| `TOGETHER_2` | Together 2 | +| `UBICLOUD` | Ubicloud | +| `ONE_DOT_AI` | 01.AI | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMBIENT` | Ambient | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `AMAZON_NOVA` | Amazon Nova | +| `ANTHROPIC` | Anthropic | +| `ARCEE_AI` | Arcee AI | +| `ATLAS_CLOUD` | AtlasCloud | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `BYTE_PLUS` | BytePlus | +| `BLACK_FOREST_LABS` | Black Forest Labs | +| `CEREBRAS` | Cerebras | +| `CHUTES` | Chutes | +| `CIRRASCALE` | Cirrascale | +| `CLARIFAI` | Clarifai | +| `CLOUDFLARE` | Cloudflare | +| `COHERE` | Cohere | +| `CRUSOE` | Crusoe | +| `DEEP_INFRA` | DeepInfra | +| `DEEP_SEEK` | DeepSeek | +| `FEATHERLESS` | Featherless | +| `FIREWORKS` | Fireworks | +| `FRIENDLI` | Friendli | +| `GMI_CLOUD` | GMICloud | +| `GOOGLE` | Google | +| `GOOGLE_AI_STUDIO` | Google AI Studio | +| `GROQ` | Groq | +| `HYPERBOLIC` | Hyperbolic | +| `INCEPTION` | Inception | +| `INCEPTRON` | Inceptron | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `LIQUID` | Liquid | +| `MARA` | Mara | +| `MANCER_2` | Mancer 2 | +| `MINIMAX` | Minimax | +| `MODEL_RUN` | ModelRun | +| `MISTRAL` | Mistral | +| `MODULAR` | Modular | +| `MOONSHOT_AI` | Moonshot AI | +| `MORPH` | Morph | +| `N_COMPASS` | NCompass | +| `NEBIUS` | Nebius | +| `NEXT_BIT` | NextBit | +| `NOVITA` | Novita | +| `NVIDIA` | Nvidia | +| `OPEN_AI` | OpenAI | +| `OPEN_INFERENCE` | OpenInference | +| `PARASAIL` | Parasail | +| `PERPLEXITY` | Perplexity | +| `PHALA` | Phala | +| `RELACE` | Relace | +| `SAMBA_NOVA` | SambaNova | +| `SEED` | Seed | +| `SILICON_FLOW` | SiliconFlow | +| `SOURCEFUL` | Sourceful | +| `STEP_FUN` | StepFun | +| `STEALTH` | Stealth | +| `STREAM_LAKE` | StreamLake | +| `SWITCHPOINT` | Switchpoint | +| `TOGETHER` | Together | +| `UPSTAGE` | Upstage | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `XIAOMI` | Xiaomi | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | +| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file diff --git a/docs/operations/providerresponse.md b/docs/operations/providerresponse.md new file mode 100644 index 0000000..cd0f8fb --- /dev/null +++ b/docs/operations/providerresponse.md @@ -0,0 +1,14 @@ +# ProviderResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `endpoint_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `model_permaslug` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider_name` | [Optional[operations.ProviderName]](../operations/providername.md) | :heavy_minus_sign: | N/A | +| `status` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `latency` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index 6b781c3..2aff13e 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -34,38 +34,38 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A | -| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | -| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | -| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A | -| `response_format` | [Optional[components.ChatGenerationParamsResponseFormatUnion]](../../components/chatgenerationparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.ChatGenerationParamsStop]](../../components/chatgenerationparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A | -| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | -| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A | +| `provider` | [OptionalNullable[components.Schema0]](../../components/schema0.md) | :heavy_minus_sign: | N/A | +| `plugins` | List[[components.Schema17](../../components/schema17.md)] | :heavy_minus_sign: | N/A | +| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `models` | List[*str*] | :heavy_minus_sign: | N/A | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A | +| `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | N/A | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | +| `stop` | [OptionalNullable[components.Stop]](../../components/stop.md) | :heavy_minus_sign: | N/A | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | +| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | +| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A | +| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | +| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/completions/README.md b/docs/sdks/completions/README.md deleted file mode 100644 index beeb03e..0000000 --- a/docs/sdks/completions/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Completions -(*completions*) - -## Overview - -### Available Operations - -* [generate](#generate) - Create a completion - -## generate - -Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - -### Example Usage - - -```python -from openrouter import OpenRouter -import os - - -with OpenRouter( - api_key=os.getenv("OPENROUTER_API_KEY", ""), -) as open_router: - - res = open_router.completions.generate(prompt=[], stream=False) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| `prompt` | [components.Prompt](../../components/prompt.md) | :heavy_check_mark: | N/A | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `best_of` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `echo` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `n` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.CompletionCreateParamsStop]](../../components/completioncreateparamsstop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.StreamOptions]](../../components/streamoptions.md) | :heavy_minus_sign: | N/A | -| `suffix` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `response_format` | [OptionalNullable[components.CompletionCreateParamsResponseFormatUnion]](../../components/completioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[components.CompletionResponse](../../components/completionresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------------- | ----------------------------- | ----------------------------- | -| errors.ChatError | 400, 401, 429 | application/json | -| errors.ChatError | 500 | application/json | -| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/models/README.md b/docs/sdks/models/README.md index b106323..2ea55ea 100644 --- a/docs/sdks/models/README.md +++ b/docs/sdks/models/README.md @@ -9,7 +9,7 @@ Model information endpoints * [count](#count) - Get total count of available models * [list](#list) - List all models and their properties -* [list_for_user](#list_for_user) - List models filtered by user provider preferences +* [list_for_user](#list_for_user) - List models filtered by user provider preferences, privacy settings, and guardrails ## count @@ -96,7 +96,7 @@ with OpenRouter( ## list_for_user -List models filtered by user provider preferences +List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). ### Example Usage @@ -133,5 +133,6 @@ with OpenRouter() as open_router: | Error Type | Status Code | Content Type | | ---------------------------------- | ---------------------------------- | ---------------------------------- | | errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/responses/README.md b/docs/sdks/responses/README.md index 3f71774..378557c 100644 --- a/docs/sdks/responses/README.md +++ b/docs/sdks/responses/README.md @@ -67,8 +67,8 @@ with OpenRouter( | `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/pyproject.toml b/pyproject.toml index 09db2ac..3263532 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.1.3" +version = "0.5.0" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 59cb4ed..5c54e5c 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.1.3" +__version__: str = "0.5.0" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.768.0" -__user_agent__: str = "speakeasy-sdk/python 0.1.3 2.768.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.5.0 2.768.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index d75dbd2..887285e 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -22,16 +22,10 @@ class Chat(BaseSDK): *, messages: Union[List[components.Message], List[components.MessageTypedDict]], provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -50,17 +44,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Union[Literal[False], None] = None, stream_options: OptionalNullable[ @@ -93,11 +81,11 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -134,16 +122,10 @@ class Chat(BaseSDK): *, messages: Union[List[components.Message], List[components.MessageTypedDict]], provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -162,17 +144,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Literal[True], stream_options: OptionalNullable[ @@ -205,11 +181,11 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -245,16 +221,10 @@ class Chat(BaseSDK): *, messages: Union[List[components.Message], List[components.MessageTypedDict]], provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -273,17 +243,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Optional[bool] = False, stream_options: OptionalNullable[ @@ -316,11 +280,11 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -362,10 +326,10 @@ class Chat(BaseSDK): request = components.ChatGenerationParams( provider=utils.get_pydantic_model( - provider, OptionalNullable[components.ChatGenerationParamsProvider] + provider, OptionalNullable[components.Schema0] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] + plugins, Optional[List[components.Schema17]] ), route=route, user=user, @@ -385,8 +349,7 @@ class Chat(BaseSDK): reasoning, Optional[components.Reasoning] ), response_format=utils.get_pydantic_model( - response_format, - Optional[components.ChatGenerationParamsResponseFormatUnion], + response_format, Optional[components.ResponseFormat] ), seed=seed, stop=stop, @@ -498,16 +461,10 @@ class Chat(BaseSDK): *, messages: Union[List[components.Message], List[components.MessageTypedDict]], provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -526,17 +483,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Union[Literal[False], None] = None, stream_options: OptionalNullable[ @@ -569,11 +520,11 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -610,16 +561,10 @@ class Chat(BaseSDK): *, messages: Union[List[components.Message], List[components.MessageTypedDict]], provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -638,17 +583,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Literal[True], stream_options: OptionalNullable[ @@ -681,11 +620,11 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -721,16 +660,10 @@ class Chat(BaseSDK): *, messages: Union[List[components.Message], List[components.MessageTypedDict]], provider: OptionalNullable[ - Union[ - components.ChatGenerationParamsProvider, - components.ChatGenerationParamsProviderTypedDict, - ] + Union[components.Schema0, components.Schema0TypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.ChatGenerationParamsPluginUnion], - List[components.ChatGenerationParamsPluginUnionTypedDict], - ] + Union[List[components.Schema17], List[components.Schema17TypedDict]] ] = None, route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, @@ -749,17 +682,11 @@ class Chat(BaseSDK): Union[components.Reasoning, components.ReasoningTypedDict] ] = None, response_format: Optional[ - Union[ - components.ChatGenerationParamsResponseFormatUnion, - components.ChatGenerationParamsResponseFormatUnionTypedDict, - ] + Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, seed: OptionalNullable[int] = UNSET, stop: OptionalNullable[ - Union[ - components.ChatGenerationParamsStop, - components.ChatGenerationParamsStopTypedDict, - ] + Union[components.Stop, components.StopTypedDict] ] = UNSET, stream: Optional[bool] = False, stream_options: OptionalNullable[ @@ -792,11 +719,11 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: - :param provider: When multiple model providers are available, optionally indicate your routing preference. - :param plugins: Plugins you want to enable for this request, including their settings. + :param provider: + :param plugins: :param route: :param user: - :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param session_id: :param model: :param models: :param frequency_penalty: @@ -838,10 +765,10 @@ class Chat(BaseSDK): request = components.ChatGenerationParams( provider=utils.get_pydantic_model( - provider, OptionalNullable[components.ChatGenerationParamsProvider] + provider, OptionalNullable[components.Schema0] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] + plugins, Optional[List[components.Schema17]] ), route=route, user=user, @@ -861,8 +788,7 @@ class Chat(BaseSDK): reasoning, Optional[components.Reasoning] ), response_format=utils.get_pydantic_model( - response_format, - Optional[components.ChatGenerationParamsResponseFormatUnion], + response_format, Optional[components.ResponseFormat] ), seed=seed, stop=stop, diff --git a/src/openrouter/completions.py b/src/openrouter/completions.py deleted file mode 100644 index 26bbf6a..0000000 --- a/src/openrouter/completions.py +++ /dev/null @@ -1,361 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from .basesdk import BaseSDK -from openrouter import components, errors, utils -from openrouter._hooks import HookContext -from openrouter.types import OptionalNullable, UNSET -from openrouter.utils import get_security_from_env -from openrouter.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Dict, List, Mapping, Optional, Union - - -class Completions(BaseSDK): - def generate( - self, - *, - prompt: Union[components.Prompt, components.PromptTypedDict], - model: Optional[str] = None, - models: Optional[List[str]] = None, - best_of: OptionalNullable[int] = UNSET, - echo: OptionalNullable[bool] = UNSET, - frequency_penalty: OptionalNullable[float] = UNSET, - logit_bias: OptionalNullable[Dict[str, float]] = UNSET, - logprobs: OptionalNullable[int] = UNSET, - max_tokens: OptionalNullable[int] = UNSET, - n: OptionalNullable[int] = UNSET, - presence_penalty: OptionalNullable[float] = UNSET, - seed: OptionalNullable[int] = UNSET, - stop: OptionalNullable[ - Union[ - components.CompletionCreateParamsStop, - components.CompletionCreateParamsStopTypedDict, - ] - ] = UNSET, - stream: Optional[bool] = False, - stream_options: OptionalNullable[ - Union[components.StreamOptions, components.StreamOptionsTypedDict] - ] = UNSET, - suffix: OptionalNullable[str] = UNSET, - temperature: OptionalNullable[float] = UNSET, - top_p: OptionalNullable[float] = UNSET, - user: Optional[str] = None, - metadata: OptionalNullable[Dict[str, str]] = UNSET, - response_format: OptionalNullable[ - Union[ - components.CompletionCreateParamsResponseFormatUnion, - components.CompletionCreateParamsResponseFormatUnionTypedDict, - ] - ] = UNSET, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> components.CompletionResponse: - r"""Create a completion - - Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - - :param prompt: - :param model: - :param models: - :param best_of: - :param echo: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param max_tokens: - :param n: - :param presence_penalty: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param suffix: - :param temperature: - :param top_p: - :param user: - :param metadata: - :param response_format: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = components.CompletionCreateParams( - model=model, - models=models, - prompt=prompt, - best_of=best_of, - echo=echo, - frequency_penalty=frequency_penalty, - logit_bias=logit_bias, - logprobs=logprobs, - max_tokens=max_tokens, - n=n, - presence_penalty=presence_penalty, - seed=seed, - stop=stop, - stream=stream, - stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[components.StreamOptions] - ), - suffix=suffix, - temperature=temperature, - top_p=top_p, - user=user, - metadata=metadata, - response_format=utils.get_pydantic_model( - response_format, - OptionalNullable[components.CompletionCreateParamsResponseFormatUnion], - ), - ) - - req = self._build_request( - method="POST", - path="/completions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.CompletionCreateParams - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="createCompletions", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, components.Security - ), - ), - request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.CompletionResponse, http_res) - if utils.match_response(http_res, ["400", "401", "429"], "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "500", "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.OpenRouterDefaultError("Unexpected response received", http_res) - - async def generate_async( - self, - *, - prompt: Union[components.Prompt, components.PromptTypedDict], - model: Optional[str] = None, - models: Optional[List[str]] = None, - best_of: OptionalNullable[int] = UNSET, - echo: OptionalNullable[bool] = UNSET, - frequency_penalty: OptionalNullable[float] = UNSET, - logit_bias: OptionalNullable[Dict[str, float]] = UNSET, - logprobs: OptionalNullable[int] = UNSET, - max_tokens: OptionalNullable[int] = UNSET, - n: OptionalNullable[int] = UNSET, - presence_penalty: OptionalNullable[float] = UNSET, - seed: OptionalNullable[int] = UNSET, - stop: OptionalNullable[ - Union[ - components.CompletionCreateParamsStop, - components.CompletionCreateParamsStopTypedDict, - ] - ] = UNSET, - stream: Optional[bool] = False, - stream_options: OptionalNullable[ - Union[components.StreamOptions, components.StreamOptionsTypedDict] - ] = UNSET, - suffix: OptionalNullable[str] = UNSET, - temperature: OptionalNullable[float] = UNSET, - top_p: OptionalNullable[float] = UNSET, - user: Optional[str] = None, - metadata: OptionalNullable[Dict[str, str]] = UNSET, - response_format: OptionalNullable[ - Union[ - components.CompletionCreateParamsResponseFormatUnion, - components.CompletionCreateParamsResponseFormatUnionTypedDict, - ] - ] = UNSET, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> components.CompletionResponse: - r"""Create a completion - - Creates a completion for the provided prompt and parameters. Supports both streaming and non-streaming modes. - - :param prompt: - :param model: - :param models: - :param best_of: - :param echo: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param max_tokens: - :param n: - :param presence_penalty: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param suffix: - :param temperature: - :param top_p: - :param user: - :param metadata: - :param response_format: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = components.CompletionCreateParams( - model=model, - models=models, - prompt=prompt, - best_of=best_of, - echo=echo, - frequency_penalty=frequency_penalty, - logit_bias=logit_bias, - logprobs=logprobs, - max_tokens=max_tokens, - n=n, - presence_penalty=presence_penalty, - seed=seed, - stop=stop, - stream=stream, - stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[components.StreamOptions] - ), - suffix=suffix, - temperature=temperature, - top_p=top_p, - user=user, - metadata=metadata, - response_format=utils.get_pydantic_model( - response_format, - OptionalNullable[components.CompletionCreateParamsResponseFormatUnion], - ), - ) - - req = self._build_request_async( - method="POST", - path="/completions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", components.CompletionCreateParams - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="createCompletions", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, components.Security - ), - ), - request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.CompletionResponse, http_res) - if utils.match_response(http_res, ["400", "401", "429"], "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "500", "application/json"): - response_data = unmarshal_json_response(errors.ChatErrorData, http_res) - raise errors.ChatError(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.OpenRouterDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 94e838c..4dba5f4 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -6,18 +6,45 @@ import builtins import sys if TYPE_CHECKING: - from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict - from ._schema2 import ( - Schema2, - Schema2ReasoningEncrypted, - Schema2ReasoningEncryptedTypedDict, - Schema2ReasoningSummary, - Schema2ReasoningSummaryTypedDict, - Schema2ReasoningText, - Schema2ReasoningTextTypedDict, - Schema2TypedDict, - Schema4, + from ._schema10 import ( + Completion, + CompletionTypedDict, + Prompt, + PromptTypedDict, + Schema10, + Schema10TypedDict, ) + from ._schema14 import Schema14, Schema14TypedDict + from ._schema17 import ( + Engine, + Pdf, + PdfEngine, + PdfTypedDict, + Schema17, + Schema17AutoRouter, + Schema17AutoRouterTypedDict, + Schema17FileParser, + Schema17FileParserTypedDict, + Schema17Moderation, + Schema17ModerationTypedDict, + Schema17ResponseHealing, + Schema17ResponseHealingTypedDict, + Schema17TypedDict, + Schema17Web, + Schema17WebTypedDict, + ) + from ._schema19 import ( + Schema19, + Schema19ReasoningEncrypted, + Schema19ReasoningEncryptedTypedDict, + Schema19ReasoningSummary, + Schema19ReasoningSummaryTypedDict, + Schema19ReasoningText, + Schema19ReasoningTextTypedDict, + Schema19TypedDict, + Schema21, + ) + from ._schema5 import Schema5, Schema5Enum, Schema5TypedDict from .activityitem import ActivityItem, ActivityItemTypedDict from .assistantmessage import ( AssistantMessage, @@ -41,56 +68,34 @@ if TYPE_CHECKING: from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chatgenerationparams import ( ChatGenerationParams, - ChatGenerationParamsDataCollection, ChatGenerationParamsImageConfig, ChatGenerationParamsImageConfigTypedDict, - ChatGenerationParamsMaxPrice, - ChatGenerationParamsMaxPriceTypedDict, - ChatGenerationParamsPluginAutoRouter, - ChatGenerationParamsPluginAutoRouterTypedDict, - ChatGenerationParamsPluginFileParser, - ChatGenerationParamsPluginFileParserTypedDict, - ChatGenerationParamsPluginModeration, - ChatGenerationParamsPluginModerationTypedDict, - ChatGenerationParamsPluginResponseHealing, - ChatGenerationParamsPluginResponseHealingTypedDict, - ChatGenerationParamsPluginUnion, - ChatGenerationParamsPluginUnionTypedDict, - ChatGenerationParamsPluginWeb, - ChatGenerationParamsPluginWebTypedDict, - ChatGenerationParamsPreferredMaxLatency, - ChatGenerationParamsPreferredMaxLatencyTypedDict, - ChatGenerationParamsPreferredMaxLatencyUnion, - ChatGenerationParamsPreferredMaxLatencyUnionTypedDict, - ChatGenerationParamsPreferredMinThroughput, - ChatGenerationParamsPreferredMinThroughputTypedDict, - ChatGenerationParamsPreferredMinThroughputUnion, - ChatGenerationParamsPreferredMinThroughputUnionTypedDict, - ChatGenerationParamsProvider, - ChatGenerationParamsProviderTypedDict, - ChatGenerationParamsResponseFormatJSONObject, - ChatGenerationParamsResponseFormatJSONObjectTypedDict, - ChatGenerationParamsResponseFormatPython, - ChatGenerationParamsResponseFormatPythonTypedDict, - ChatGenerationParamsResponseFormatText, - ChatGenerationParamsResponseFormatTextTypedDict, - ChatGenerationParamsResponseFormatUnion, - ChatGenerationParamsResponseFormatUnionTypedDict, - ChatGenerationParamsStop, - ChatGenerationParamsStopTypedDict, ChatGenerationParamsTypedDict, Debug, DebugTypedDict, Effort, - Engine, Modality, - Pdf, - PdfEngine, - PdfTypedDict, - Quantizations, Reasoning, ReasoningTypedDict, + ResponseFormat, + ResponseFormatJSONObject, + ResponseFormatJSONObjectTypedDict, + ResponseFormatPython, + ResponseFormatPythonTypedDict, + ResponseFormatText, + ResponseFormatTextTypedDict, + ResponseFormatTypedDict, Route, + Schema0, + Schema0TypedDict, + Schema15, + Schema15TypedDict, + Schema15Union, + Schema15UnionTypedDict, + Schema3, + Schema8, + Stop, + StopTypedDict, ) from .chatgenerationtokenusage import ( ChatGenerationTokenUsage, @@ -177,32 +182,6 @@ if TYPE_CHECKING: ChatStreamingResponseChunkTypedDict, ) from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict - from .completionchoice import ( - CompletionChoice, - CompletionChoiceTypedDict, - CompletionFinishReason, - ) - from .completioncreateparams import ( - CompletionCreateParams, - CompletionCreateParamsResponseFormatJSONObject, - CompletionCreateParamsResponseFormatJSONObjectTypedDict, - CompletionCreateParamsResponseFormatPython, - CompletionCreateParamsResponseFormatPythonTypedDict, - CompletionCreateParamsResponseFormatText, - CompletionCreateParamsResponseFormatTextTypedDict, - CompletionCreateParamsResponseFormatUnion, - CompletionCreateParamsResponseFormatUnionTypedDict, - CompletionCreateParamsStop, - CompletionCreateParamsStopTypedDict, - CompletionCreateParamsTypedDict, - Prompt, - PromptTypedDict, - StreamOptions, - StreamOptionsTypedDict, - ) - from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict - from .completionresponse import CompletionResponse, CompletionResponseTypedDict - from .completionusage import CompletionUsage, CompletionUsageTypedDict from .createchargerequest import ( ChainID, CreateChargeRequest, @@ -210,6 +189,12 @@ if TYPE_CHECKING: ) from .datacollection import DataCollection from .defaultparameters import DefaultParameters, DefaultParametersTypedDict + from .developermessage import ( + DeveloperMessage, + DeveloperMessageContent, + DeveloperMessageContentTypedDict, + DeveloperMessageTypedDict, + ) from .edgenetworktimeoutresponseerrordata import ( EdgeNetworkTimeoutResponseErrorData, EdgeNetworkTimeoutResponseErrorDataTypedDict, @@ -236,14 +221,7 @@ if TYPE_CHECKING: ListEndpointsResponseTypedDict, Tokenizer, ) - from .message import ( - Message, - MessageContent, - MessageContentTypedDict, - MessageDeveloper, - MessageDeveloperTypedDict, - MessageTypedDict, - ) + from .message import Message, MessageTypedDict from .model import Model, ModelTypedDict from .modelarchitecture import ( ModelArchitecture, @@ -495,20 +473,6 @@ if TYPE_CHECKING: OpenResponsesRequestOnlyTypedDict, OpenResponsesRequestOrder, OpenResponsesRequestOrderTypedDict, - OpenResponsesRequestPluginAutoRouter, - OpenResponsesRequestPluginAutoRouterTypedDict, - OpenResponsesRequestPluginFileParser, - OpenResponsesRequestPluginFileParserTypedDict, - OpenResponsesRequestPluginModeration, - OpenResponsesRequestPluginModerationTypedDict, - OpenResponsesRequestPluginResponseHealing, - OpenResponsesRequestPluginResponseHealingTypedDict, - OpenResponsesRequestPluginUnion, - OpenResponsesRequestPluginUnionTypedDict, - OpenResponsesRequestPluginWeb, - OpenResponsesRequestPluginWebTypedDict, - OpenResponsesRequestProvider, - OpenResponsesRequestProviderTypedDict, OpenResponsesRequestSort, OpenResponsesRequestSortTypedDict, OpenResponsesRequestToolFunction, @@ -517,6 +481,20 @@ if TYPE_CHECKING: OpenResponsesRequestToolUnionTypedDict, OpenResponsesRequestType, OpenResponsesRequestTypedDict, + Plugin, + PluginAutoRouter, + PluginAutoRouterTypedDict, + PluginFileParser, + PluginFileParserTypedDict, + PluginModeration, + PluginModerationTypedDict, + PluginResponseHealing, + PluginResponseHealingTypedDict, + PluginTypedDict, + PluginWeb, + PluginWebTypedDict, + Provider, + ProviderTypedDict, ServiceTier, Truncation, ) @@ -929,43 +907,8 @@ __all__ = [ "ChatErrorError", "ChatErrorErrorTypedDict", "ChatGenerationParams", - "ChatGenerationParamsDataCollection", "ChatGenerationParamsImageConfig", "ChatGenerationParamsImageConfigTypedDict", - "ChatGenerationParamsMaxPrice", - "ChatGenerationParamsMaxPriceTypedDict", - "ChatGenerationParamsPluginAutoRouter", - "ChatGenerationParamsPluginAutoRouterTypedDict", - "ChatGenerationParamsPluginFileParser", - "ChatGenerationParamsPluginFileParserTypedDict", - "ChatGenerationParamsPluginModeration", - "ChatGenerationParamsPluginModerationTypedDict", - "ChatGenerationParamsPluginResponseHealing", - "ChatGenerationParamsPluginResponseHealingTypedDict", - "ChatGenerationParamsPluginUnion", - "ChatGenerationParamsPluginUnionTypedDict", - "ChatGenerationParamsPluginWeb", - "ChatGenerationParamsPluginWebTypedDict", - "ChatGenerationParamsPreferredMaxLatency", - "ChatGenerationParamsPreferredMaxLatencyTypedDict", - "ChatGenerationParamsPreferredMaxLatencyUnion", - "ChatGenerationParamsPreferredMaxLatencyUnionTypedDict", - "ChatGenerationParamsPreferredMinThroughput", - "ChatGenerationParamsPreferredMinThroughputTypedDict", - "ChatGenerationParamsPreferredMinThroughputUnion", - "ChatGenerationParamsPreferredMinThroughputUnionTypedDict", - "ChatGenerationParamsProvider", - "ChatGenerationParamsProviderTypedDict", - "ChatGenerationParamsResponseFormatJSONObject", - "ChatGenerationParamsResponseFormatJSONObjectTypedDict", - "ChatGenerationParamsResponseFormatPython", - "ChatGenerationParamsResponseFormatPythonTypedDict", - "ChatGenerationParamsResponseFormatText", - "ChatGenerationParamsResponseFormatTextTypedDict", - "ChatGenerationParamsResponseFormatUnion", - "ChatGenerationParamsResponseFormatUnionTypedDict", - "ChatGenerationParamsStop", - "ChatGenerationParamsStopTypedDict", "ChatGenerationParamsTypedDict", "ChatGenerationTokenUsage", "ChatGenerationTokenUsageTypedDict", @@ -1024,29 +967,10 @@ __all__ = [ "Code", "CodeEnum", "CodeTypedDict", - "CompletionChoice", - "CompletionChoiceTypedDict", - "CompletionCreateParams", - "CompletionCreateParamsResponseFormatJSONObject", - "CompletionCreateParamsResponseFormatJSONObjectTypedDict", - "CompletionCreateParamsResponseFormatPython", - "CompletionCreateParamsResponseFormatPythonTypedDict", - "CompletionCreateParamsResponseFormatText", - "CompletionCreateParamsResponseFormatTextTypedDict", - "CompletionCreateParamsResponseFormatUnion", - "CompletionCreateParamsResponseFormatUnionTypedDict", - "CompletionCreateParamsStop", - "CompletionCreateParamsStopTypedDict", - "CompletionCreateParamsTypedDict", - "CompletionFinishReason", - "CompletionLogprobs", - "CompletionLogprobsTypedDict", - "CompletionResponse", - "CompletionResponseTypedDict", + "Completion", "CompletionTokensDetails", "CompletionTokensDetailsTypedDict", - "CompletionUsage", - "CompletionUsageTypedDict", + "CompletionTypedDict", "CostDetails", "CostDetailsTypedDict", "CreateChargeRequest", @@ -1056,6 +980,10 @@ __all__ = [ "DebugTypedDict", "DefaultParameters", "DefaultParametersTypedDict", + "DeveloperMessage", + "DeveloperMessageContent", + "DeveloperMessageContentTypedDict", + "DeveloperMessageTypedDict", "EdgeNetworkTimeoutResponseErrorData", "EdgeNetworkTimeoutResponseErrorDataTypedDict", "Effort", @@ -1090,10 +1018,6 @@ __all__ = [ "Logprob", "LogprobTypedDict", "Message", - "MessageContent", - "MessageContentTypedDict", - "MessageDeveloper", - "MessageDeveloperTypedDict", "MessageTypedDict", "Modality", "Model", @@ -1278,20 +1202,6 @@ __all__ = [ "OpenResponsesRequestOnlyTypedDict", "OpenResponsesRequestOrder", "OpenResponsesRequestOrderTypedDict", - "OpenResponsesRequestPluginAutoRouter", - "OpenResponsesRequestPluginAutoRouterTypedDict", - "OpenResponsesRequestPluginFileParser", - "OpenResponsesRequestPluginFileParserTypedDict", - "OpenResponsesRequestPluginModeration", - "OpenResponsesRequestPluginModerationTypedDict", - "OpenResponsesRequestPluginResponseHealing", - "OpenResponsesRequestPluginResponseHealingTypedDict", - "OpenResponsesRequestPluginUnion", - "OpenResponsesRequestPluginUnionTypedDict", - "OpenResponsesRequestPluginWeb", - "OpenResponsesRequestPluginWebTypedDict", - "OpenResponsesRequestProvider", - "OpenResponsesRequestProviderTypedDict", "OpenResponsesRequestSort", "OpenResponsesRequestSortTypedDict", "OpenResponsesRequestToolFunction", @@ -1400,6 +1310,18 @@ __all__ = [ "PercentileStatsTypedDict", "PercentileThroughputCutoffs", "PercentileThroughputCutoffsTypedDict", + "Plugin", + "PluginAutoRouter", + "PluginAutoRouterTypedDict", + "PluginFileParser", + "PluginFileParserTypedDict", + "PluginModeration", + "PluginModerationTypedDict", + "PluginResponseHealing", + "PluginResponseHealingTypedDict", + "PluginTypedDict", + "PluginWeb", + "PluginWebTypedDict", "PreferredMaxLatency", "PreferredMaxLatencyTypedDict", "PreferredMinThroughput", @@ -1410,6 +1332,7 @@ __all__ = [ "PromptTokensDetails", "PromptTokensDetailsTypedDict", "PromptTypedDict", + "Provider", "ProviderName", "ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorDataTypedDict", @@ -1437,13 +1360,13 @@ __all__ = [ "ProviderSortConfigUnionTypedDict", "ProviderSortUnion", "ProviderSortUnionTypedDict", + "ProviderTypedDict", "PublicEndpoint", "PublicEndpointQuantization", "PublicEndpointTypedDict", "PublicPricing", "PublicPricingTypedDict", "Quantization", - "Quantizations", "Reason", "Reasoning", "ReasoningSummaryText", @@ -1456,12 +1379,20 @@ __all__ = [ "ReasoningTypedDict", "RequestTimeoutResponseErrorData", "RequestTimeoutResponseErrorDataTypedDict", + "ResponseFormat", + "ResponseFormatJSONObject", + "ResponseFormatJSONObjectTypedDict", "ResponseFormatJSONSchema", "ResponseFormatJSONSchemaTypedDict", + "ResponseFormatPython", + "ResponseFormatPythonTypedDict", + "ResponseFormatText", "ResponseFormatTextConfig", "ResponseFormatTextConfigTypedDict", "ResponseFormatTextGrammar", "ResponseFormatTextGrammarTypedDict", + "ResponseFormatTextTypedDict", + "ResponseFormatTypedDict", "ResponseInputAudio", "ResponseInputAudioFormat", "ResponseInputAudioInputAudio", @@ -1546,25 +1477,49 @@ __all__ = [ "ResponsesWebSearchUserLocationTypedDict", "Route", "Schema0", - "Schema0Enum", "Schema0TypedDict", - "Schema2", - "Schema2ReasoningEncrypted", - "Schema2ReasoningEncryptedTypedDict", - "Schema2ReasoningSummary", - "Schema2ReasoningSummaryTypedDict", - "Schema2ReasoningText", - "Schema2ReasoningTextTypedDict", - "Schema2TypedDict", - "Schema4", + "Schema10", + "Schema10TypedDict", + "Schema14", + "Schema14TypedDict", + "Schema15", + "Schema15TypedDict", + "Schema15Union", + "Schema15UnionTypedDict", + "Schema17", + "Schema17AutoRouter", + "Schema17AutoRouterTypedDict", + "Schema17FileParser", + "Schema17FileParserTypedDict", + "Schema17Moderation", + "Schema17ModerationTypedDict", + "Schema17ResponseHealing", + "Schema17ResponseHealingTypedDict", + "Schema17TypedDict", + "Schema17Web", + "Schema17WebTypedDict", + "Schema19", + "Schema19ReasoningEncrypted", + "Schema19ReasoningEncryptedTypedDict", + "Schema19ReasoningSummary", + "Schema19ReasoningSummaryTypedDict", + "Schema19ReasoningText", + "Schema19ReasoningTextTypedDict", + "Schema19TypedDict", + "Schema21", + "Schema3", + "Schema5", + "Schema5Enum", + "Schema5TypedDict", + "Schema8", "Security", "SecurityTypedDict", "ServiceTier", "ServiceUnavailableResponseErrorData", "ServiceUnavailableResponseErrorDataTypedDict", "SortEnum", - "StreamOptions", - "StreamOptionsTypedDict", + "Stop", + "StopTypedDict", "SystemMessage", "SystemMessageContent", "SystemMessageContentTypedDict", @@ -1629,18 +1584,42 @@ __all__ = [ ] _dynamic_imports: dict[str, str] = { - "Schema0": "._schema0", - "Schema0Enum": "._schema0", - "Schema0TypedDict": "._schema0", - "Schema2": "._schema2", - "Schema2ReasoningEncrypted": "._schema2", - "Schema2ReasoningEncryptedTypedDict": "._schema2", - "Schema2ReasoningSummary": "._schema2", - "Schema2ReasoningSummaryTypedDict": "._schema2", - "Schema2ReasoningText": "._schema2", - "Schema2ReasoningTextTypedDict": "._schema2", - "Schema2TypedDict": "._schema2", - "Schema4": "._schema2", + "Completion": "._schema10", + "CompletionTypedDict": "._schema10", + "Prompt": "._schema10", + "PromptTypedDict": "._schema10", + "Schema10": "._schema10", + "Schema10TypedDict": "._schema10", + "Schema14": "._schema14", + "Schema14TypedDict": "._schema14", + "Engine": "._schema17", + "Pdf": "._schema17", + "PdfEngine": "._schema17", + "PdfTypedDict": "._schema17", + "Schema17": "._schema17", + "Schema17AutoRouter": "._schema17", + "Schema17AutoRouterTypedDict": "._schema17", + "Schema17FileParser": "._schema17", + "Schema17FileParserTypedDict": "._schema17", + "Schema17Moderation": "._schema17", + "Schema17ModerationTypedDict": "._schema17", + "Schema17ResponseHealing": "._schema17", + "Schema17ResponseHealingTypedDict": "._schema17", + "Schema17TypedDict": "._schema17", + "Schema17Web": "._schema17", + "Schema17WebTypedDict": "._schema17", + "Schema19": "._schema19", + "Schema19ReasoningEncrypted": "._schema19", + "Schema19ReasoningEncryptedTypedDict": "._schema19", + "Schema19ReasoningSummary": "._schema19", + "Schema19ReasoningSummaryTypedDict": "._schema19", + "Schema19ReasoningText": "._schema19", + "Schema19ReasoningTextTypedDict": "._schema19", + "Schema19TypedDict": "._schema19", + "Schema21": "._schema19", + "Schema5": "._schema5", + "Schema5Enum": "._schema5", + "Schema5TypedDict": "._schema5", "ActivityItem": ".activityitem", "ActivityItemTypedDict": ".activityitem", "AssistantMessage": ".assistantmessage", @@ -1661,56 +1640,34 @@ _dynamic_imports: dict[str, str] = { "Code": ".chaterror", "CodeTypedDict": ".chaterror", "ChatGenerationParams": ".chatgenerationparams", - "ChatGenerationParamsDataCollection": ".chatgenerationparams", "ChatGenerationParamsImageConfig": ".chatgenerationparams", "ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams", - "ChatGenerationParamsMaxPrice": ".chatgenerationparams", - "ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams", - "ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginFileParser": ".chatgenerationparams", - "ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginModeration": ".chatgenerationparams", - "ChatGenerationParamsPluginModerationTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginResponseHealing": ".chatgenerationparams", - "ChatGenerationParamsPluginResponseHealingTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginUnion": ".chatgenerationparams", - "ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPluginWeb": ".chatgenerationparams", - "ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatency": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatencyTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatencyUnion": ".chatgenerationparams", - "ChatGenerationParamsPreferredMaxLatencyUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughput": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughputTypedDict": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughputUnion": ".chatgenerationparams", - "ChatGenerationParamsPreferredMinThroughputUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsProvider": ".chatgenerationparams", - "ChatGenerationParamsProviderTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatJSONObject": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatJSONObjectTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatPython": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatPythonTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatText": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams", - "ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams", - "ChatGenerationParamsStop": ".chatgenerationparams", - "ChatGenerationParamsStopTypedDict": ".chatgenerationparams", "ChatGenerationParamsTypedDict": ".chatgenerationparams", "Debug": ".chatgenerationparams", "DebugTypedDict": ".chatgenerationparams", "Effort": ".chatgenerationparams", - "Engine": ".chatgenerationparams", "Modality": ".chatgenerationparams", - "Pdf": ".chatgenerationparams", - "PdfEngine": ".chatgenerationparams", - "PdfTypedDict": ".chatgenerationparams", - "Quantizations": ".chatgenerationparams", "Reasoning": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams", + "ResponseFormat": ".chatgenerationparams", + "ResponseFormatJSONObject": ".chatgenerationparams", + "ResponseFormatJSONObjectTypedDict": ".chatgenerationparams", + "ResponseFormatPython": ".chatgenerationparams", + "ResponseFormatPythonTypedDict": ".chatgenerationparams", + "ResponseFormatText": ".chatgenerationparams", + "ResponseFormatTextTypedDict": ".chatgenerationparams", + "ResponseFormatTypedDict": ".chatgenerationparams", "Route": ".chatgenerationparams", + "Schema0": ".chatgenerationparams", + "Schema0TypedDict": ".chatgenerationparams", + "Schema15": ".chatgenerationparams", + "Schema15TypedDict": ".chatgenerationparams", + "Schema15Union": ".chatgenerationparams", + "Schema15UnionTypedDict": ".chatgenerationparams", + "Schema3": ".chatgenerationparams", + "Schema8": ".chatgenerationparams", + "Stop": ".chatgenerationparams", + "StopTypedDict": ".chatgenerationparams", "ChatGenerationTokenUsage": ".chatgenerationtokenusage", "ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage", "CompletionTokensDetails": ".chatgenerationtokenusage", @@ -1774,37 +1731,16 @@ _dynamic_imports: dict[str, str] = { "ChatStreamingResponseChunkTypedDict": ".chatstreamingresponsechunk", "ChatStreamOptions": ".chatstreamoptions", "ChatStreamOptionsTypedDict": ".chatstreamoptions", - "CompletionChoice": ".completionchoice", - "CompletionChoiceTypedDict": ".completionchoice", - "CompletionFinishReason": ".completionchoice", - "CompletionCreateParams": ".completioncreateparams", - "CompletionCreateParamsResponseFormatJSONObject": ".completioncreateparams", - "CompletionCreateParamsResponseFormatJSONObjectTypedDict": ".completioncreateparams", - "CompletionCreateParamsResponseFormatPython": ".completioncreateparams", - "CompletionCreateParamsResponseFormatPythonTypedDict": ".completioncreateparams", - "CompletionCreateParamsResponseFormatText": ".completioncreateparams", - "CompletionCreateParamsResponseFormatTextTypedDict": ".completioncreateparams", - "CompletionCreateParamsResponseFormatUnion": ".completioncreateparams", - "CompletionCreateParamsResponseFormatUnionTypedDict": ".completioncreateparams", - "CompletionCreateParamsStop": ".completioncreateparams", - "CompletionCreateParamsStopTypedDict": ".completioncreateparams", - "CompletionCreateParamsTypedDict": ".completioncreateparams", - "Prompt": ".completioncreateparams", - "PromptTypedDict": ".completioncreateparams", - "StreamOptions": ".completioncreateparams", - "StreamOptionsTypedDict": ".completioncreateparams", - "CompletionLogprobs": ".completionlogprobs", - "CompletionLogprobsTypedDict": ".completionlogprobs", - "CompletionResponse": ".completionresponse", - "CompletionResponseTypedDict": ".completionresponse", - "CompletionUsage": ".completionusage", - "CompletionUsageTypedDict": ".completionusage", "ChainID": ".createchargerequest", "CreateChargeRequest": ".createchargerequest", "CreateChargeRequestTypedDict": ".createchargerequest", "DataCollection": ".datacollection", "DefaultParameters": ".defaultparameters", "DefaultParametersTypedDict": ".defaultparameters", + "DeveloperMessage": ".developermessage", + "DeveloperMessageContent": ".developermessage", + "DeveloperMessageContentTypedDict": ".developermessage", + "DeveloperMessageTypedDict": ".developermessage", "EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata", "EdgeNetworkTimeoutResponseErrorDataTypedDict": ".edgenetworktimeoutresponseerrordata", "EndpointStatus": ".endpointstatus", @@ -1829,10 +1765,6 @@ _dynamic_imports: dict[str, str] = { "ListEndpointsResponseTypedDict": ".listendpointsresponse", "Tokenizer": ".listendpointsresponse", "Message": ".message", - "MessageContent": ".message", - "MessageContentTypedDict": ".message", - "MessageDeveloper": ".message", - "MessageDeveloperTypedDict": ".message", "MessageTypedDict": ".message", "Model": ".model", "ModelTypedDict": ".model", @@ -2026,20 +1958,6 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest", "OpenResponsesRequestOrder": ".openresponsesrequest", "OpenResponsesRequestOrderTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest", - "OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginFileParser": ".openresponsesrequest", - "OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginModeration": ".openresponsesrequest", - "OpenResponsesRequestPluginModerationTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginResponseHealing": ".openresponsesrequest", - "OpenResponsesRequestPluginResponseHealingTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginUnion": ".openresponsesrequest", - "OpenResponsesRequestPluginUnionTypedDict": ".openresponsesrequest", - "OpenResponsesRequestPluginWeb": ".openresponsesrequest", - "OpenResponsesRequestPluginWebTypedDict": ".openresponsesrequest", - "OpenResponsesRequestProvider": ".openresponsesrequest", - "OpenResponsesRequestProviderTypedDict": ".openresponsesrequest", "OpenResponsesRequestSort": ".openresponsesrequest", "OpenResponsesRequestSortTypedDict": ".openresponsesrequest", "OpenResponsesRequestToolFunction": ".openresponsesrequest", @@ -2048,6 +1966,20 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest", "OpenResponsesRequestType": ".openresponsesrequest", "OpenResponsesRequestTypedDict": ".openresponsesrequest", + "Plugin": ".openresponsesrequest", + "PluginAutoRouter": ".openresponsesrequest", + "PluginAutoRouterTypedDict": ".openresponsesrequest", + "PluginFileParser": ".openresponsesrequest", + "PluginFileParserTypedDict": ".openresponsesrequest", + "PluginModeration": ".openresponsesrequest", + "PluginModerationTypedDict": ".openresponsesrequest", + "PluginResponseHealing": ".openresponsesrequest", + "PluginResponseHealingTypedDict": ".openresponsesrequest", + "PluginTypedDict": ".openresponsesrequest", + "PluginWeb": ".openresponsesrequest", + "PluginWebTypedDict": ".openresponsesrequest", + "Provider": ".openresponsesrequest", + "ProviderTypedDict": ".openresponsesrequest", "ServiceTier": ".openresponsesrequest", "Truncation": ".openresponsesrequest", "OpenResponsesResponseText": ".openresponsesresponsetext", diff --git a/src/openrouter/components/_schema10.py b/src/openrouter/components/_schema10.py new file mode 100644 index 0000000..ec61549 --- /dev/null +++ b/src/openrouter/components/_schema10.py @@ -0,0 +1,39 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from ._schema14 import Schema14, Schema14TypedDict +from openrouter.types import BaseModel +from typing import Any, Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any]) + + +Prompt = TypeAliasType("Prompt", Union[float, str, Any]) + + +CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any]) + + +Completion = TypeAliasType("Completion", Union[float, str, Any]) + + +class Schema10TypedDict(TypedDict): + prompt: NotRequired[PromptTypedDict] + completion: NotRequired[CompletionTypedDict] + image: NotRequired[Schema14TypedDict] + audio: NotRequired[Schema14TypedDict] + request: NotRequired[Schema14TypedDict] + + +class Schema10(BaseModel): + prompt: Optional[Prompt] = None + + completion: Optional[Completion] = None + + image: Optional[Schema14] = None + + audio: Optional[Schema14] = None + + request: Optional[Schema14] = None diff --git a/src/openrouter/components/_schema14.py b/src/openrouter/components/_schema14.py new file mode 100644 index 0000000..2f9446a --- /dev/null +++ b/src/openrouter/components/_schema14.py @@ -0,0 +1,11 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from typing import Any, Union +from typing_extensions import TypeAliasType + + +Schema14TypedDict = TypeAliasType("Schema14TypedDict", Union[float, str, Any]) + + +Schema14 = TypeAliasType("Schema14", Union[float, str, Any]) diff --git a/src/openrouter/components/_schema17.py b/src/openrouter/components/_schema17.py new file mode 100644 index 0000000..4122820 --- /dev/null +++ b/src/openrouter/components/_schema17.py @@ -0,0 +1,154 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from openrouter.utils import get_discriminator, validate_const, validate_open_enum +import pydantic +from pydantic import Discriminator, Tag +from pydantic.functional_validators import AfterValidator, PlainValidator +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class Schema17ResponseHealingTypedDict(TypedDict): + id: Literal["response-healing"] + enabled: NotRequired[bool] + + +class Schema17ResponseHealing(BaseModel): + ID: Annotated[ + Annotated[ + Literal["response-healing"], + AfterValidator(validate_const("response-healing")), + ], + pydantic.Field(alias="id"), + ] = "response-healing" + + enabled: Optional[bool] = None + + +PdfEngine = Union[ + Literal[ + "mistral-ocr", + "pdf-text", + "native", + ], + UnrecognizedStr, +] + + +class PdfTypedDict(TypedDict): + engine: NotRequired[PdfEngine] + + +class Pdf(BaseModel): + engine: Annotated[ + Optional[PdfEngine], PlainValidator(validate_open_enum(False)) + ] = None + + +class Schema17FileParserTypedDict(TypedDict): + id: Literal["file-parser"] + enabled: NotRequired[bool] + pdf: NotRequired[PdfTypedDict] + + +class Schema17FileParser(BaseModel): + ID: Annotated[ + Annotated[ + Literal["file-parser"], AfterValidator(validate_const("file-parser")) + ], + pydantic.Field(alias="id"), + ] = "file-parser" + + enabled: Optional[bool] = None + + pdf: Optional[Pdf] = None + + +Engine = Union[ + Literal[ + "native", + "exa", + ], + UnrecognizedStr, +] + + +class Schema17WebTypedDict(TypedDict): + id: Literal["web"] + enabled: NotRequired[bool] + max_results: NotRequired[float] + search_prompt: NotRequired[str] + engine: NotRequired[Engine] + + +class Schema17Web(BaseModel): + ID: Annotated[ + Annotated[Literal["web"], AfterValidator(validate_const("web"))], + pydantic.Field(alias="id"), + ] = "web" + + enabled: Optional[bool] = None + + max_results: Optional[float] = None + + search_prompt: Optional[str] = None + + engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = ( + None + ) + + +class Schema17ModerationTypedDict(TypedDict): + id: Literal["moderation"] + + +class Schema17Moderation(BaseModel): + ID: Annotated[ + Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))], + pydantic.Field(alias="id"), + ] = "moderation" + + +class Schema17AutoRouterTypedDict(TypedDict): + id: Literal["auto-router"] + enabled: NotRequired[bool] + allowed_models: NotRequired[List[str]] + + +class Schema17AutoRouter(BaseModel): + ID: Annotated[ + Annotated[ + Literal["auto-router"], AfterValidator(validate_const("auto-router")) + ], + pydantic.Field(alias="id"), + ] = "auto-router" + + enabled: Optional[bool] = None + + allowed_models: Optional[List[str]] = None + + +Schema17TypedDict = TypeAliasType( + "Schema17TypedDict", + Union[ + Schema17ModerationTypedDict, + Schema17ResponseHealingTypedDict, + Schema17AutoRouterTypedDict, + Schema17FileParserTypedDict, + Schema17WebTypedDict, + ], +) + + +Schema17 = Annotated[ + Union[ + Annotated[Schema17AutoRouter, Tag("auto-router")], + Annotated[Schema17Moderation, Tag("moderation")], + Annotated[Schema17Web, Tag("web")], + Annotated[Schema17FileParser, Tag("file-parser")], + Annotated[Schema17ResponseHealing, Tag("response-healing")], + ], + Discriminator(lambda m: get_discriminator(m, "id", "id")), +] diff --git a/src/openrouter/components/_schema2.py b/src/openrouter/components/_schema19.py similarity index 81% rename from src/openrouter/components/_schema2.py rename to src/openrouter/components/_schema19.py index faec5d8..3c05ebd 100644 --- a/src/openrouter/components/_schema2.py +++ b/src/openrouter/components/_schema19.py @@ -17,7 +17,7 @@ from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -Schema4 = Union[ +Schema21 = Union[ Literal[ "unknown", "openai-responses-v1", @@ -30,16 +30,16 @@ Schema4 = Union[ ] -class Schema2ReasoningTextTypedDict(TypedDict): +class Schema19ReasoningTextTypedDict(TypedDict): type: Literal["reasoning.text"] text: NotRequired[Nullable[str]] signature: NotRequired[Nullable[str]] id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema4]] + format_: NotRequired[Nullable[Schema21]] index: NotRequired[float] -class Schema2ReasoningText(BaseModel): +class Schema19ReasoningText(BaseModel): TYPE: Annotated[ Annotated[ Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text")) @@ -54,7 +54,9 @@ class Schema2ReasoningText(BaseModel): id: OptionalNullable[str] = UNSET format_: Annotated[ - Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], + Annotated[ + OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) + ], pydantic.Field(alias="format"), ] = UNSET @@ -91,15 +93,15 @@ class Schema2ReasoningText(BaseModel): return m -class Schema2ReasoningEncryptedTypedDict(TypedDict): +class Schema19ReasoningEncryptedTypedDict(TypedDict): data: str type: Literal["reasoning.encrypted"] id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema4]] + format_: NotRequired[Nullable[Schema21]] index: NotRequired[float] -class Schema2ReasoningEncrypted(BaseModel): +class Schema19ReasoningEncrypted(BaseModel): data: str TYPE: Annotated[ @@ -113,7 +115,9 @@ class Schema2ReasoningEncrypted(BaseModel): id: OptionalNullable[str] = UNSET format_: Annotated[ - Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], + Annotated[ + OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) + ], pydantic.Field(alias="format"), ] = UNSET @@ -150,15 +154,15 @@ class Schema2ReasoningEncrypted(BaseModel): return m -class Schema2ReasoningSummaryTypedDict(TypedDict): +class Schema19ReasoningSummaryTypedDict(TypedDict): summary: str type: Literal["reasoning.summary"] id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema4]] + format_: NotRequired[Nullable[Schema21]] index: NotRequired[float] -class Schema2ReasoningSummary(BaseModel): +class Schema19ReasoningSummary(BaseModel): summary: str TYPE: Annotated[ @@ -172,7 +176,9 @@ class Schema2ReasoningSummary(BaseModel): id: OptionalNullable[str] = UNSET format_: Annotated[ - Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], + Annotated[ + OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) + ], pydantic.Field(alias="format"), ] = UNSET @@ -209,21 +215,21 @@ class Schema2ReasoningSummary(BaseModel): return m -Schema2TypedDict = TypeAliasType( - "Schema2TypedDict", +Schema19TypedDict = TypeAliasType( + "Schema19TypedDict", Union[ - Schema2ReasoningSummaryTypedDict, - Schema2ReasoningEncryptedTypedDict, - Schema2ReasoningTextTypedDict, + Schema19ReasoningSummaryTypedDict, + Schema19ReasoningEncryptedTypedDict, + Schema19ReasoningTextTypedDict, ], ) -Schema2 = Annotated[ +Schema19 = Annotated[ Union[ - Annotated[Schema2ReasoningSummary, Tag("reasoning.summary")], - Annotated[Schema2ReasoningEncrypted, Tag("reasoning.encrypted")], - Annotated[Schema2ReasoningText, Tag("reasoning.text")], + Annotated[Schema19ReasoningSummary, Tag("reasoning.summary")], + Annotated[Schema19ReasoningEncrypted, Tag("reasoning.encrypted")], + Annotated[Schema19ReasoningText, Tag("reasoning.text")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] diff --git a/src/openrouter/components/_schema0.py b/src/openrouter/components/_schema5.py similarity index 88% rename from src/openrouter/components/_schema0.py rename to src/openrouter/components/_schema5.py index 4da27c8..c7458de 100644 --- a/src/openrouter/components/_schema0.py +++ b/src/openrouter/components/_schema5.py @@ -8,11 +8,12 @@ from typing import Literal, Union from typing_extensions import Annotated, TypeAliasType -Schema0Enum = Union[ +Schema5Enum = Union[ Literal[ "AI21", "AionLabs", "Alibaba", + "Ambient", "Amazon Bedrock", "Amazon Nova", "Anthropic", @@ -69,6 +70,7 @@ Schema0Enum = Union[ "Seed", "SiliconFlow", "Sourceful", + "StepFun", "Stealth", "StreamLake", "Switchpoint", @@ -85,10 +87,10 @@ Schema0Enum = Union[ ] -Schema0TypedDict = TypeAliasType("Schema0TypedDict", Union[Schema0Enum, str]) +Schema5TypedDict = TypeAliasType("Schema5TypedDict", Union[Schema5Enum, str]) -Schema0 = TypeAliasType( - "Schema0", - Union[Annotated[Schema0Enum, PlainValidator(validate_open_enum(False))], str], +Schema5 = TypeAliasType( + "Schema5", + Union[Annotated[Schema5Enum, PlainValidator(validate_open_enum(False))], str], ) diff --git a/src/openrouter/components/assistantmessage.py b/src/openrouter/components/assistantmessage.py index f9f4fa6..a3ec986 100644 --- a/src/openrouter/components/assistantmessage.py +++ b/src/openrouter/components/assistantmessage.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema2 import Schema2, Schema2TypedDict +from ._schema19 import Schema19, Schema19TypedDict from .chatmessagecontentitem import ( ChatMessageContentItem, ChatMessageContentItemTypedDict, @@ -56,7 +56,7 @@ class AssistantMessageTypedDict(TypedDict): tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]] refusal: NotRequired[Nullable[str]] reasoning: NotRequired[Nullable[str]] - reasoning_details: NotRequired[List[Schema2TypedDict]] + reasoning_details: NotRequired[List[Schema19TypedDict]] images: NotRequired[List[ImageTypedDict]] @@ -76,7 +76,7 @@ class AssistantMessage(BaseModel): reasoning: OptionalNullable[str] = UNSET - reasoning_details: Optional[List[Schema2]] = None + reasoning_details: Optional[List[Schema19]] = None images: Optional[List[Image]] = None diff --git a/src/openrouter/components/chatgenerationparams.py b/src/openrouter/components/chatgenerationparams.py index 226d298..c052d8c 100644 --- a/src/openrouter/components/chatgenerationparams.py +++ b/src/openrouter/components/chatgenerationparams.py @@ -1,7 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema0 import Schema0, Schema0TypedDict +from ._schema10 import Schema10, Schema10TypedDict +from ._schema17 import Schema17, Schema17TypedDict +from ._schema5 import Schema5, Schema5TypedDict from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict from .message import Message, MessageTypedDict from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict @@ -31,7 +33,7 @@ from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -ChatGenerationParamsDataCollection = Union[ +Schema3 = Union[ Literal[ "deny", "allow", @@ -40,7 +42,7 @@ ChatGenerationParamsDataCollection = Union[ ] -Quantizations = Union[ +Schema8 = Union[ Literal[ "int4", "int8", @@ -56,38 +58,14 @@ Quantizations = Union[ ] -class ChatGenerationParamsMaxPriceTypedDict(TypedDict): - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - - prompt: NotRequired[Any] - completion: NotRequired[Any] - image: NotRequired[Any] - audio: NotRequired[Any] - request: NotRequired[Any] - - -class ChatGenerationParamsMaxPrice(BaseModel): - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - - prompt: Optional[Any] = None - - completion: Optional[Any] = None - - image: Optional[Any] = None - - audio: Optional[Any] = None - - request: Optional[Any] = None - - -class ChatGenerationParamsPreferredMinThroughputTypedDict(TypedDict): +class Schema15TypedDict(TypedDict): p50: NotRequired[Nullable[float]] p75: NotRequired[Nullable[float]] p90: NotRequired[Nullable[float]] p99: NotRequired[Nullable[float]] -class ChatGenerationParamsPreferredMinThroughput(BaseModel): +class Schema15(BaseModel): p50: OptionalNullable[float] = UNSET p75: OptionalNullable[float] = UNSET @@ -127,170 +105,60 @@ class ChatGenerationParamsPreferredMinThroughput(BaseModel): return m -ChatGenerationParamsPreferredMinThroughputUnionTypedDict = TypeAliasType( - "ChatGenerationParamsPreferredMinThroughputUnionTypedDict", - Union[ChatGenerationParamsPreferredMinThroughputTypedDict, float], +Schema15UnionTypedDict = TypeAliasType( + "Schema15UnionTypedDict", Union[Schema15TypedDict, float] ) -ChatGenerationParamsPreferredMinThroughputUnion = TypeAliasType( - "ChatGenerationParamsPreferredMinThroughputUnion", - Union[ChatGenerationParamsPreferredMinThroughput, float], -) +Schema15Union = TypeAliasType("Schema15Union", Union[Schema15, float]) -class ChatGenerationParamsPreferredMaxLatencyTypedDict(TypedDict): - p50: NotRequired[Nullable[float]] - p75: NotRequired[Nullable[float]] - p90: NotRequired[Nullable[float]] - p99: NotRequired[Nullable[float]] - - -class ChatGenerationParamsPreferredMaxLatency(BaseModel): - p50: OptionalNullable[float] = UNSET - - p75: OptionalNullable[float] = UNSET - - p90: OptionalNullable[float] = UNSET - - p99: OptionalNullable[float] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["p50", "p75", "p90", "p99"] - nullable_fields = ["p50", "p75", "p90", "p99"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m - - -ChatGenerationParamsPreferredMaxLatencyUnionTypedDict = TypeAliasType( - "ChatGenerationParamsPreferredMaxLatencyUnionTypedDict", - Union[ChatGenerationParamsPreferredMaxLatencyTypedDict, float], -) - - -ChatGenerationParamsPreferredMaxLatencyUnion = TypeAliasType( - "ChatGenerationParamsPreferredMaxLatencyUnion", - Union[ChatGenerationParamsPreferredMaxLatency, float], -) - - -class ChatGenerationParamsProviderTypedDict(TypedDict): +class Schema0TypedDict(TypedDict): allow_fallbacks: NotRequired[Nullable[bool]] - r"""Whether to allow backup providers to serve requests - - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - - """ require_parameters: NotRequired[Nullable[bool]] - r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" - data_collection: NotRequired[Nullable[ChatGenerationParamsDataCollection]] - r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - - allow: (default) allow providers which store user data non-transiently and may train on it - - - deny: use only providers which do not collect user data. - """ + data_collection: NotRequired[Nullable[Schema3]] zdr: NotRequired[Nullable[bool]] enforce_distillable_text: NotRequired[Nullable[bool]] - order: NotRequired[Nullable[List[Schema0TypedDict]]] - r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" - only: NotRequired[Nullable[List[Schema0TypedDict]]] - r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" - ignore: NotRequired[Nullable[List[Schema0TypedDict]]] - r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" - quantizations: NotRequired[Nullable[List[Quantizations]]] - r"""A list of quantization levels to filter the provider by.""" + order: NotRequired[Nullable[List[Schema5TypedDict]]] + only: NotRequired[Nullable[List[Schema5TypedDict]]] + ignore: NotRequired[Nullable[List[Schema5TypedDict]]] + quantizations: NotRequired[Nullable[List[Schema8]]] sort: NotRequired[Nullable[ProviderSortUnionTypedDict]] - r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict] - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - preferred_min_throughput: NotRequired[ - Nullable[ChatGenerationParamsPreferredMinThroughputUnionTypedDict] - ] - r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" - preferred_max_latency: NotRequired[ - Nullable[ChatGenerationParamsPreferredMaxLatencyUnionTypedDict] - ] - r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" + max_price: NotRequired[Schema10TypedDict] + preferred_min_throughput: NotRequired[Nullable[Schema15UnionTypedDict]] + preferred_max_latency: NotRequired[Nullable[Schema15UnionTypedDict]] -class ChatGenerationParamsProvider(BaseModel): +class Schema0(BaseModel): allow_fallbacks: OptionalNullable[bool] = UNSET - r"""Whether to allow backup providers to serve requests - - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. - - false: use only the primary/custom provider, and return the upstream error if it's unavailable. - - """ require_parameters: OptionalNullable[bool] = UNSET - r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" data_collection: Annotated[ - OptionalNullable[ChatGenerationParamsDataCollection], - PlainValidator(validate_open_enum(False)), + OptionalNullable[Schema3], PlainValidator(validate_open_enum(False)) ] = UNSET - r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - - allow: (default) allow providers which store user data non-transiently and may train on it - - - deny: use only providers which do not collect user data. - """ zdr: OptionalNullable[bool] = UNSET enforce_distillable_text: OptionalNullable[bool] = UNSET - order: OptionalNullable[List[Schema0]] = UNSET - r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + order: OptionalNullable[List[Schema5]] = UNSET - only: OptionalNullable[List[Schema0]] = UNSET - r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + only: OptionalNullable[List[Schema5]] = UNSET - ignore: OptionalNullable[List[Schema0]] = UNSET - r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" + ignore: OptionalNullable[List[Schema5]] = UNSET quantizations: OptionalNullable[ - List[Annotated[Quantizations, PlainValidator(validate_open_enum(False))]] + List[Annotated[Schema8, PlainValidator(validate_open_enum(False))]] ] = UNSET - r"""A list of quantization levels to filter the provider by.""" sort: OptionalNullable[ProviderSortUnion] = UNSET - r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - max_price: Optional[ChatGenerationParamsMaxPrice] = None - r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + max_price: Optional[Schema10] = None - preferred_min_throughput: OptionalNullable[ - ChatGenerationParamsPreferredMinThroughputUnion - ] = UNSET - r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" + preferred_min_throughput: OptionalNullable[Schema15Union] = UNSET - preferred_max_latency: OptionalNullable[ - ChatGenerationParamsPreferredMaxLatencyUnion - ] = UNSET - r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" + preferred_max_latency: OptionalNullable[Schema15Union] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -350,150 +218,6 @@ class ChatGenerationParamsProvider(BaseModel): return m -class ChatGenerationParamsPluginResponseHealingTypedDict(TypedDict): - id: Literal["response-healing"] - enabled: NotRequired[bool] - - -class ChatGenerationParamsPluginResponseHealing(BaseModel): - ID: Annotated[ - Annotated[ - Literal["response-healing"], - AfterValidator(validate_const("response-healing")), - ], - pydantic.Field(alias="id"), - ] = "response-healing" - - enabled: Optional[bool] = None - - -PdfEngine = Union[ - Literal[ - "mistral-ocr", - "pdf-text", - "native", - ], - UnrecognizedStr, -] - - -class PdfTypedDict(TypedDict): - engine: NotRequired[PdfEngine] - - -class Pdf(BaseModel): - engine: Annotated[ - Optional[PdfEngine], PlainValidator(validate_open_enum(False)) - ] = None - - -class ChatGenerationParamsPluginFileParserTypedDict(TypedDict): - id: Literal["file-parser"] - enabled: NotRequired[bool] - pdf: NotRequired[PdfTypedDict] - - -class ChatGenerationParamsPluginFileParser(BaseModel): - ID: Annotated[ - Annotated[ - Literal["file-parser"], AfterValidator(validate_const("file-parser")) - ], - pydantic.Field(alias="id"), - ] = "file-parser" - - enabled: Optional[bool] = None - - pdf: Optional[Pdf] = None - - -Engine = Union[ - Literal[ - "native", - "exa", - ], - UnrecognizedStr, -] - - -class ChatGenerationParamsPluginWebTypedDict(TypedDict): - id: Literal["web"] - enabled: NotRequired[bool] - max_results: NotRequired[float] - search_prompt: NotRequired[str] - engine: NotRequired[Engine] - - -class ChatGenerationParamsPluginWeb(BaseModel): - ID: Annotated[ - Annotated[Literal["web"], AfterValidator(validate_const("web"))], - pydantic.Field(alias="id"), - ] = "web" - - enabled: Optional[bool] = None - - max_results: Optional[float] = None - - search_prompt: Optional[str] = None - - engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = ( - None - ) - - -class ChatGenerationParamsPluginModerationTypedDict(TypedDict): - id: Literal["moderation"] - - -class ChatGenerationParamsPluginModeration(BaseModel): - ID: Annotated[ - Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))], - pydantic.Field(alias="id"), - ] = "moderation" - - -class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict): - id: Literal["auto-router"] - enabled: NotRequired[bool] - allowed_models: NotRequired[List[str]] - - -class ChatGenerationParamsPluginAutoRouter(BaseModel): - ID: Annotated[ - Annotated[ - Literal["auto-router"], AfterValidator(validate_const("auto-router")) - ], - pydantic.Field(alias="id"), - ] = "auto-router" - - enabled: Optional[bool] = None - - allowed_models: Optional[List[str]] = None - - -ChatGenerationParamsPluginUnionTypedDict = TypeAliasType( - "ChatGenerationParamsPluginUnionTypedDict", - Union[ - ChatGenerationParamsPluginModerationTypedDict, - ChatGenerationParamsPluginResponseHealingTypedDict, - ChatGenerationParamsPluginAutoRouterTypedDict, - ChatGenerationParamsPluginFileParserTypedDict, - ChatGenerationParamsPluginWebTypedDict, - ], -) - - -ChatGenerationParamsPluginUnion = Annotated[ - Union[ - Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")], - Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")], - Annotated[ChatGenerationParamsPluginWeb, Tag("web")], - Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")], - Annotated[ChatGenerationParamsPluginResponseHealing, Tag("response-healing")], - ], - Discriminator(lambda m: get_discriminator(m, "id", "id")), -] - - Route = Union[ Literal[ "fallback", @@ -562,22 +286,22 @@ class Reasoning(BaseModel): return m -class ChatGenerationParamsResponseFormatPythonTypedDict(TypedDict): +class ResponseFormatPythonTypedDict(TypedDict): type: Literal["python"] -class ChatGenerationParamsResponseFormatPython(BaseModel): +class ResponseFormatPython(BaseModel): TYPE: Annotated[ Annotated[Literal["python"], AfterValidator(validate_const("python"))], pydantic.Field(alias="type"), ] = "python" -class ChatGenerationParamsResponseFormatJSONObjectTypedDict(TypedDict): +class ResponseFormatJSONObjectTypedDict(TypedDict): type: Literal["json_object"] -class ChatGenerationParamsResponseFormatJSONObject(BaseModel): +class ResponseFormatJSONObject(BaseModel): TYPE: Annotated[ Annotated[ Literal["json_object"], AfterValidator(validate_const("json_object")) @@ -586,49 +310,45 @@ class ChatGenerationParamsResponseFormatJSONObject(BaseModel): ] = "json_object" -class ChatGenerationParamsResponseFormatTextTypedDict(TypedDict): +class ResponseFormatTextTypedDict(TypedDict): type: Literal["text"] -class ChatGenerationParamsResponseFormatText(BaseModel): +class ResponseFormatText(BaseModel): TYPE: Annotated[ Annotated[Literal["text"], AfterValidator(validate_const("text"))], pydantic.Field(alias="type"), ] = "text" -ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType( - "ChatGenerationParamsResponseFormatUnionTypedDict", +ResponseFormatTypedDict = TypeAliasType( + "ResponseFormatTypedDict", Union[ - ChatGenerationParamsResponseFormatTextTypedDict, - ChatGenerationParamsResponseFormatJSONObjectTypedDict, - ChatGenerationParamsResponseFormatPythonTypedDict, + ResponseFormatTextTypedDict, + ResponseFormatJSONObjectTypedDict, + ResponseFormatPythonTypedDict, ResponseFormatJSONSchemaTypedDict, ResponseFormatTextGrammarTypedDict, ], ) -ChatGenerationParamsResponseFormatUnion = Annotated[ +ResponseFormat = Annotated[ Union[ - Annotated[ChatGenerationParamsResponseFormatText, Tag("text")], - Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")], + Annotated[ResponseFormatText, Tag("text")], + Annotated[ResponseFormatJSONObject, Tag("json_object")], Annotated[ResponseFormatJSONSchema, Tag("json_schema")], Annotated[ResponseFormatTextGrammar, Tag("grammar")], - Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")], + Annotated[ResponseFormatPython, Tag("python")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] -ChatGenerationParamsStopTypedDict = TypeAliasType( - "ChatGenerationParamsStopTypedDict", Union[str, List[str]] -) +StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str]]) -ChatGenerationParamsStop = TypeAliasType( - "ChatGenerationParamsStop", Union[str, List[str]] -) +Stop = TypeAliasType("Stop", Union[str, List[str]]) class DebugTypedDict(TypedDict): @@ -640,12 +360,12 @@ class Debug(BaseModel): ChatGenerationParamsImageConfigTypedDict = TypeAliasType( - "ChatGenerationParamsImageConfigTypedDict", Union[str, float] + "ChatGenerationParamsImageConfigTypedDict", Union[str, float, List[Any]] ) ChatGenerationParamsImageConfig = TypeAliasType( - "ChatGenerationParamsImageConfig", Union[str, float] + "ChatGenerationParamsImageConfig", Union[str, float, List[Any]] ) @@ -660,14 +380,11 @@ Modality = Union[ class ChatGenerationParamsTypedDict(TypedDict): messages: List[MessageTypedDict] - provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]] - r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]] - r"""Plugins you want to enable for this request, including their settings.""" + provider: NotRequired[Nullable[Schema0TypedDict]] + plugins: NotRequired[List[Schema17TypedDict]] route: NotRequired[Nullable[Route]] user: NotRequired[str] session_id: NotRequired[str] - r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" model: NotRequired[str] models: NotRequired[List[str]] frequency_penalty: NotRequired[Nullable[float]] @@ -679,9 +396,9 @@ class ChatGenerationParamsTypedDict(TypedDict): metadata: NotRequired[Dict[str, str]] presence_penalty: NotRequired[Nullable[float]] reasoning: NotRequired[ReasoningTypedDict] - response_format: NotRequired[ChatGenerationParamsResponseFormatUnionTypedDict] + response_format: NotRequired[ResponseFormatTypedDict] seed: NotRequired[Nullable[int]] - stop: NotRequired[Nullable[ChatGenerationParamsStopTypedDict]] + stop: NotRequired[Nullable[StopTypedDict]] stream: NotRequired[bool] stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]] temperature: NotRequired[Nullable[float]] @@ -696,11 +413,9 @@ class ChatGenerationParamsTypedDict(TypedDict): class ChatGenerationParams(BaseModel): messages: List[Message] - provider: OptionalNullable[ChatGenerationParamsProvider] = UNSET - r"""When multiple model providers are available, optionally indicate your routing preference.""" + provider: OptionalNullable[Schema0] = UNSET - plugins: Optional[List[ChatGenerationParamsPluginUnion]] = None - r"""Plugins you want to enable for this request, including their settings.""" + plugins: Optional[List[Schema17]] = None route: Annotated[ OptionalNullable[Route], PlainValidator(validate_open_enum(False)) @@ -709,7 +424,6 @@ class ChatGenerationParams(BaseModel): user: Optional[str] = None session_id: Optional[str] = None - r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" model: Optional[str] = None @@ -733,11 +447,11 @@ class ChatGenerationParams(BaseModel): reasoning: Optional[Reasoning] = None - response_format: Optional[ChatGenerationParamsResponseFormatUnion] = None + response_format: Optional[ResponseFormat] = None seed: OptionalNullable[int] = UNSET - stop: OptionalNullable[ChatGenerationParamsStop] = UNSET + stop: OptionalNullable[Stop] = UNSET stream: Optional[bool] = False diff --git a/src/openrouter/components/chatstreamingmessagechunk.py b/src/openrouter/components/chatstreamingmessagechunk.py index 05aeb51..3dad989 100644 --- a/src/openrouter/components/chatstreamingmessagechunk.py +++ b/src/openrouter/components/chatstreamingmessagechunk.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema2 import Schema2, Schema2TypedDict +from ._schema19 import Schema19, Schema19TypedDict from .chatstreamingmessagetoolcall import ( ChatStreamingMessageToolCall, ChatStreamingMessageToolCallTypedDict, @@ -27,7 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict): reasoning: NotRequired[Nullable[str]] refusal: NotRequired[Nullable[str]] tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]] - reasoning_details: NotRequired[List[Schema2TypedDict]] + reasoning_details: NotRequired[List[Schema19TypedDict]] class ChatStreamingMessageChunk(BaseModel): @@ -41,7 +41,7 @@ class ChatStreamingMessageChunk(BaseModel): tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None - reasoning_details: Optional[List[Schema2]] = None + reasoning_details: Optional[List[Schema19]] = None @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/completionchoice.py b/src/openrouter/components/completionchoice.py deleted file mode 100644 index 21ce2b9..0000000 --- a/src/openrouter/components/completionchoice.py +++ /dev/null @@ -1,82 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) -from openrouter.utils import validate_open_enum -from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing import Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict - - -CompletionFinishReason = Union[ - Literal[ - "stop", - "length", - "content_filter", - ], - UnrecognizedStr, -] - - -class CompletionChoiceTypedDict(TypedDict): - text: str - index: float - logprobs: Nullable[CompletionLogprobsTypedDict] - finish_reason: Nullable[CompletionFinishReason] - native_finish_reason: NotRequired[str] - reasoning: NotRequired[Nullable[str]] - - -class CompletionChoice(BaseModel): - text: str - - index: float - - logprobs: Nullable[CompletionLogprobs] - - finish_reason: Annotated[ - Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False)) - ] - - native_finish_reason: Optional[str] = None - - reasoning: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["native_finish_reason", "reasoning"] - nullable_fields = ["logprobs", "finish_reason", "reasoning"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/completioncreateparams.py b/src/openrouter/components/completioncreateparams.py deleted file mode 100644 index 712feaa..0000000 --- a/src/openrouter/components/completioncreateparams.py +++ /dev/null @@ -1,277 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .responseformatjsonschema import ( - ResponseFormatJSONSchema, - ResponseFormatJSONSchemaTypedDict, -) -from .responseformattextgrammar import ( - ResponseFormatTextGrammar, - ResponseFormatTextGrammarTypedDict, -) -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from openrouter.utils import get_discriminator, validate_const -import pydantic -from pydantic import Discriminator, Tag, model_serializer -from pydantic.functional_validators import AfterValidator -from typing import Dict, List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -PromptTypedDict = TypeAliasType( - "PromptTypedDict", Union[str, List[str], List[float], List[List[float]]] -) - - -Prompt = TypeAliasType("Prompt", Union[str, List[str], List[float], List[List[float]]]) - - -CompletionCreateParamsStopTypedDict = TypeAliasType( - "CompletionCreateParamsStopTypedDict", Union[str, List[str]] -) - - -CompletionCreateParamsStop = TypeAliasType( - "CompletionCreateParamsStop", Union[str, List[str]] -) - - -class StreamOptionsTypedDict(TypedDict): - include_usage: NotRequired[Nullable[bool]] - - -class StreamOptions(BaseModel): - include_usage: OptionalNullable[bool] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["include_usage"] - nullable_fields = ["include_usage"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m - - -class CompletionCreateParamsResponseFormatPythonTypedDict(TypedDict): - type: Literal["python"] - - -class CompletionCreateParamsResponseFormatPython(BaseModel): - TYPE: Annotated[ - Annotated[Literal["python"], AfterValidator(validate_const("python"))], - pydantic.Field(alias="type"), - ] = "python" - - -class CompletionCreateParamsResponseFormatJSONObjectTypedDict(TypedDict): - type: Literal["json_object"] - - -class CompletionCreateParamsResponseFormatJSONObject(BaseModel): - TYPE: Annotated[ - Annotated[ - Literal["json_object"], AfterValidator(validate_const("json_object")) - ], - pydantic.Field(alias="type"), - ] = "json_object" - - -class CompletionCreateParamsResponseFormatTextTypedDict(TypedDict): - type: Literal["text"] - - -class CompletionCreateParamsResponseFormatText(BaseModel): - TYPE: Annotated[ - Annotated[Literal["text"], AfterValidator(validate_const("text"))], - pydantic.Field(alias="type"), - ] = "text" - - -CompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType( - "CompletionCreateParamsResponseFormatUnionTypedDict", - Union[ - CompletionCreateParamsResponseFormatTextTypedDict, - CompletionCreateParamsResponseFormatJSONObjectTypedDict, - CompletionCreateParamsResponseFormatPythonTypedDict, - ResponseFormatJSONSchemaTypedDict, - ResponseFormatTextGrammarTypedDict, - ], -) - - -CompletionCreateParamsResponseFormatUnion = Annotated[ - Union[ - Annotated[CompletionCreateParamsResponseFormatText, Tag("text")], - Annotated[CompletionCreateParamsResponseFormatJSONObject, Tag("json_object")], - Annotated[ResponseFormatJSONSchema, Tag("json_schema")], - Annotated[ResponseFormatTextGrammar, Tag("grammar")], - Annotated[CompletionCreateParamsResponseFormatPython, Tag("python")], - ], - Discriminator(lambda m: get_discriminator(m, "type", "type")), -] - - -class CompletionCreateParamsTypedDict(TypedDict): - prompt: PromptTypedDict - model: NotRequired[str] - models: NotRequired[List[str]] - best_of: NotRequired[Nullable[int]] - echo: NotRequired[Nullable[bool]] - frequency_penalty: NotRequired[Nullable[float]] - logit_bias: NotRequired[Nullable[Dict[str, float]]] - logprobs: NotRequired[Nullable[int]] - max_tokens: NotRequired[Nullable[int]] - n: NotRequired[Nullable[int]] - presence_penalty: NotRequired[Nullable[float]] - seed: NotRequired[Nullable[int]] - stop: NotRequired[Nullable[CompletionCreateParamsStopTypedDict]] - stream: NotRequired[bool] - stream_options: NotRequired[Nullable[StreamOptionsTypedDict]] - suffix: NotRequired[Nullable[str]] - temperature: NotRequired[Nullable[float]] - top_p: NotRequired[Nullable[float]] - user: NotRequired[str] - metadata: NotRequired[Nullable[Dict[str, str]]] - response_format: NotRequired[ - Nullable[CompletionCreateParamsResponseFormatUnionTypedDict] - ] - - -class CompletionCreateParams(BaseModel): - prompt: Prompt - - model: Optional[str] = None - - models: Optional[List[str]] = None - - best_of: OptionalNullable[int] = UNSET - - echo: OptionalNullable[bool] = UNSET - - frequency_penalty: OptionalNullable[float] = UNSET - - logit_bias: OptionalNullable[Dict[str, float]] = UNSET - - logprobs: OptionalNullable[int] = UNSET - - max_tokens: OptionalNullable[int] = UNSET - - n: OptionalNullable[int] = UNSET - - presence_penalty: OptionalNullable[float] = UNSET - - seed: OptionalNullable[int] = UNSET - - stop: OptionalNullable[CompletionCreateParamsStop] = UNSET - - stream: Optional[bool] = False - - stream_options: OptionalNullable[StreamOptions] = UNSET - - suffix: OptionalNullable[str] = UNSET - - temperature: OptionalNullable[float] = UNSET - - top_p: OptionalNullable[float] = UNSET - - user: Optional[str] = None - - metadata: OptionalNullable[Dict[str, str]] = UNSET - - response_format: OptionalNullable[CompletionCreateParamsResponseFormatUnion] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [ - "model", - "models", - "best_of", - "echo", - "frequency_penalty", - "logit_bias", - "logprobs", - "max_tokens", - "n", - "presence_penalty", - "seed", - "stop", - "stream", - "stream_options", - "suffix", - "temperature", - "top_p", - "user", - "metadata", - "response_format", - ] - nullable_fields = [ - "best_of", - "echo", - "frequency_penalty", - "logit_bias", - "logprobs", - "max_tokens", - "n", - "presence_penalty", - "seed", - "stop", - "stream_options", - "suffix", - "temperature", - "top_p", - "metadata", - "response_format", - ] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/completionlogprobs.py b/src/openrouter/components/completionlogprobs.py deleted file mode 100644 index 758ccd1..0000000 --- a/src/openrouter/components/completionlogprobs.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, List -from typing_extensions import TypedDict - - -class CompletionLogprobsTypedDict(TypedDict): - tokens: List[str] - token_logprobs: List[float] - top_logprobs: Nullable[List[Dict[str, float]]] - text_offset: List[float] - - -class CompletionLogprobs(BaseModel): - tokens: List[str] - - token_logprobs: List[float] - - top_logprobs: Nullable[List[Dict[str, float]]] - - text_offset: List[float] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [] - nullable_fields = ["top_logprobs"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/completionresponse.py b/src/openrouter/components/completionresponse.py deleted file mode 100644 index dcdd529..0000000 --- a/src/openrouter/components/completionresponse.py +++ /dev/null @@ -1,46 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .completionchoice import CompletionChoice, CompletionChoiceTypedDict -from .completionusage import CompletionUsage, CompletionUsageTypedDict -from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CompletionResponseTypedDict(TypedDict): - id: str - created: float - model: str - choices: List[CompletionChoiceTypedDict] - object: Literal["text_completion"] - provider: NotRequired[str] - system_fingerprint: NotRequired[str] - usage: NotRequired[CompletionUsageTypedDict] - - -class CompletionResponse(BaseModel): - id: str - - created: float - - model: str - - choices: List[CompletionChoice] - - OBJECT: Annotated[ - Annotated[ - Literal["text_completion"], - AfterValidator(validate_const("text_completion")), - ], - pydantic.Field(alias="object"), - ] = "text_completion" - - provider: Optional[str] = None - - system_fingerprint: Optional[str] = None - - usage: Optional[CompletionUsage] = None diff --git a/src/openrouter/components/completionusage.py b/src/openrouter/components/completionusage.py deleted file mode 100644 index 80bba78..0000000 --- a/src/openrouter/components/completionusage.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import BaseModel -from typing_extensions import TypedDict - - -class CompletionUsageTypedDict(TypedDict): - prompt_tokens: float - completion_tokens: float - total_tokens: float - - -class CompletionUsage(BaseModel): - prompt_tokens: float - - completion_tokens: float - - total_tokens: float diff --git a/src/openrouter/components/developermessage.py b/src/openrouter/components/developermessage.py new file mode 100644 index 0000000..b3042b0 --- /dev/null +++ b/src/openrouter/components/developermessage.py @@ -0,0 +1,41 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .chatmessagecontentitemtext import ( + ChatMessageContentItemText, + ChatMessageContentItemTextTypedDict, +) +from openrouter.types import BaseModel +from openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +DeveloperMessageContentTypedDict = TypeAliasType( + "DeveloperMessageContentTypedDict", + Union[str, List[ChatMessageContentItemTextTypedDict]], +) + + +DeveloperMessageContent = TypeAliasType( + "DeveloperMessageContent", Union[str, List[ChatMessageContentItemText]] +) + + +class DeveloperMessageTypedDict(TypedDict): + content: DeveloperMessageContentTypedDict + role: Literal["developer"] + name: NotRequired[str] + + +class DeveloperMessage(BaseModel): + content: DeveloperMessageContent + + ROLE: Annotated[ + Annotated[Literal["developer"], AfterValidator(validate_const("developer"))], + pydantic.Field(alias="role"), + ] = "developer" + + name: Optional[str] = None diff --git a/src/openrouter/components/message.py b/src/openrouter/components/message.py index 8d92cba..569d0e0 100644 --- a/src/openrouter/components/message.py +++ b/src/openrouter/components/message.py @@ -2,47 +2,14 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict -from .chatmessagecontentitemtext import ( - ChatMessageContentItemText, - ChatMessageContentItemTextTypedDict, -) +from .developermessage import DeveloperMessage, DeveloperMessageTypedDict from .systemmessage import SystemMessage, SystemMessageTypedDict from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict from .usermessage import UserMessage, UserMessageTypedDict -from openrouter.types import BaseModel -from openrouter.utils import get_discriminator, validate_const -import pydantic +from openrouter.utils import get_discriminator from pydantic import Discriminator, Tag -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -MessageContentTypedDict = TypeAliasType( - "MessageContentTypedDict", Union[str, List[ChatMessageContentItemTextTypedDict]] -) - - -MessageContent = TypeAliasType( - "MessageContent", Union[str, List[ChatMessageContentItemText]] -) - - -class MessageDeveloperTypedDict(TypedDict): - content: MessageContentTypedDict - role: Literal["developer"] - name: NotRequired[str] - - -class MessageDeveloper(BaseModel): - content: MessageContent - - ROLE: Annotated[ - Annotated[Literal["developer"], AfterValidator(validate_const("developer"))], - pydantic.Field(alias="role"), - ] = "developer" - - name: Optional[str] = None +from typing import Union +from typing_extensions import Annotated, TypeAliasType MessageTypedDict = TypeAliasType( @@ -50,7 +17,7 @@ MessageTypedDict = TypeAliasType( Union[ SystemMessageTypedDict, UserMessageTypedDict, - MessageDeveloperTypedDict, + DeveloperMessageTypedDict, ToolResponseMessageTypedDict, AssistantMessageTypedDict, ], @@ -61,7 +28,7 @@ Message = Annotated[ Union[ Annotated[SystemMessage, Tag("system")], Annotated[UserMessage, Tag("user")], - Annotated[MessageDeveloper, Tag("developer")], + Annotated[DeveloperMessage, Tag("developer")], Annotated[AssistantMessage, Tag("assistant")], Annotated[ToolResponseMessage, Tag("tool")], ], diff --git a/src/openrouter/components/openresponsesrequest.py b/src/openrouter/components/openresponsesrequest.py index 9c55233..8d0071c 100644 --- a/src/openrouter/components/openresponsesrequest.py +++ b/src/openrouter/components/openresponsesrequest.py @@ -222,37 +222,29 @@ class OpenResponsesRequestMaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: NotRequired[str] - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" class OpenResponsesRequestMaxPrice(BaseModel): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: Optional[str] = None - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" -class OpenResponsesRequestProviderTypedDict(TypedDict): +class ProviderTypedDict(TypedDict): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: NotRequired[Nullable[bool]] @@ -291,7 +283,7 @@ class OpenResponsesRequestProviderTypedDict(TypedDict): r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" -class OpenResponsesRequestProvider(BaseModel): +class Provider(BaseModel): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: OptionalNullable[bool] = UNSET @@ -406,13 +398,13 @@ class OpenResponsesRequestProvider(BaseModel): IDResponseHealing = Literal["response-healing",] -class OpenResponsesRequestPluginResponseHealingTypedDict(TypedDict): +class PluginResponseHealingTypedDict(TypedDict): id: IDResponseHealing enabled: NotRequired[bool] r"""Set to false to disable the response-healing plugin for this request. Defaults to true.""" -class OpenResponsesRequestPluginResponseHealing(BaseModel): +class PluginResponseHealing(BaseModel): id: IDResponseHealing enabled: Optional[bool] = None @@ -422,7 +414,7 @@ class OpenResponsesRequestPluginResponseHealing(BaseModel): IDFileParser = Literal["file-parser",] -class OpenResponsesRequestPluginFileParserTypedDict(TypedDict): +class PluginFileParserTypedDict(TypedDict): id: IDFileParser enabled: NotRequired[bool] r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" @@ -430,7 +422,7 @@ class OpenResponsesRequestPluginFileParserTypedDict(TypedDict): r"""Options for PDF parsing.""" -class OpenResponsesRequestPluginFileParser(BaseModel): +class PluginFileParser(BaseModel): id: IDFileParser enabled: Optional[bool] = None @@ -443,7 +435,7 @@ class OpenResponsesRequestPluginFileParser(BaseModel): IDWeb = Literal["web",] -class OpenResponsesRequestPluginWebTypedDict(TypedDict): +class PluginWebTypedDict(TypedDict): id: IDWeb enabled: NotRequired[bool] r"""Set to false to disable the web-search plugin for this request. Defaults to true.""" @@ -453,7 +445,7 @@ class OpenResponsesRequestPluginWebTypedDict(TypedDict): r"""The search engine to use for web search.""" -class OpenResponsesRequestPluginWeb(BaseModel): +class PluginWeb(BaseModel): id: IDWeb enabled: Optional[bool] = None @@ -472,18 +464,18 @@ class OpenResponsesRequestPluginWeb(BaseModel): IDModeration = Literal["moderation",] -class OpenResponsesRequestPluginModerationTypedDict(TypedDict): +class PluginModerationTypedDict(TypedDict): id: IDModeration -class OpenResponsesRequestPluginModeration(BaseModel): +class PluginModeration(BaseModel): id: IDModeration IDAutoRouter = Literal["auto-router",] -class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict): +class PluginAutoRouterTypedDict(TypedDict): id: IDAutoRouter enabled: NotRequired[bool] r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" @@ -491,7 +483,7 @@ class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict): r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" -class OpenResponsesRequestPluginAutoRouter(BaseModel): +class PluginAutoRouter(BaseModel): id: IDAutoRouter enabled: Optional[bool] = None @@ -501,25 +493,25 @@ class OpenResponsesRequestPluginAutoRouter(BaseModel): r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" -OpenResponsesRequestPluginUnionTypedDict = TypeAliasType( - "OpenResponsesRequestPluginUnionTypedDict", +PluginTypedDict = TypeAliasType( + "PluginTypedDict", Union[ - OpenResponsesRequestPluginModerationTypedDict, - OpenResponsesRequestPluginResponseHealingTypedDict, - OpenResponsesRequestPluginAutoRouterTypedDict, - OpenResponsesRequestPluginFileParserTypedDict, - OpenResponsesRequestPluginWebTypedDict, + PluginModerationTypedDict, + PluginResponseHealingTypedDict, + PluginAutoRouterTypedDict, + PluginFileParserTypedDict, + PluginWebTypedDict, ], ) -OpenResponsesRequestPluginUnion = Annotated[ +Plugin = Annotated[ Union[ - Annotated[OpenResponsesRequestPluginAutoRouter, Tag("auto-router")], - Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")], - Annotated[OpenResponsesRequestPluginWeb, Tag("web")], - Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")], - Annotated[OpenResponsesRequestPluginResponseHealing, Tag("response-healing")], + Annotated[PluginAutoRouter, Tag("auto-router")], + Annotated[PluginModeration, Tag("moderation")], + Annotated[PluginWeb, Tag("web")], + Annotated[PluginFileParser, Tag("file-parser")], + Annotated[PluginResponseHealing, Tag("response-healing")], ], Discriminator(lambda m: get_discriminator(m, "id", "id")), ] @@ -564,9 +556,9 @@ class OpenResponsesRequestTypedDict(TypedDict): service_tier: NotRequired[ServiceTier] truncation: NotRequired[Nullable[Truncation]] stream: NotRequired[bool] - provider: NotRequired[Nullable[OpenResponsesRequestProviderTypedDict]] + provider: NotRequired[Nullable[ProviderTypedDict]] r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]] + plugins: NotRequired[List[PluginTypedDict]] r"""Plugins you want to enable for this request, including their settings.""" user: NotRequired[str] r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.""" @@ -660,10 +652,10 @@ class OpenResponsesRequest(BaseModel): stream: Optional[bool] = False - provider: OptionalNullable[OpenResponsesRequestProvider] = UNSET + provider: OptionalNullable[Provider] = UNSET r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None + plugins: Optional[List[Plugin]] = None r"""Plugins you want to enable for this request, including their settings.""" user: Optional[str] = None diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index e9c1402..29c27a6 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -10,6 +10,7 @@ ProviderName = Union[ "AI21", "AionLabs", "Alibaba", + "Ambient", "Amazon Bedrock", "Amazon Nova", "Anthropic", @@ -66,6 +67,7 @@ ProviderName = Union[ "Seed", "SiliconFlow", "Sourceful", + "StepFun", "Stealth", "StreamLake", "Switchpoint", diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py index b0d41b0..d3ad2c7 100644 --- a/src/openrouter/components/providerpreferences.py +++ b/src/openrouter/components/providerpreferences.py @@ -176,34 +176,26 @@ class ProviderPreferencesMaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: NotRequired[str] - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" class ProviderPreferencesMaxPrice(BaseModel): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" prompt: Optional[str] = None - r"""A value in string format that is a large number""" + r"""Price per million prompt tokens""" completion: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" class ProviderPreferencesTypedDict(TypedDict): diff --git a/src/openrouter/components/publicendpoint.py b/src/openrouter/components/publicendpoint.py index dcb5e7c..522f96b 100644 --- a/src/openrouter/components/publicendpoint.py +++ b/src/openrouter/components/publicendpoint.py @@ -15,73 +15,47 @@ from typing_extensions import Annotated, NotRequired, TypedDict class PricingTypedDict(TypedDict): prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" image_token: NotRequired[str] - r"""A value in string format that is a large number""" image_output: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" audio_output: NotRequired[str] - r"""A value in string format that is a large number""" input_audio_cache: NotRequired[str] - r"""A value in string format that is a large number""" web_search: NotRequired[str] - r"""A value in string format that is a large number""" internal_reasoning: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_read: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_write: NotRequired[str] - r"""A value in string format that is a large number""" discount: NotRequired[float] class Pricing(BaseModel): prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" image_token: Optional[str] = None - r"""A value in string format that is a large number""" image_output: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" audio_output: Optional[str] = None - r"""A value in string format that is a large number""" input_audio_cache: Optional[str] = None - r"""A value in string format that is a large number""" web_search: Optional[str] = None - r"""A value in string format that is a large number""" internal_reasoning: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_read: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_write: Optional[str] = None - r"""A value in string format that is a large number""" discount: Optional[float] = None diff --git a/src/openrouter/components/publicpricing.py b/src/openrouter/components/publicpricing.py index 5bd726d..0aef8d6 100644 --- a/src/openrouter/components/publicpricing.py +++ b/src/openrouter/components/publicpricing.py @@ -10,31 +10,18 @@ class PublicPricingTypedDict(TypedDict): r"""Pricing information for the model""" prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: NotRequired[str] - r"""A value in string format that is a large number""" image: NotRequired[str] - r"""A value in string format that is a large number""" image_token: NotRequired[str] - r"""A value in string format that is a large number""" image_output: NotRequired[str] - r"""A value in string format that is a large number""" audio: NotRequired[str] - r"""A value in string format that is a large number""" audio_output: NotRequired[str] - r"""A value in string format that is a large number""" input_audio_cache: NotRequired[str] - r"""A value in string format that is a large number""" web_search: NotRequired[str] - r"""A value in string format that is a large number""" internal_reasoning: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_read: NotRequired[str] - r"""A value in string format that is a large number""" input_cache_write: NotRequired[str] - r"""A value in string format that is a large number""" discount: NotRequired[float] @@ -42,42 +29,29 @@ class PublicPricing(BaseModel): r"""Pricing information for the model""" prompt: str - r"""A value in string format that is a large number""" completion: str - r"""A value in string format that is a large number""" request: Optional[str] = None - r"""A value in string format that is a large number""" image: Optional[str] = None - r"""A value in string format that is a large number""" image_token: Optional[str] = None - r"""A value in string format that is a large number""" image_output: Optional[str] = None - r"""A value in string format that is a large number""" audio: Optional[str] = None - r"""A value in string format that is a large number""" audio_output: Optional[str] = None - r"""A value in string format that is a large number""" input_audio_cache: Optional[str] = None - r"""A value in string format that is a large number""" web_search: Optional[str] = None - r"""A value in string format that is a large number""" internal_reasoning: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_read: Optional[str] = None - r"""A value in string format that is a large number""" input_cache_write: Optional[str] = None - r"""A value in string format that is a large number""" discount: Optional[float] = None diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index a3d8d13..f45fa28 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -394,7 +394,9 @@ class Models(BaseSDK): timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> components.ModelsListResponse: - r"""List models filtered by user provider preferences + r"""List models filtered by user provider preferences, privacy settings, and guardrails + + List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). :param security: :param retries: Override the default retry configuration for this method @@ -447,7 +449,7 @@ class Models(BaseSDK): security_source=get_security_from_env(security, components.Security), ), request=req, - error_status_codes=["401", "4XX", "500", "5XX"], + error_status_codes=["401", "404", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -459,6 +461,11 @@ class Models(BaseSDK): errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) if utils.match_response(http_res, "500", "application/json"): response_data = unmarshal_json_response( errors.InternalServerResponseErrorData, http_res @@ -489,7 +496,9 @@ class Models(BaseSDK): timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> components.ModelsListResponse: - r"""List models filtered by user provider preferences + r"""List models filtered by user provider preferences, privacy settings, and guardrails + + List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). :param security: :param retries: Override the default retry configuration for this method @@ -542,7 +551,7 @@ class Models(BaseSDK): security_source=get_security_from_env(security, components.Security), ), request=req, - error_status_codes=["401", "4XX", "500", "5XX"], + error_status_codes=["401", "404", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -554,6 +563,11 @@ class Models(BaseSDK): errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) if utils.match_response(http_res, "500", "application/json"): response_data = unmarshal_json_response( errors.InternalServerResponseErrorData, http_res diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 6620d39..eb21fe9 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -160,6 +160,9 @@ if TYPE_CHECKING: GetGenerationRequestTypedDict, GetGenerationResponse, GetGenerationResponseTypedDict, + ProviderName, + ProviderResponse, + ProviderResponseTypedDict, ) from .getguardrail import ( GetGuardrailData, @@ -462,6 +465,9 @@ __all__ = [ "MetadataTypedDict", "Object", "ObjectEmbedding", + "ProviderName", + "ProviderResponse", + "ProviderResponseTypedDict", "RateLimit", "RateLimitTypedDict", "SendChatCompletionRequestResponse", @@ -619,6 +625,9 @@ _dynamic_imports: dict[str, str] = { "GetGenerationRequestTypedDict": ".getgeneration", "GetGenerationResponse": ".getgeneration", "GetGenerationResponseTypedDict": ".getgeneration", + "ProviderName": ".getgeneration", + "ProviderResponse": ".getgeneration", + "ProviderResponseTypedDict": ".getgeneration", "GetGuardrailData": ".getguardrail", "GetGuardrailDataTypedDict": ".getguardrail", "GetGuardrailRequest": ".getguardrail", diff --git a/src/openrouter/operations/getgeneration.py b/src/openrouter/operations/getgeneration.py index 7a4e89a..ac0a199 100644 --- a/src/openrouter/operations/getgeneration.py +++ b/src/openrouter/operations/getgeneration.py @@ -5,8 +5,8 @@ from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedSt from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum from pydantic import model_serializer from pydantic.functional_validators import PlainValidator -from typing import Literal, Union -from typing_extensions import Annotated, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict class GetGenerationRequestTypedDict(TypedDict): @@ -29,6 +29,178 @@ APIType = Union[ r"""Type of API used for the generation""" +ProviderName = Union[ + Literal[ + "AnyScale", + "Atoma", + "Cent-ML", + "CrofAI", + "Enfer", + "GoPomelo", + "HuggingFace", + "Hyperbolic 2", + "InoCloud", + "Kluster", + "Lambda", + "Lepton", + "Lynn 2", + "Lynn", + "Mancer", + "Meta", + "Modal", + "Nineteen", + "OctoAI", + "Recursal", + "Reflection", + "Replicate", + "SambaNova 2", + "SF Compute", + "Targon", + "Together 2", + "Ubicloud", + "01.AI", + "AI21", + "AionLabs", + "Alibaba", + "Ambient", + "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", + "Google", + "Google AI Studio", + "Groq", + "Hyperbolic", + "Inception", + "Inceptron", + "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", + "Seed", + "SiliconFlow", + "Sourceful", + "StepFun", + "Stealth", + "StreamLake", + "Switchpoint", + "Together", + "Upstage", + "Venice", + "WandB", + "Xiaomi", + "xAI", + "Z.AI", + "FakeProvider", + ], + UnrecognizedStr, +] + + +class ProviderResponseTypedDict(TypedDict): + status: Nullable[float] + id: NotRequired[str] + endpoint_id: NotRequired[str] + model_permaslug: NotRequired[str] + provider_name: NotRequired[ProviderName] + latency: NotRequired[float] + is_byok: NotRequired[bool] + + +class ProviderResponse(BaseModel): + status: Nullable[float] + + id: Optional[str] = None + + endpoint_id: Optional[str] = None + + model_permaslug: Optional[str] = None + + provider_name: Annotated[ + Optional[ProviderName], PlainValidator(validate_open_enum(False)) + ] = None + + latency: Optional[float] = None + + is_byok: Optional[bool] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "endpoint_id", + "model_permaslug", + "provider_name", + "latency", + "is_byok", + ] + nullable_fields = ["status"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + class GetGenerationDataTypedDict(TypedDict): r"""Generation data""" @@ -98,6 +270,8 @@ class GetGenerationDataTypedDict(TypedDict): r"""Type of API used for the generation""" router: Nullable[str] r"""Router used for the request (e.g., openrouter/auto)""" + provider_responses: Nullable[List[ProviderResponseTypedDict]] + r"""List of provider responses for this generation, including fallback attempts""" class GetGenerationData(BaseModel): @@ -202,6 +376,9 @@ class GetGenerationData(BaseModel): router: Nullable[str] r"""Router used for the request (e.g., openrouter/auto)""" + provider_responses: Nullable[List[ProviderResponse]] + r"""List of provider responses for this generation, including fallback attempts""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [] @@ -232,6 +409,7 @@ class GetGenerationData(BaseModel): "external_user", "api_type", "router", + "provider_responses", ] null_default_fields = [] diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index 480cab0..fe04685 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -84,16 +84,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -212,16 +206,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -339,16 +327,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -453,10 +435,10 @@ class Responses(BaseSDK): truncation=truncation, stream=stream, provider=utils.get_pydantic_model( - provider, OptionalNullable[components.OpenResponsesRequestProvider] + provider, OptionalNullable[components.Provider] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] + plugins, Optional[List[components.Plugin]] ), user=user, session_id=session_id, @@ -717,16 +699,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -845,16 +821,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -972,16 +942,10 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ - Union[ - components.OpenResponsesRequestProvider, - components.OpenResponsesRequestProviderTypedDict, - ] + Union[components.Provider, components.ProviderTypedDict] ] = UNSET, plugins: Optional[ - Union[ - List[components.OpenResponsesRequestPluginUnion], - List[components.OpenResponsesRequestPluginUnionTypedDict], - ] + Union[List[components.Plugin], List[components.PluginTypedDict]] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, @@ -1086,10 +1050,10 @@ class Responses(BaseSDK): truncation=truncation, stream=stream, provider=utils.get_pydantic_model( - provider, OptionalNullable[components.OpenResponsesRequestProvider] + provider, OptionalNullable[components.Provider] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] + plugins, Optional[List[components.Plugin]] ), user=user, session_id=session_id, diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index 03b39eb..062548f 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -20,7 +20,6 @@ if TYPE_CHECKING: from openrouter.api_keys import APIKeys from openrouter.beta import Beta from openrouter.chat import Chat - from openrouter.completions import Completions from openrouter.credits import Credits from openrouter.embeddings import Embeddings from openrouter.endpoints import Endpoints @@ -32,7 +31,7 @@ if TYPE_CHECKING: class OpenRouter(BaseSDK): - r"""OpenRouter API: OpenAI-compatible Chat Completions and Completions API with additional OpenRouter features + r"""OpenRouter API: OpenAI-compatible API with additional OpenRouter features https://openrouter.ai/docs - OpenRouter Documentation """ @@ -58,7 +57,6 @@ class OpenRouter(BaseSDK): o_auth: "OAuth" r"""OAuth authentication endpoints""" chat: "Chat" - completions: "Completions" _sub_sdk_map = { "beta": ("openrouter.beta", "Beta"), "analytics": ("openrouter.analytics", "Analytics"), @@ -72,7 +70,6 @@ class OpenRouter(BaseSDK): "guardrails": ("openrouter.guardrails", "Guardrails"), "o_auth": ("openrouter.oauth", "OAuth"), "chat": ("openrouter.chat", "Chat"), - "completions": ("openrouter.completions", "Completions"), } def __init__( diff --git a/uv.lock b/uv.lock index 25699b8..6b1deff 100644 --- a/uv.lock +++ b/uv.lock @@ -211,7 +211,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.1.3" +version = "0.2.0" source = { editable = "." } dependencies = [ { name = "httpcore" },