diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index adce217..7ec3e1d 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: b1b97e85c6e3464e1fd6e2163c4ebc87 + docChecksum: 4cc4a9d9115d0eca9a5eb4786505579d docVersion: 1.0.0 speakeasyVersion: 1.658.2 generationVersion: 2.755.9 - releaseVersion: 0.0.18 - configChecksum: 4386d334ab676d900bdb35b056f15169 + releaseVersion: 0.0.19 + configChecksum: 834d5c1cea368e35ab6535ffb2bf9e7a repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true @@ -71,6 +71,8 @@ generatedFiles: - docs/components/chatmessagecontentitemimagedetail.md - docs/components/chatmessagecontentitemtext.md - docs/components/chatmessagecontentitemvideo.md + - docs/components/chatmessagecontentitemvideoinputvideo.md + - docs/components/chatmessagecontentitemvideovideourl.md - docs/components/chatmessagetokenlogprob.md - docs/components/chatmessagetokenlogprobs.md - docs/components/chatmessagetoolcall.md @@ -305,6 +307,7 @@ generatedFiles: - docs/components/provider.md - docs/components/providername.md - docs/components/provideroverloadedresponseerrordata.md + - docs/components/providersort.md - docs/components/publicendpoint.md - docs/components/publicendpointquantization.md - docs/components/publicpricing.md @@ -375,7 +378,6 @@ generatedFiles: - docs/components/security.md - docs/components/servicetier.md - docs/components/serviceunavailableresponseerrordata.md - - docs/components/sort.md - docs/components/streamoptions.md - docs/components/systemmessage.md - docs/components/systemmessagecontent.md @@ -414,7 +416,8 @@ generatedFiles: - docs/components/usermessage.md - docs/components/usermessagecontent.md - docs/components/variables.md - - docs/components/videourl.md + - docs/components/videourl1.md + - docs/components/videourl2.md - docs/components/websearchpreviewtooluserlocation.md - docs/components/websearchpreviewtooluserlocationtype.md - docs/components/websearchstatus.md @@ -436,6 +439,9 @@ generatedFiles: - docs/models/utils/retryconfig.md - docs/operations/apitype.md - docs/operations/calldata.md + - docs/operations/content.md + - docs/operations/contentimageurl.md + - docs/operations/contenttext.md - docs/operations/createauthkeyscodecodechallengemethod.md - docs/operations/createauthkeyscodedata.md - docs/operations/createauthkeyscoderequest.md @@ -454,13 +460,10 @@ generatedFiles: - docs/operations/createkeysresponse.md - docs/operations/createresponsesresponse.md - docs/operations/createresponsesresponsebody.md - - docs/operations/datacollection.md - docs/operations/deletekeysrequest.md - docs/operations/deletekeysresponse.md - docs/operations/embedding.md - docs/operations/encodingformat.md - - docs/operations/encodingformatbase64.md - - docs/operations/encodingformatfloat.md - docs/operations/exchangeauthcodeforapikeycodechallengemethod.md - docs/operations/exchangeauthcodeforapikeyrequest.md - docs/operations/exchangeauthcodeforapikeyresponse.md @@ -482,7 +485,9 @@ generatedFiles: - docs/operations/getuseractivityrequest.md - docs/operations/getuseractivityresponse.md - docs/operations/ignore.md + - docs/operations/imageurl.md - docs/operations/input.md + - docs/operations/inputunion.md - docs/operations/listdata.md - docs/operations/listendpointsrequest.md - docs/operations/listendpointsresponse.md @@ -500,9 +505,10 @@ generatedFiles: - docs/operations/order.md - docs/operations/ratelimit.md - docs/operations/sendchatcompletionrequestresponse.md - - docs/operations/sort.md - docs/operations/supportedparameter.md - docs/operations/transferintent.md + - docs/operations/typeimageurl.md + - docs/operations/typetext.md - docs/operations/updatekeysdata.md - docs/operations/updatekeyslimitreset.md - docs/operations/updatekeysrequest.md @@ -543,7 +549,6 @@ generatedFiles: - src/openrouter/components/assistantmessage.py - src/openrouter/components/badgatewayresponseerrordata.py - src/openrouter/components/badrequestresponseerrordata.py - - src/openrouter/components/chatcompletionfinishreason.py - src/openrouter/components/chaterror.py - src/openrouter/components/chatgenerationparams.py - src/openrouter/components/chatgenerationtokenusage.py @@ -557,7 +562,6 @@ generatedFiles: - src/openrouter/components/chatmessagetoolcall.py - src/openrouter/components/chatresponse.py - src/openrouter/components/chatresponsechoice.py - - src/openrouter/components/chatstreamingchoice.py - src/openrouter/components/chatstreamingmessagechunk.py - src/openrouter/components/chatstreamingmessagetoolcall.py - src/openrouter/components/chatstreamingresponsechunk.py @@ -568,6 +572,7 @@ generatedFiles: - 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/edgenetworktimeoutresponseerrordata.py - src/openrouter/components/endpointstatus.py @@ -637,6 +642,7 @@ generatedFiles: - src/openrouter/components/perrequestlimits.py - src/openrouter/components/providername.py - src/openrouter/components/provideroverloadedresponseerrordata.py + - src/openrouter/components/providersort.py - src/openrouter/components/publicendpoint.py - src/openrouter/components/publicpricing.py - src/openrouter/components/quantization.py @@ -833,7 +839,7 @@ examples: createEmbeddings: speakeasy-default-create-embeddings: requestBody: - application/json: {"input": "", "model": "Taurus", "provider": {"data_collection": "deny", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}} + application/json: {"input": "", "model": "Taurus", "provider": {"data_collection": "allow", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}} responses: "200": application/json: {"object": "list", "data": [], "model": "Land Cruiser"} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 07d9784..c68359b 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.0.18 + version: 0.0.19 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 8cc5737..2987de9 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -1067,6 +1067,7 @@ components: - medium - low - minimal + - none x-speakeasy-unknown-values: allow ReasoningSummaryVerbosity: type: string @@ -3239,6 +3240,7 @@ components: - openai-responses-v1 - xai-responses-v1 - anthropic-claude-v1 + - google-gemini-v1 x-speakeasy-unknown-values: allow example: type: reasoning @@ -3440,47 +3442,44 @@ components: - reasoning.encrypted_content - code_interpreter_call.outputs x-speakeasy-unknown-values: allow + DataCollection: + type: string + nullable: true + enum: + - deny + - allow + 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. + example: allow + x-speakeasy-unknown-values: allow ProviderName: type: string enum: - - AnyScale - - Cent-ML - - HuggingFace - - Hyperbolic 2 - - Lepton - - Lynn 2 - - Lynn - - Mancer - - Modal - - OctoAI - - Recursal - - Reflection - - Replicate - - SambaNova 2 - - SF Compute - - Together 2 - - 01.AI - AI21 - AionLabs - Alibaba - Amazon Bedrock - Anthropic + - Arcee - AtlasCloud - - Atoma - Avian - Azure - BaseTen + - Black Forest Labs - Cerebras - Chutes - Cirrascale - Clarifai - Cloudflare - Cohere - - CrofAI - Crusoe - DeepInfra - DeepSeek - - Enfer - Featherless - Fireworks - Friendli @@ -3493,12 +3492,8 @@ components: - InferenceNet - Infermatic - Inflection - - InoCloud - - Kluster - - Lambda - Liquid - Mancer 2 - - Meta - Minimax - ModelRun - Mistral @@ -3508,7 +3503,6 @@ components: - NCompass - Nebius - NextBit - - Nineteen - Novita - Nvidia - OpenAI @@ -3523,7 +3517,6 @@ components: - Switchpoint - Targon - Together - - Ubicloud - Venice - WandB - xAI @@ -3545,6 +3538,17 @@ components: - unknown example: fp16 x-speakeasy-unknown-values: allow + ProviderSort: + type: string + nullable: true + enum: + - price + - throughput + - latency + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + example: price + x-speakeasy-unknown-values: allow BigNumberUnion: anyOf: - type: number @@ -3683,20 +3687,7 @@ components: description: >- Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. data_collection: - type: string - nullable: true - enum: - - deny - - allow - example: deny - 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. - - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/DataCollection' zdr: type: boolean nullable: true @@ -3743,16 +3734,7 @@ components: $ref: '#/components/schemas/Quantization' description: A list of quantization levels to filter the provider by. sort: - type: string - nullable: true - enum: - - price - - throughput - - latency - example: price - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/ProviderSort' max_price: type: object properties: @@ -3984,6 +3966,8 @@ components: $ref: '#/components/schemas/BigNumberUnion' image: $ref: '#/components/schemas/BigNumberUnion' + image_token: + $ref: '#/components/schemas/BigNumberUnion' image_output: $ref: '#/components/schemas/BigNumberUnion' audio: @@ -4428,6 +4412,8 @@ components: $ref: '#/components/schemas/BigNumberUnion' image: $ref: '#/components/schemas/BigNumberUnion' + image_token: + $ref: '#/components/schemas/BigNumberUnion' image_output: $ref: '#/components/schemas/BigNumberUnion' audio: @@ -4611,10 +4597,6 @@ components: status: default uptime_last_30m: 99.5 supports_implicit_caching: true - __schema0: - anyOf: - - $ref: '#/components/schemas/ChatCompletionFinishReason' - - type: 'null' ModelName: type: string ChatMessageContentItemText: @@ -4680,21 +4662,38 @@ components: - type - input_audio ChatMessageContentItemVideo: + oneOf: + - type: object + properties: + type: + type: string + const: input_video + video_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - video_url + - type: object + properties: + type: + type: string + const: video_url + video_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - video_url type: object - properties: - type: - type: string - const: input_video - video_url: - type: object - properties: - url: - type: string - required: - - url - required: - - type - - video_url ChatMessageContentItem: oneOf: - $ref: '#/components/schemas/ChatMessageContentItemText' @@ -4709,6 +4708,7 @@ components: image_url: '#/components/schemas/ChatMessageContentItemImage' input_audio: '#/components/schemas/ChatMessageContentItemAudio' input_video: '#/components/schemas/ChatMessageContentItemVideo' + video_url: '#/components/schemas/ChatMessageContentItemVideo' ChatMessageToolCall: type: object properties: @@ -4832,14 +4832,16 @@ components: - prompt_tokens - total_tokens ChatCompletionFinishReason: - type: string - enum: - - tool_calls - - stop - - length - - content_filter - - error - x-speakeasy-unknown-values: allow + anyOf: + - type: string + enum: + - tool_calls + - stop + - length + - content_filter + - error + x-speakeasy-unknown-values: allow + - type: 'null' JSONSchemaConfig: type: object properties: @@ -5111,6 +5113,7 @@ components: anyOf: - type: string enum: + - none - minimal - low - medium @@ -5197,7 +5200,7 @@ components: type: object properties: finish_reason: - $ref: '#/components/schemas/__schema0' + $ref: '#/components/schemas/ChatCompletionFinishReason' index: type: number message: @@ -5258,7 +5261,7 @@ components: delta: $ref: '#/components/schemas/ChatStreamingMessageChunk' finish_reason: - $ref: '#/components/schemas/__schema0' + $ref: '#/components/schemas/ChatCompletionFinishReason' index: type: number logprobs: @@ -5998,8 +6001,57 @@ paths: type: array items: type: number + - type: array + items: + type: object + properties: + content: + type: array + items: + oneOf: + - type: object + properties: + type: + type: string + enum: + - text + text: + type: string + required: + - type + - text + - type: object + properties: + type: + type: string + enum: + - image_url + image_url: + type: object + properties: + url: + type: string + required: + - url + required: + - type + - image_url + required: + - content model: type: string + encoding_format: + type: string + enum: + - float + - base64 + x-speakeasy-unknown-values: allow + dimensions: + type: integer + minimum: 0 + exclusiveMinimum: true + user: + type: string provider: type: object properties: @@ -6019,20 +6071,7 @@ paths: description: >- Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. data_collection: - type: string - nullable: true - enum: - - deny - - allow - example: deny - 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. - - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/DataCollection' zdr: type: boolean nullable: true @@ -6079,16 +6118,7 @@ paths: $ref: '#/components/schemas/Quantization' description: A list of quantization levels to filter the provider by. sort: - type: string - nullable: true - enum: - - price - - throughput - - latency - example: price - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/ProviderSort' max_price: type: object properties: @@ -6105,15 +6135,7 @@ paths: additionalProperties: false description: >- The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - encoding_format: - anyOf: - - type: string - enum: - - float - - type: string - enum: - - base64 - user: + input_type: type: string required: - input @@ -6709,22 +6731,21 @@ paths: - Alibaba - Amazon Bedrock - Anthropic + - Arcee - AtlasCloud - - Atoma - Avian - Azure - BaseTen + - Black Forest Labs - Cerebras - Chutes - Cirrascale - Clarifai - Cloudflare - Cohere - - CrofAI - Crusoe - DeepInfra - DeepSeek - - Enfer - Featherless - Fireworks - Friendli @@ -6737,11 +6758,8 @@ paths: - InferenceNet - Infermatic - Inflection - - Kluster - - Lambda - Liquid - Mancer 2 - - Meta - Minimax - ModelRun - Mistral @@ -6751,7 +6769,6 @@ paths: - NCompass - Nebius - NextBit - - Nineteen - Novita - Nvidia - OpenAI @@ -6766,7 +6783,6 @@ paths: - Switchpoint - Targon - Together - - Ubicloud - Venice - WandB - xAI diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 270ff94..e8a1112 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,18 +1,17 @@ -speakeasyVersion: 1.658.1 +speakeasyVersion: 1.658.2 sources: -OAS: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e - sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23 + sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05 + sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4 tags: - latest - - speakeasy-sdk-regen-1763230596 targets: open-router: source: -OAS sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08647b466c00989914e3a2436175152270f771f0a57d055f5bab14cc2d4be89e - sourceBlobDigest: sha256:53027ec57392d9617cc001ece83c2fe1aa6e5dbfd52d170381c34c33c6042c23 + sourceRevisionDigest: sha256:fc0c90dc8ebb69ef4a571e4e63dcd7f8f33c3254c17ad2583b628fbbf3d1ac05 + sourceBlobDigest: sha256:635d63fd18db468c1dcc23700382af788de76594ba3b8292fae9b14c0e5c22c4 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/USAGE.md b/USAGE.md index ad55718..4fd5a77 100644 --- a/USAGE.md +++ b/USAGE.md @@ -49,7 +49,7 @@ with OpenRouter( }, }, }, service_tier="auto", truncation="auto", stream=False, provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ @@ -127,7 +127,7 @@ async def main(): }, }, }, service_tier="auto", truncation="auto", stream=False, provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ diff --git a/docs/components/chatmessagecontentitem.md b/docs/components/chatmessagecontentitem.md index 52ee47c..7063cdb 100644 --- a/docs/components/chatmessagecontentitem.md +++ b/docs/components/chatmessagecontentitem.md @@ -27,3 +27,9 @@ value: components.ChatMessageContentItemAudio = /* values here */ value: components.ChatMessageContentItemVideo = /* values here */ ``` +### `components.ChatMessageContentItemVideo` + +```python +value: components.ChatMessageContentItemVideo = /* values here */ +``` + diff --git a/docs/components/chatmessagecontentitemvideo.md b/docs/components/chatmessagecontentitemvideo.md index e7c6354..c92a0bb 100644 --- a/docs/components/chatmessagecontentitemvideo.md +++ b/docs/components/chatmessagecontentitemvideo.md @@ -1,9 +1,17 @@ # ChatMessageContentItemVideo -## Fields +## Supported Types + +### `components.ChatMessageContentItemVideoInputVideo` + +```python +value: components.ChatMessageContentItemVideoInputVideo = /* values here */ +``` + +### `components.ChatMessageContentItemVideoVideoURL` + +```python +value: components.ChatMessageContentItemVideoVideoURL = /* values here */ +``` -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A | -| `video_url` | [components.VideoURL](../components/videourl.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideoinputvideo.md b/docs/components/chatmessagecontentitemvideoinputvideo.md new file mode 100644 index 0000000..4d7dd0e --- /dev/null +++ b/docs/components/chatmessagecontentitemvideoinputvideo.md @@ -0,0 +1,9 @@ +# ChatMessageContentItemVideoInputVideo + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A | +| `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideovideourl.md b/docs/components/chatmessagecontentitemvideovideourl.md new file mode 100644 index 0000000..0585b55 --- /dev/null +++ b/docs/components/chatmessagecontentitemvideovideourl.md @@ -0,0 +1,9 @@ +# ChatMessageContentItemVideoVideoURL + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A | +| `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/datacollection.md b/docs/components/datacollection.md index bb07fc4..a07c6e2 100644 --- a/docs/components/datacollection.md +++ b/docs/components/datacollection.md @@ -2,8 +2,8 @@ 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. +- deny: use only providers which do not collect user data. ## Values diff --git a/docs/components/effort.md b/docs/components/effort.md index b4f7dbb..9d9b0d3 100644 --- a/docs/components/effort.md +++ b/docs/components/effort.md @@ -5,6 +5,7 @@ | Name | Value | | --------- | --------- | +| `NONE` | none | | `MINIMAL` | minimal | | `LOW` | low | | `MEDIUM` | medium | diff --git a/docs/components/openairesponsesreasoningeffort.md b/docs/components/openairesponsesreasoningeffort.md index bce9e5a..f5e1097 100644 --- a/docs/components/openairesponsesreasoningeffort.md +++ b/docs/components/openairesponsesreasoningeffort.md @@ -8,4 +8,5 @@ | `HIGH` | high | | `MEDIUM` | medium | | `LOW` | low | -| `MINIMAL` | minimal | \ No newline at end of file +| `MINIMAL` | minimal | +| `NONE` | none | \ No newline at end of file diff --git a/docs/components/openresponsesreasoningformat.md b/docs/components/openresponsesreasoningformat.md index 491cc90..1d3f96a 100644 --- a/docs/components/openresponsesreasoningformat.md +++ b/docs/components/openresponsesreasoningformat.md @@ -8,4 +8,5 @@ | `UNKNOWN` | unknown | | `OPENAI_RESPONSES_V1` | openai-responses-v1 | | `XAI_RESPONSES_V1` | xai-responses-v1 | -| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 | \ No newline at end of file +| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 | +| `GOOGLE_GEMINI_V1` | google-gemini-v1 | \ No newline at end of file diff --git a/docs/components/pricing.md b/docs/components/pricing.md index 1a44ac7..2c87436 100644 --- a/docs/components/pricing.md +++ b/docs/components/pricing.md @@ -9,6 +9,7 @@ | `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | +| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | diff --git a/docs/components/provider.md b/docs/components/provider.md index b9292f4..55078cc 100644 --- a/docs/components/provider.md +++ b/docs/components/provider.md @@ -9,12 +9,12 @@ When multiple model providers are available, optionally indicate your routing pr | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| | | `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | | -| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
| deny | +| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | allow | | `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | | `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true | | `order` | List[[components.Order](../components/order.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | | | `only` | List[[components.Only](../components/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | | | `ignore` | List[[components.Ignore](../components/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | | | `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | -| `sort` | [OptionalNullable[components.Sort]](../components/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | +| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `max_price` | [Optional[components.MaxPrice]](../components/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | | \ No newline at end of file diff --git a/docs/components/providername.md b/docs/components/providername.md index f29b89d..9c86cd3 100644 --- a/docs/components/providername.md +++ b/docs/components/providername.md @@ -3,91 +3,67 @@ ## Values -| Name | Value | -| ------------------ | ------------------ | -| `ANY_SCALE` | AnyScale | -| `CENT_ML` | Cent-ML | -| `HUGGING_FACE` | HuggingFace | -| `HYPERBOLIC_2` | Hyperbolic 2 | -| `LEPTON` | Lepton | -| `LYNN_2` | Lynn 2 | -| `LYNN` | Lynn | -| `MANCER` | Mancer | -| `MODAL` | Modal | -| `OCTO_AI` | OctoAI | -| `RECURSAL` | Recursal | -| `REFLECTION` | Reflection | -| `REPLICATE` | Replicate | -| `SAMBA_NOVA_2` | SambaNova 2 | -| `SF_COMPUTE` | SF Compute | -| `TOGETHER_2` | Together 2 | -| `ONE_DOT_AI` | 01.AI | -| `AI21` | AI21 | -| `AION_LABS` | AionLabs | -| `ALIBABA` | Alibaba | -| `AMAZON_BEDROCK` | Amazon Bedrock | -| `ANTHROPIC` | Anthropic | -| `ATLAS_CLOUD` | AtlasCloud | -| `ATOMA` | Atoma | -| `AVIAN` | Avian | -| `AZURE` | Azure | -| `BASE_TEN` | BaseTen | -| `CEREBRAS` | Cerebras | -| `CHUTES` | Chutes | -| `CIRRASCALE` | Cirrascale | -| `CLARIFAI` | Clarifai | -| `CLOUDFLARE` | Cloudflare | -| `COHERE` | Cohere | -| `CROF_AI` | CrofAI | -| `CRUSOE` | Crusoe | -| `DEEP_INFRA` | DeepInfra | -| `DEEP_SEEK` | DeepSeek | -| `ENFER` | Enfer | -| `FEATHERLESS` | Featherless | -| `FIREWORKS` | Fireworks | -| `FRIENDLI` | Friendli | -| `GMI_CLOUD` | GMICloud | -| `GOOGLE` | Google | -| `GOOGLE_AI_STUDIO` | Google AI Studio | -| `GROQ` | Groq | -| `HYPERBOLIC` | Hyperbolic | -| `INCEPTION` | Inception | -| `INFERENCE_NET` | InferenceNet | -| `INFERMATIC` | Infermatic | -| `INFLECTION` | Inflection | -| `INO_CLOUD` | InoCloud | -| `KLUSTER` | Kluster | -| `LAMBDA` | Lambda | -| `LIQUID` | Liquid | -| `MANCER_2` | Mancer 2 | -| `META` | Meta | -| `MINIMAX` | Minimax | -| `MODEL_RUN` | ModelRun | -| `MISTRAL` | Mistral | -| `MODULAR` | Modular | -| `MOONSHOT_AI` | Moonshot AI | -| `MORPH` | Morph | -| `N_COMPASS` | NCompass | -| `NEBIUS` | Nebius | -| `NEXT_BIT` | NextBit | -| `NINETEEN` | Nineteen | -| `NOVITA` | Novita | -| `NVIDIA` | Nvidia | -| `OPEN_AI` | OpenAI | -| `OPEN_INFERENCE` | OpenInference | -| `PARASAIL` | Parasail | -| `PERPLEXITY` | Perplexity | -| `PHALA` | Phala | -| `RELACE` | Relace | -| `SAMBA_NOVA` | SambaNova | -| `SILICON_FLOW` | SiliconFlow | -| `STEALTH` | Stealth | -| `SWITCHPOINT` | Switchpoint | -| `TARGON` | Targon | -| `TOGETHER` | Together | -| `UBICLOUD` | Ubicloud | -| `VENICE` | Venice | -| `WAND_B` | WandB | -| `X_AI` | xAI | -| `Z_AI` | Z.AI | -| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file +| Name | Value | +| ------------------- | ------------------- | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `ANTHROPIC` | Anthropic | +| `ARCEE` | Arcee | +| `ATLAS_CLOUD` | AtlasCloud | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `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 | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `LIQUID` | Liquid | +| `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 | +| `SILICON_FLOW` | SiliconFlow | +| `STEALTH` | Stealth | +| `SWITCHPOINT` | Switchpoint | +| `TARGON` | Targon | +| `TOGETHER` | Together | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | +| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file diff --git a/docs/components/sort.md b/docs/components/providersort.md similarity index 95% rename from docs/components/sort.md rename to docs/components/providersort.md index 65b6edb..771741f 100644 --- a/docs/components/sort.md +++ b/docs/components/providersort.md @@ -1,4 +1,4 @@ -# Sort +# ProviderSort The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. diff --git a/docs/components/publicpricing.md b/docs/components/publicpricing.md index 5d92c94..eb441eb 100644 --- a/docs/components/publicpricing.md +++ b/docs/components/publicpricing.md @@ -11,6 +11,7 @@ Pricing information for the model | `completion` | *Any* | :heavy_check_mark: | A value in string or number format that is a large number | | `request` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | +| `image_token` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `image_output` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `audio` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | | `input_audio_cache` | *Optional[Any]* | :heavy_minus_sign: | A value in string or number format that is a large number | diff --git a/docs/components/videourl1.md b/docs/components/videourl1.md new file mode 100644 index 0000000..505c186 --- /dev/null +++ b/docs/components/videourl1.md @@ -0,0 +1,8 @@ +# VideoURL1 + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/videourl2.md b/docs/components/videourl2.md new file mode 100644 index 0000000..b7f2463 --- /dev/null +++ b/docs/components/videourl2.md @@ -0,0 +1,8 @@ +# VideoURL2 + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/content.md b/docs/operations/content.md new file mode 100644 index 0000000..727997f --- /dev/null +++ b/docs/operations/content.md @@ -0,0 +1,17 @@ +# Content + + +## Supported Types + +### `operations.ContentText` + +```python +value: operations.ContentText = /* values here */ +``` + +### `operations.ContentImageURL` + +```python +value: operations.ContentImageURL = /* values here */ +``` + diff --git a/docs/operations/contentimageurl.md b/docs/operations/contentimageurl.md new file mode 100644 index 0000000..3a624d5 --- /dev/null +++ b/docs/operations/contentimageurl.md @@ -0,0 +1,9 @@ +# ContentImageURL + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `type` | [operations.TypeImageURL](../operations/typeimageurl.md) | :heavy_check_mark: | N/A | +| `image_url` | [operations.ImageURL](../operations/imageurl.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/contenttext.md b/docs/operations/contenttext.md new file mode 100644 index 0000000..11ffb7a --- /dev/null +++ b/docs/operations/contenttext.md @@ -0,0 +1,9 @@ +# ContentText + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `type` | [operations.TypeText](../operations/typetext.md) | :heavy_check_mark: | N/A | +| `text` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createembeddingsprovider.md b/docs/operations/createembeddingsprovider.md index 1e4c2cd..3fb50f7 100644 --- a/docs/operations/createembeddingsprovider.md +++ b/docs/operations/createembeddingsprovider.md @@ -7,12 +7,12 @@ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `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[operations.DataCollection]](../operations/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
| deny | +| `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | allow | | `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | | `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true | | `order` | List[[operations.Order](../operations/order.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | | | `only` | List[[operations.Only](../operations/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | | | `ignore` | List[[operations.Ignore](../operations/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | | | `quantizations` | List[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | -| `sort` | [OptionalNullable[operations.Sort]](../operations/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | +| `sort` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `max_price` | [Optional[operations.MaxPrice]](../operations/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | | \ No newline at end of file diff --git a/docs/operations/createembeddingsrequest.md b/docs/operations/createembeddingsrequest.md index fc76ee5..2226077 100644 --- a/docs/operations/createembeddingsrequest.md +++ b/docs/operations/createembeddingsrequest.md @@ -5,8 +5,10 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `input` | [operations.Input](../operations/input.md) | :heavy_check_mark: | N/A | +| `input` | [operations.InputUnion](../operations/inputunion.md) | :heavy_check_mark: | N/A | | `model` | *str* | :heavy_check_mark: | N/A | -| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | | `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/datacollection.md b/docs/operations/datacollection.md deleted file mode 100644 index bb07fc4..0000000 --- a/docs/operations/datacollection.md +++ /dev/null @@ -1,14 +0,0 @@ -# DataCollection - -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. - - - -## Values - -| Name | Value | -| ------- | ------- | -| `DENY` | deny | -| `ALLOW` | allow | \ No newline at end of file diff --git a/docs/operations/encodingformat.md b/docs/operations/encodingformat.md index ba6a041..7d5941c 100644 --- a/docs/operations/encodingformat.md +++ b/docs/operations/encodingformat.md @@ -1,17 +1,9 @@ # EncodingFormat -## Supported Types - -### `operations.EncodingFormatFloat` - -```python -value: operations.EncodingFormatFloat = /* values here */ -``` - -### `operations.EncodingFormatBase64` - -```python -value: operations.EncodingFormatBase64 = /* values here */ -``` +## Values +| Name | Value | +| -------- | -------- | +| `FLOAT` | float | +| `BASE64` | base64 | \ No newline at end of file diff --git a/docs/operations/encodingformatbase64.md b/docs/operations/encodingformatbase64.md deleted file mode 100644 index 859a006..0000000 --- a/docs/operations/encodingformatbase64.md +++ /dev/null @@ -1,8 +0,0 @@ -# EncodingFormatBase64 - - -## Values - -| Name | Value | -| -------- | -------- | -| `BASE64` | base64 | \ No newline at end of file diff --git a/docs/operations/encodingformatfloat.md b/docs/operations/encodingformatfloat.md deleted file mode 100644 index 4d95449..0000000 --- a/docs/operations/encodingformatfloat.md +++ /dev/null @@ -1,8 +0,0 @@ -# EncodingFormatFloat - - -## Values - -| Name | Value | -| ------- | ------- | -| `FLOAT` | float | \ No newline at end of file diff --git a/docs/operations/getparametersprovider.md b/docs/operations/getparametersprovider.md index 233a4ed..21a0244 100644 --- a/docs/operations/getparametersprovider.md +++ b/docs/operations/getparametersprovider.md @@ -3,73 +3,67 @@ ## Values -| Name | Value | -| ------------------ | ------------------ | -| `AI21` | AI21 | -| `AION_LABS` | AionLabs | -| `ALIBABA` | Alibaba | -| `AMAZON_BEDROCK` | Amazon Bedrock | -| `ANTHROPIC` | Anthropic | -| `ATLAS_CLOUD` | AtlasCloud | -| `ATOMA` | Atoma | -| `AVIAN` | Avian | -| `AZURE` | Azure | -| `BASE_TEN` | BaseTen | -| `CEREBRAS` | Cerebras | -| `CHUTES` | Chutes | -| `CIRRASCALE` | Cirrascale | -| `CLARIFAI` | Clarifai | -| `CLOUDFLARE` | Cloudflare | -| `COHERE` | Cohere | -| `CROF_AI` | CrofAI | -| `CRUSOE` | Crusoe | -| `DEEP_INFRA` | DeepInfra | -| `DEEP_SEEK` | DeepSeek | -| `ENFER` | Enfer | -| `FEATHERLESS` | Featherless | -| `FIREWORKS` | Fireworks | -| `FRIENDLI` | Friendli | -| `GMI_CLOUD` | GMICloud | -| `GOOGLE` | Google | -| `GOOGLE_AI_STUDIO` | Google AI Studio | -| `GROQ` | Groq | -| `HYPERBOLIC` | Hyperbolic | -| `INCEPTION` | Inception | -| `INFERENCE_NET` | InferenceNet | -| `INFERMATIC` | Infermatic | -| `INFLECTION` | Inflection | -| `KLUSTER` | Kluster | -| `LAMBDA` | Lambda | -| `LIQUID` | Liquid | -| `MANCER_2` | Mancer 2 | -| `META` | Meta | -| `MINIMAX` | Minimax | -| `MODEL_RUN` | ModelRun | -| `MISTRAL` | Mistral | -| `MODULAR` | Modular | -| `MOONSHOT_AI` | Moonshot AI | -| `MORPH` | Morph | -| `N_COMPASS` | NCompass | -| `NEBIUS` | Nebius | -| `NEXT_BIT` | NextBit | -| `NINETEEN` | Nineteen | -| `NOVITA` | Novita | -| `NVIDIA` | Nvidia | -| `OPEN_AI` | OpenAI | -| `OPEN_INFERENCE` | OpenInference | -| `PARASAIL` | Parasail | -| `PERPLEXITY` | Perplexity | -| `PHALA` | Phala | -| `RELACE` | Relace | -| `SAMBA_NOVA` | SambaNova | -| `SILICON_FLOW` | SiliconFlow | -| `STEALTH` | Stealth | -| `SWITCHPOINT` | Switchpoint | -| `TARGON` | Targon | -| `TOGETHER` | Together | -| `UBICLOUD` | Ubicloud | -| `VENICE` | Venice | -| `WAND_B` | WandB | -| `X_AI` | xAI | -| `Z_AI` | Z.AI | -| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file +| Name | Value | +| ------------------- | ------------------- | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `ANTHROPIC` | Anthropic | +| `ARCEE` | Arcee | +| `ATLAS_CLOUD` | AtlasCloud | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `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 | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `LIQUID` | Liquid | +| `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 | +| `SILICON_FLOW` | SiliconFlow | +| `STEALTH` | Stealth | +| `SWITCHPOINT` | Switchpoint | +| `TARGON` | Targon | +| `TOGETHER` | Together | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | +| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file diff --git a/docs/components/videourl.md b/docs/operations/imageurl.md similarity index 96% rename from docs/components/videourl.md rename to docs/operations/imageurl.md index 5bd5dec..cd90c03 100644 --- a/docs/components/videourl.md +++ b/docs/operations/imageurl.md @@ -1,4 +1,4 @@ -# VideoURL +# ImageURL ## Fields diff --git a/docs/operations/input.md b/docs/operations/input.md index e02d970..4559859 100644 --- a/docs/operations/input.md +++ b/docs/operations/input.md @@ -1,29 +1,8 @@ # Input -## Supported Types - -### `str` - -```python -value: str = /* values here */ -``` - -### `List[str]` - -```python -value: List[str] = /* values here */ -``` - -### `List[float]` - -```python -value: List[float] = /* values here */ -``` - -### `List[List[float]]` - -```python -value: List[List[float]] = /* values here */ -``` +## Fields +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `content` | List[[operations.Content](../operations/content.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/inputunion.md b/docs/operations/inputunion.md new file mode 100644 index 0000000..75550b6 --- /dev/null +++ b/docs/operations/inputunion.md @@ -0,0 +1,35 @@ +# InputUnion + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + +### `List[float]` + +```python +value: List[float] = /* values here */ +``` + +### `List[List[float]]` + +```python +value: List[List[float]] = /* values here */ +``` + +### `List[operations.Input]` + +```python +value: List[operations.Input] = /* values here */ +``` + diff --git a/docs/operations/sort.md b/docs/operations/sort.md deleted file mode 100644 index 65b6edb..0000000 --- a/docs/operations/sort.md +++ /dev/null @@ -1,12 +0,0 @@ -# Sort - -The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `PRICE` | price | -| `THROUGHPUT` | throughput | -| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/operations/typeimageurl.md b/docs/operations/typeimageurl.md new file mode 100644 index 0000000..addee7e --- /dev/null +++ b/docs/operations/typeimageurl.md @@ -0,0 +1,8 @@ +# TypeImageURL + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `IMAGE_URL` | image_url | \ No newline at end of file diff --git a/docs/operations/typetext.md b/docs/operations/typetext.md new file mode 100644 index 0000000..fb9c2cf --- /dev/null +++ b/docs/operations/typetext.md @@ -0,0 +1,8 @@ +# TypeText + + +## Values + +| Name | Value | +| ------ | ------ | +| `TEXT` | text | \ No newline at end of file diff --git a/docs/sdks/embeddings/README.md b/docs/sdks/embeddings/README.md index 32e9002..0f75d96 100644 --- a/docs/sdks/embeddings/README.md +++ b/docs/sdks/embeddings/README.md @@ -27,7 +27,7 @@ with OpenRouter( ) as open_router: res = open_router.embeddings.generate(input="", model="Taurus", provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ @@ -54,11 +54,13 @@ with OpenRouter( | Parameter | Type | Required | Description | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `input` | [operations.Input](../../operations/input.md) | :heavy_check_mark: | N/A | +| `input` | [operations.InputUnion](../../operations/inputunion.md) | :heavy_check_mark: | N/A | | `model` | *str* | :heavy_check_mark: | N/A | -| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | | `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.md) | :heavy_minus_sign: | N/A | +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | N/A | | `user` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `provider` | [Optional[operations.CreateEmbeddingsProvider]](../../operations/createembeddingsprovider.md) | :heavy_minus_sign: | N/A | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/responses/README.md b/docs/sdks/responses/README.md index 1ecbbb1..386fd37 100644 --- a/docs/sdks/responses/README.md +++ b/docs/sdks/responses/README.md @@ -65,7 +65,7 @@ with OpenRouter( }, }, }, service_tier="auto", truncation="auto", stream=False, provider={ - "data_collection": "deny", + "data_collection": "allow", "zdr": True, "enforce_distillable_text": True, "order": [ diff --git a/pyproject.toml b/pyproject.toml index 36e6dc4..e10c064 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.0.18" +version = "0.0.19" 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 bfb91a6..a25d226 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.0.18" +__version__: str = "0.0.19" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.755.9" -__user_agent__: str = "speakeasy-sdk/python 0.0.18 2.755.9 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.0.19 2.755.9 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 449b9d4..8a34729 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -21,7 +21,6 @@ if TYPE_CHECKING: BadRequestResponseErrorData, BadRequestResponseErrorDataTypedDict, ) - from .chatcompletionfinishreason import ChatCompletionFinishReason from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chatgenerationparams import ( ChatGenerationParams, @@ -72,9 +71,15 @@ if TYPE_CHECKING: ) from .chatmessagecontentitemvideo import ( ChatMessageContentItemVideo, + ChatMessageContentItemVideoInputVideo, + ChatMessageContentItemVideoInputVideoTypedDict, ChatMessageContentItemVideoTypedDict, - VideoURL, - VideoURLTypedDict, + ChatMessageContentItemVideoVideoURL, + ChatMessageContentItemVideoVideoURLTypedDict, + VideoURL1, + VideoURL1TypedDict, + VideoURL2, + VideoURL2TypedDict, ) from .chatmessagetokenlogprob import ( ChatMessageTokenLogprob, @@ -93,8 +98,13 @@ if TYPE_CHECKING: ChatMessageToolCallTypedDict, ) from .chatresponse import ChatResponse, ChatResponseTypedDict - from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict - from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict + from .chatresponsechoice import ( + ChatCompletionFinishReason, + ChatResponseChoice, + ChatResponseChoiceTypedDict, + ChatStreamingChoice, + ChatStreamingChoiceTypedDict, + ) from .chatstreamingmessagechunk import ( ChatStreamingMessageChunk, ChatStreamingMessageChunkRole, @@ -146,6 +156,7 @@ if TYPE_CHECKING: CreateChargeRequest, CreateChargeRequestTypedDict, ) + from .datacollection import DataCollection from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .edgenetworktimeoutresponseerrordata import ( EdgeNetworkTimeoutResponseErrorData, @@ -408,7 +419,6 @@ if TYPE_CHECKING: OpenResponsesReasoningSummaryTextDoneEventTypedDict, ) from .openresponsesrequest import ( - DataCollection, Engine, IDFileParser, IDModeration, @@ -442,7 +452,6 @@ if TYPE_CHECKING: Provider, ProviderTypedDict, ServiceTier, - Sort, Truncation, ) from .openresponsesresponsetext import ( @@ -581,6 +590,7 @@ if TYPE_CHECKING: ProviderOverloadedResponseErrorData, ProviderOverloadedResponseErrorDataTypedDict, ) + from .providersort import ProviderSort from .publicendpoint import ( Pricing, PricingTypedDict, @@ -821,7 +831,11 @@ __all__ = [ "ChatMessageContentItemTextTypedDict", "ChatMessageContentItemTypedDict", "ChatMessageContentItemVideo", + "ChatMessageContentItemVideoInputVideo", + "ChatMessageContentItemVideoInputVideoTypedDict", "ChatMessageContentItemVideoTypedDict", + "ChatMessageContentItemVideoVideoURL", + "ChatMessageContentItemVideoVideoURLTypedDict", "ChatMessageTokenLogprob", "ChatMessageTokenLogprobTypedDict", "ChatMessageTokenLogprobs", @@ -1205,6 +1219,7 @@ __all__ = [ "ProviderName", "ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorDataTypedDict", + "ProviderSort", "ProviderTypedDict", "PublicEndpoint", "PublicEndpointQuantization", @@ -1310,7 +1325,6 @@ __all__ = [ "ServiceTier", "ServiceUnavailableResponseErrorData", "ServiceUnavailableResponseErrorDataTypedDict", - "Sort", "StreamOptions", "StreamOptionsTypedDict", "SystemMessage", @@ -1366,8 +1380,10 @@ __all__ = [ "UserMessageTypedDict", "Variables", "VariablesTypedDict", - "VideoURL", - "VideoURLTypedDict", + "VideoURL1", + "VideoURL1TypedDict", + "VideoURL2", + "VideoURL2TypedDict", "WebSearchPreviewToolUserLocation", "WebSearchPreviewToolUserLocationType", "WebSearchPreviewToolUserLocationTypedDict", @@ -1385,7 +1401,6 @@ _dynamic_imports: dict[str, str] = { "BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata", "BadRequestResponseErrorData": ".badrequestresponseerrordata", "BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata", - "ChatCompletionFinishReason": ".chatcompletionfinishreason", "ChatErrorError": ".chaterror", "ChatErrorErrorTypedDict": ".chaterror", "Code": ".chaterror", @@ -1426,9 +1441,15 @@ _dynamic_imports: dict[str, str] = { "ChatMessageContentItemText": ".chatmessagecontentitemtext", "ChatMessageContentItemTextTypedDict": ".chatmessagecontentitemtext", "ChatMessageContentItemVideo": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoInputVideo": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoInputVideoTypedDict": ".chatmessagecontentitemvideo", "ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo", - "VideoURL": ".chatmessagecontentitemvideo", - "VideoURLTypedDict": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo", + "VideoURL1": ".chatmessagecontentitemvideo", + "VideoURL1TypedDict": ".chatmessagecontentitemvideo", + "VideoURL2": ".chatmessagecontentitemvideo", + "VideoURL2TypedDict": ".chatmessagecontentitemvideo", "ChatMessageTokenLogprob": ".chatmessagetokenlogprob", "ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob", "TopLogprob": ".chatmessagetokenlogprob", @@ -1441,10 +1462,11 @@ _dynamic_imports: dict[str, str] = { "ChatMessageToolCallTypedDict": ".chatmessagetoolcall", "ChatResponse": ".chatresponse", "ChatResponseTypedDict": ".chatresponse", + "ChatCompletionFinishReason": ".chatresponsechoice", "ChatResponseChoice": ".chatresponsechoice", "ChatResponseChoiceTypedDict": ".chatresponsechoice", - "ChatStreamingChoice": ".chatstreamingchoice", - "ChatStreamingChoiceTypedDict": ".chatstreamingchoice", + "ChatStreamingChoice": ".chatresponsechoice", + "ChatStreamingChoiceTypedDict": ".chatresponsechoice", "ChatStreamingMessageChunk": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk", "ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk", @@ -1488,6 +1510,7 @@ _dynamic_imports: dict[str, str] = { "ChainID": ".createchargerequest", "CreateChargeRequest": ".createchargerequest", "CreateChargeRequestTypedDict": ".createchargerequest", + "DataCollection": ".datacollection", "DefaultParameters": ".defaultparameters", "DefaultParametersTypedDict": ".defaultparameters", "EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata", @@ -1687,7 +1710,6 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent", - "DataCollection": ".openresponsesrequest", "Engine": ".openresponsesrequest", "IDFileParser": ".openresponsesrequest", "IDModeration": ".openresponsesrequest", @@ -1721,7 +1743,6 @@ _dynamic_imports: dict[str, str] = { "Provider": ".openresponsesrequest", "ProviderTypedDict": ".openresponsesrequest", "ServiceTier": ".openresponsesrequest", - "Sort": ".openresponsesrequest", "Truncation": ".openresponsesrequest", "OpenResponsesResponseText": ".openresponsesresponsetext", "OpenResponsesResponseTextTypedDict": ".openresponsesresponsetext", @@ -1834,6 +1855,7 @@ _dynamic_imports: dict[str, str] = { "ProviderName": ".providername", "ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata", "ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata", + "ProviderSort": ".providersort", "Pricing": ".publicendpoint", "PricingTypedDict": ".publicendpoint", "PublicEndpoint": ".publicendpoint", diff --git a/src/openrouter/components/chatgenerationparams.py b/src/openrouter/components/chatgenerationparams.py index 7cc6dd7..32fd9ca 100644 --- a/src/openrouter/components/chatgenerationparams.py +++ b/src/openrouter/components/chatgenerationparams.py @@ -31,6 +31,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict Effort = Union[ Literal[ + "none", "minimal", "low", "medium", diff --git a/src/openrouter/components/chatmessagecontentitem.py b/src/openrouter/components/chatmessagecontentitem.py index 2ebd348..87547ca 100644 --- a/src/openrouter/components/chatmessagecontentitem.py +++ b/src/openrouter/components/chatmessagecontentitem.py @@ -40,6 +40,7 @@ ChatMessageContentItem = Annotated[ Annotated[ChatMessageContentItemImage, Tag("image_url")], Annotated[ChatMessageContentItemAudio, Tag("input_audio")], Annotated[ChatMessageContentItemVideo, Tag("input_video")], + Annotated[ChatMessageContentItemVideo, Tag("video_url")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] diff --git a/src/openrouter/components/chatmessagecontentitemvideo.py b/src/openrouter/components/chatmessagecontentitemvideo.py index 023ae67..fccda91 100644 --- a/src/openrouter/components/chatmessagecontentitemvideo.py +++ b/src/openrouter/components/chatmessagecontentitemvideo.py @@ -5,25 +5,47 @@ from openrouter.types import BaseModel from openrouter.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing import Literal, Union +from typing_extensions import Annotated, TypeAliasType, TypedDict -class VideoURLTypedDict(TypedDict): +class VideoURL2TypedDict(TypedDict): url: str -class VideoURL(BaseModel): +class VideoURL2(BaseModel): url: str -class ChatMessageContentItemVideoTypedDict(TypedDict): - video_url: VideoURLTypedDict +class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict): + video_url: VideoURL2TypedDict + type: Literal["video_url"] + + +class ChatMessageContentItemVideoVideoURL(BaseModel): + video_url: VideoURL2 + + TYPE: Annotated[ + Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))], + pydantic.Field(alias="type"), + ] = "video_url" + + +class VideoURL1TypedDict(TypedDict): + url: str + + +class VideoURL1(BaseModel): + url: str + + +class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict): + video_url: VideoURL1TypedDict type: Literal["input_video"] -class ChatMessageContentItemVideo(BaseModel): - video_url: VideoURL +class ChatMessageContentItemVideoInputVideo(BaseModel): + video_url: VideoURL1 TYPE: Annotated[ Annotated[ @@ -31,3 +53,18 @@ class ChatMessageContentItemVideo(BaseModel): ], pydantic.Field(alias="type"), ] = "input_video" + + +ChatMessageContentItemVideoTypedDict = TypeAliasType( + "ChatMessageContentItemVideoTypedDict", + Union[ + ChatMessageContentItemVideoInputVideoTypedDict, + ChatMessageContentItemVideoVideoURLTypedDict, + ], +) + + +ChatMessageContentItemVideo = TypeAliasType( + "ChatMessageContentItemVideo", + Union[ChatMessageContentItemVideoInputVideo, ChatMessageContentItemVideoVideoURL], +) diff --git a/src/openrouter/components/chatresponsechoice.py b/src/openrouter/components/chatresponsechoice.py index 9592bf1..e59f847 100644 --- a/src/openrouter/components/chatresponsechoice.py +++ b/src/openrouter/components/chatresponsechoice.py @@ -2,24 +2,41 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict -from .chatcompletionfinishreason import ChatCompletionFinishReason from .chatmessagetokenlogprobs import ( ChatMessageTokenLogprobs, ChatMessageTokenLogprobsTypedDict, ) +from .chatstreamingmessagechunk import ( + ChatStreamingMessageChunk, + ChatStreamingMessageChunkTypedDict, +) from openrouter.types import ( BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL, + UnrecognizedStr, ) from openrouter.utils import validate_open_enum from pydantic import model_serializer from pydantic.functional_validators import PlainValidator +from typing import Literal, Union from typing_extensions import Annotated, NotRequired, TypedDict +ChatCompletionFinishReason = Union[ + Literal[ + "tool_calls", + "stop", + "length", + "content_filter", + "error", + ], + UnrecognizedStr, +] + + class ChatResponseChoiceTypedDict(TypedDict): finish_reason: Nullable[ChatCompletionFinishReason] index: float @@ -67,3 +84,52 @@ class ChatResponseChoice(BaseModel): m[k] = val return m + + +class ChatStreamingChoiceTypedDict(TypedDict): + delta: ChatStreamingMessageChunkTypedDict + finish_reason: Nullable[ChatCompletionFinishReason] + index: float + logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]] + + +class ChatStreamingChoice(BaseModel): + delta: ChatStreamingMessageChunk + + finish_reason: Annotated[ + Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False)) + ] + + index: float + + logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["logprobs"] + nullable_fields = ["finish_reason", "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/chatstreamingchoice.py b/src/openrouter/components/chatstreamingchoice.py deleted file mode 100644 index b64b8ff..0000000 --- a/src/openrouter/components/chatstreamingchoice.py +++ /dev/null @@ -1,72 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .chatcompletionfinishreason import ChatCompletionFinishReason -from .chatmessagetokenlogprobs import ( - ChatMessageTokenLogprobs, - ChatMessageTokenLogprobsTypedDict, -) -from .chatstreamingmessagechunk import ( - ChatStreamingMessageChunk, - ChatStreamingMessageChunkTypedDict, -) -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from openrouter.utils import validate_open_enum -from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ChatStreamingChoiceTypedDict(TypedDict): - delta: ChatStreamingMessageChunkTypedDict - finish_reason: Nullable[ChatCompletionFinishReason] - index: float - logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]] - - -class ChatStreamingChoice(BaseModel): - delta: ChatStreamingMessageChunk - - finish_reason: Annotated[ - Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False)) - ] - - index: float - - logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["logprobs"] - nullable_fields = ["finish_reason", "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/chatstreamingresponsechunk.py b/src/openrouter/components/chatstreamingresponsechunk.py index 7c32481..0ec76bc 100644 --- a/src/openrouter/components/chatstreamingresponsechunk.py +++ b/src/openrouter/components/chatstreamingresponsechunk.py @@ -5,7 +5,7 @@ from .chatgenerationtokenusage import ( ChatGenerationTokenUsage, ChatGenerationTokenUsageTypedDict, ) -from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict +from .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict from openrouter.types import ( BaseModel, Nullable, diff --git a/src/openrouter/components/datacollection.py b/src/openrouter/components/datacollection.py new file mode 100644 index 0000000..0ab58be --- /dev/null +++ b/src/openrouter/components/datacollection.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +DataCollection = Union[ + Literal[ + "deny", + "allow", + ], + UnrecognizedStr, +] +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. +""" diff --git a/src/openrouter/components/openairesponsesreasoningeffort.py b/src/openrouter/components/openairesponsesreasoningeffort.py index 34d2cf0..4e645d2 100644 --- a/src/openrouter/components/openairesponsesreasoningeffort.py +++ b/src/openrouter/components/openairesponsesreasoningeffort.py @@ -11,6 +11,7 @@ OpenAIResponsesReasoningEffort = Union[ "medium", "low", "minimal", + "none", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/openresponsesreasoning.py b/src/openrouter/components/openresponsesreasoning.py index f115e26..1237605 100644 --- a/src/openrouter/components/openresponsesreasoning.py +++ b/src/openrouter/components/openresponsesreasoning.py @@ -57,6 +57,7 @@ OpenResponsesReasoningFormat = Union[ "openai-responses-v1", "xai-responses-v1", "anthropic-claude-v1", + "google-gemini-v1", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/openresponsesrequest.py b/src/openrouter/components/openresponsesrequest.py index 706716f..265f2d5 100644 --- a/src/openrouter/components/openresponsesrequest.py +++ b/src/openrouter/components/openresponsesrequest.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .datacollection import DataCollection from .openairesponsesincludable import OpenAIResponsesIncludable from .openairesponsesprompt import OpenAIResponsesPrompt, OpenAIResponsesPromptTypedDict from .openairesponsestoolchoice_union import ( @@ -33,6 +34,7 @@ from .openresponseswebsearchtool import ( OpenResponsesWebSearchToolTypedDict, ) from .providername import ProviderName +from .providersort import ProviderSort from .quantization import Quantization from openrouter.types import ( BaseModel, @@ -151,20 +153,6 @@ Truncation = Union[ ] -DataCollection = Union[ - Literal[ - "deny", - "allow", - ], - UnrecognizedStr, -] -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. - -""" - - OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str]) @@ -192,17 +180,6 @@ Ignore = TypeAliasType( ) -Sort = Union[ - Literal[ - "price", - "throughput", - "latency", - ], - UnrecognizedStr, -] -r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - - class MaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -251,8 +228,8 @@ class ProviderTypedDict(TypedDict): data_collection: NotRequired[Nullable[DataCollection]] r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - - deny: use only providers which do not collect user data. + - deny: use only providers which do not collect user data. """ zdr: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -266,7 +243,7 @@ class ProviderTypedDict(TypedDict): r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" quantizations: NotRequired[Nullable[List[Quantization]]] r"""A list of quantization levels to filter the provider by.""" - sort: NotRequired[Nullable[Sort]] + sort: NotRequired[Nullable[ProviderSort]] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" max_price: NotRequired[MaxPriceTypedDict] r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -290,8 +267,8 @@ class Provider(BaseModel): ] = 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. + - deny: use only providers which do not collect user data. """ zdr: OptionalNullable[bool] = UNSET @@ -315,7 +292,7 @@ class Provider(BaseModel): r"""A list of quantization levels to filter the provider by.""" sort: Annotated[ - OptionalNullable[Sort], PlainValidator(validate_open_enum(False)) + OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False)) ] = UNSET r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index 035e1b1..21f6345 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -7,44 +7,26 @@ from typing import Literal, Union ProviderName = Union[ Literal[ - "AnyScale", - "Cent-ML", - "HuggingFace", - "Hyperbolic 2", - "Lepton", - "Lynn 2", - "Lynn", - "Mancer", - "Modal", - "OctoAI", - "Recursal", - "Reflection", - "Replicate", - "SambaNova 2", - "SF Compute", - "Together 2", - "01.AI", "AI21", "AionLabs", "Alibaba", "Amazon Bedrock", "Anthropic", + "Arcee", "AtlasCloud", - "Atoma", "Avian", "Azure", "BaseTen", + "Black Forest Labs", "Cerebras", "Chutes", "Cirrascale", "Clarifai", "Cloudflare", "Cohere", - "CrofAI", "Crusoe", "DeepInfra", "DeepSeek", - "Enfer", "Featherless", "Fireworks", "Friendli", @@ -57,12 +39,8 @@ ProviderName = Union[ "InferenceNet", "Infermatic", "Inflection", - "InoCloud", - "Kluster", - "Lambda", "Liquid", "Mancer 2", - "Meta", "Minimax", "ModelRun", "Mistral", @@ -72,7 +50,6 @@ ProviderName = Union[ "NCompass", "Nebius", "NextBit", - "Nineteen", "Novita", "Nvidia", "OpenAI", @@ -87,7 +64,6 @@ ProviderName = Union[ "Switchpoint", "Targon", "Together", - "Ubicloud", "Venice", "WandB", "xAI", diff --git a/src/openrouter/components/chatcompletionfinishreason.py b/src/openrouter/components/providersort.py similarity index 52% rename from src/openrouter/components/chatcompletionfinishreason.py rename to src/openrouter/components/providersort.py index 686462c..8a8d415 100644 --- a/src/openrouter/components/chatcompletionfinishreason.py +++ b/src/openrouter/components/providersort.py @@ -5,13 +5,12 @@ from openrouter.types import UnrecognizedStr from typing import Literal, Union -ChatCompletionFinishReason = Union[ +ProviderSort = Union[ Literal[ - "tool_calls", - "stop", - "length", - "content_filter", - "error", + "price", + "throughput", + "latency", ], UnrecognizedStr, ] +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" diff --git a/src/openrouter/components/publicendpoint.py b/src/openrouter/components/publicendpoint.py index da47f2f..5d5664d 100644 --- a/src/openrouter/components/publicendpoint.py +++ b/src/openrouter/components/publicendpoint.py @@ -21,6 +21,8 @@ class PricingTypedDict(TypedDict): r"""A value in string or number format that is a large number""" image: NotRequired[Any] r"""A value in string or number format that is a large number""" + image_token: NotRequired[Any] + r"""A value in string or number format that is a large number""" image_output: NotRequired[Any] r"""A value in string or number format that is a large number""" audio: NotRequired[Any] @@ -51,6 +53,9 @@ class Pricing(BaseModel): image: Optional[Any] = None r"""A value in string or number format that is a large number""" + image_token: Optional[Any] = None + r"""A value in string or number format that is a large number""" + image_output: Optional[Any] = None r"""A value in string or number format that is a large number""" diff --git a/src/openrouter/components/publicpricing.py b/src/openrouter/components/publicpricing.py index 23a48d8..16bb61d 100644 --- a/src/openrouter/components/publicpricing.py +++ b/src/openrouter/components/publicpricing.py @@ -17,6 +17,8 @@ class PublicPricingTypedDict(TypedDict): r"""A value in string or number format that is a large number""" image: NotRequired[Any] r"""A value in string or number format that is a large number""" + image_token: NotRequired[Any] + r"""A value in string or number format that is a large number""" image_output: NotRequired[Any] r"""A value in string or number format that is a large number""" audio: NotRequired[Any] @@ -49,6 +51,9 @@ class PublicPricing(BaseModel): image: Optional[Any] = None r"""A value in string or number format that is a large number""" + image_token: Optional[Any] = None + r"""A value in string or number format that is a large number""" + image_output: Optional[Any] = None r"""A value in string or number format that is a large number""" diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index 7057c9d..0dec307 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -21,18 +21,18 @@ class Embeddings(BaseSDK): def generate( self, *, - input: Union[operations.Input, operations.InputTypedDict], + input: Union[operations.InputUnion, operations.InputUnionTypedDict], model: str, + encoding_format: Optional[operations.EncodingFormat] = None, + dimensions: Optional[int] = None, + user: Optional[str] = None, provider: Optional[ Union[ operations.CreateEmbeddingsProvider, operations.CreateEmbeddingsProviderTypedDict, ] ] = None, - encoding_format: Optional[ - Union[operations.EncodingFormat, operations.EncodingFormatTypedDict] - ] = None, - user: Optional[str] = None, + input_type: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -45,9 +45,11 @@ class Embeddings(BaseSDK): :param input: :param model: - :param provider: :param encoding_format: + :param dimensions: :param user: + :param provider: + :param input_type: :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 @@ -65,13 +67,15 @@ class Embeddings(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateEmbeddingsRequest( - input=input, + input=utils.get_pydantic_model(input, operations.InputUnion), model=model, + encoding_format=encoding_format, + dimensions=dimensions, + user=user, provider=utils.get_pydantic_model( provider, Optional[operations.CreateEmbeddingsProvider] ), - encoding_format=encoding_format, - user=user, + input_type=input_type, ) req = self._build_request( @@ -204,18 +208,18 @@ class Embeddings(BaseSDK): async def generate_async( self, *, - input: Union[operations.Input, operations.InputTypedDict], + input: Union[operations.InputUnion, operations.InputUnionTypedDict], model: str, + encoding_format: Optional[operations.EncodingFormat] = None, + dimensions: Optional[int] = None, + user: Optional[str] = None, provider: Optional[ Union[ operations.CreateEmbeddingsProvider, operations.CreateEmbeddingsProviderTypedDict, ] ] = None, - encoding_format: Optional[ - Union[operations.EncodingFormat, operations.EncodingFormatTypedDict] - ] = None, - user: Optional[str] = None, + input_type: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -228,9 +232,11 @@ class Embeddings(BaseSDK): :param input: :param model: - :param provider: :param encoding_format: + :param dimensions: :param user: + :param provider: + :param input_type: :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 @@ -248,13 +254,15 @@ class Embeddings(BaseSDK): base_url = self._get_url(base_url, url_variables) request = operations.CreateEmbeddingsRequest( - input=input, + input=utils.get_pydantic_model(input, operations.InputUnion), model=model, + encoding_format=encoding_format, + dimensions=dimensions, + user=user, provider=utils.get_pydantic_model( provider, Optional[operations.CreateEmbeddingsProvider] ), - encoding_format=encoding_format, - user=user, + input_type=input_type, ) req = self._build_request_async( diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index a00d958..3ba8b45 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -32,6 +32,12 @@ if TYPE_CHECKING: Web3DataTypedDict, ) from .createembeddings import ( + Content, + ContentImageURL, + ContentImageURLTypedDict, + ContentText, + ContentTextTypedDict, + ContentTypedDict, CreateEmbeddingsData, CreateEmbeddingsDataTypedDict, CreateEmbeddingsProvider, @@ -42,17 +48,17 @@ if TYPE_CHECKING: CreateEmbeddingsResponseBody, CreateEmbeddingsResponseBodyTypedDict, CreateEmbeddingsResponseTypedDict, - DataCollection, Embedding, EmbeddingTypedDict, EncodingFormat, - EncodingFormatBase64, - EncodingFormatFloat, - EncodingFormatTypedDict, Ignore, IgnoreTypedDict, + ImageURL, + ImageURLTypedDict, Input, InputTypedDict, + InputUnion, + InputUnionTypedDict, MaxPrice, MaxPriceTypedDict, Object, @@ -61,7 +67,8 @@ if TYPE_CHECKING: OnlyTypedDict, Order, OrderTypedDict, - Sort, + TypeImageURL, + TypeText, Usage, UsageTypedDict, ) @@ -183,6 +190,12 @@ __all__ = [ "APIType", "CallData", "CallDataTypedDict", + "Content", + "ContentImageURL", + "ContentImageURLTypedDict", + "ContentText", + "ContentTextTypedDict", + "ContentTypedDict", "CreateAuthKeysCodeCodeChallengeMethod", "CreateAuthKeysCodeData", "CreateAuthKeysCodeDataTypedDict", @@ -217,7 +230,6 @@ __all__ = [ "CreateResponsesResponseBody", "CreateResponsesResponseBodyTypedDict", "CreateResponsesResponseTypedDict", - "DataCollection", "DeleteKeysRequest", "DeleteKeysRequestTypedDict", "DeleteKeysResponse", @@ -225,9 +237,6 @@ __all__ = [ "Embedding", "EmbeddingTypedDict", "EncodingFormat", - "EncodingFormatBase64", - "EncodingFormatFloat", - "EncodingFormatTypedDict", "ExchangeAuthCodeForAPIKeyCodeChallengeMethod", "ExchangeAuthCodeForAPIKeyRequest", "ExchangeAuthCodeForAPIKeyRequestTypedDict", @@ -268,8 +277,12 @@ __all__ = [ "GetUserActivityResponseTypedDict", "Ignore", "IgnoreTypedDict", + "ImageURL", + "ImageURLTypedDict", "Input", "InputTypedDict", + "InputUnion", + "InputUnionTypedDict", "ListData", "ListDataTypedDict", "ListEndpointsRequest", @@ -302,10 +315,11 @@ __all__ = [ "RateLimitTypedDict", "SendChatCompletionRequestResponse", "SendChatCompletionRequestResponseTypedDict", - "Sort", "SupportedParameter", "TransferIntent", "TransferIntentTypedDict", + "TypeImageURL", + "TypeText", "UpdateKeysData", "UpdateKeysDataTypedDict", "UpdateKeysLimitReset", @@ -343,6 +357,12 @@ _dynamic_imports: dict[str, str] = { "TransferIntentTypedDict": ".createcoinbasecharge", "Web3Data": ".createcoinbasecharge", "Web3DataTypedDict": ".createcoinbasecharge", + "Content": ".createembeddings", + "ContentImageURL": ".createembeddings", + "ContentImageURLTypedDict": ".createembeddings", + "ContentText": ".createembeddings", + "ContentTextTypedDict": ".createembeddings", + "ContentTypedDict": ".createembeddings", "CreateEmbeddingsData": ".createembeddings", "CreateEmbeddingsDataTypedDict": ".createembeddings", "CreateEmbeddingsProvider": ".createembeddings", @@ -353,17 +373,17 @@ _dynamic_imports: dict[str, str] = { "CreateEmbeddingsResponseBody": ".createembeddings", "CreateEmbeddingsResponseBodyTypedDict": ".createembeddings", "CreateEmbeddingsResponseTypedDict": ".createembeddings", - "DataCollection": ".createembeddings", "Embedding": ".createembeddings", "EmbeddingTypedDict": ".createembeddings", "EncodingFormat": ".createembeddings", - "EncodingFormatBase64": ".createembeddings", - "EncodingFormatFloat": ".createembeddings", - "EncodingFormatTypedDict": ".createembeddings", "Ignore": ".createembeddings", "IgnoreTypedDict": ".createembeddings", + "ImageURL": ".createembeddings", + "ImageURLTypedDict": ".createembeddings", "Input": ".createembeddings", "InputTypedDict": ".createembeddings", + "InputUnion": ".createembeddings", + "InputUnionTypedDict": ".createembeddings", "MaxPrice": ".createembeddings", "MaxPriceTypedDict": ".createembeddings", "Object": ".createembeddings", @@ -372,7 +392,8 @@ _dynamic_imports: dict[str, str] = { "OnlyTypedDict": ".createembeddings", "Order": ".createembeddings", "OrderTypedDict": ".createembeddings", - "Sort": ".createembeddings", + "TypeImageURL": ".createembeddings", + "TypeText": ".createembeddings", "Usage": ".createembeddings", "UsageTypedDict": ".createembeddings", "CreateKeysData": ".createkeys", diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index b84d22b..ddd90c3 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -2,7 +2,9 @@ from __future__ import annotations from openrouter.components import ( + datacollection as components_datacollection, providername as components_providername, + providersort as components_providersort, quantization as components_quantization, ) from openrouter.types import ( @@ -20,26 +22,76 @@ from typing import Any, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -InputTypedDict = TypeAliasType( - "InputTypedDict", Union[str, List[str], List[float], List[List[float]]] +TypeImageURL = Literal["image_url",] + + +class ImageURLTypedDict(TypedDict): + url: str + + +class ImageURL(BaseModel): + url: str + + +class ContentImageURLTypedDict(TypedDict): + type: TypeImageURL + image_url: ImageURLTypedDict + + +class ContentImageURL(BaseModel): + type: TypeImageURL + + image_url: ImageURL + + +TypeText = Literal["text",] + + +class ContentTextTypedDict(TypedDict): + type: TypeText + text: str + + +class ContentText(BaseModel): + type: TypeText + + text: str + + +ContentTypedDict = TypeAliasType( + "ContentTypedDict", Union[ContentTextTypedDict, ContentImageURLTypedDict] ) -Input = TypeAliasType("Input", Union[str, List[str], List[float], List[List[float]]]) +Content = TypeAliasType("Content", Union[ContentText, ContentImageURL]) -DataCollection = Union[ +class InputTypedDict(TypedDict): + content: List[ContentTypedDict] + + +class Input(BaseModel): + content: List[Content] + + +InputUnionTypedDict = TypeAliasType( + "InputUnionTypedDict", + Union[str, List[str], List[float], List[List[float]], List[InputTypedDict]], +) + + +InputUnion = TypeAliasType( + "InputUnion", Union[str, List[str], List[float], List[List[float]], List[Input]] +) + + +EncodingFormat = Union[ Literal[ - "deny", - "allow", + "float", + "base64", ], UnrecognizedStr, ] -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. - -""" OrderTypedDict = TypeAliasType( @@ -93,17 +145,6 @@ Ignore = TypeAliasType( ) -Sort = Union[ - Literal[ - "price", - "throughput", - "latency", - ], - UnrecognizedStr, -] -r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - - class MaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -147,11 +188,11 @@ class CreateEmbeddingsProviderTypedDict(TypedDict): """ require_parameters: NotRequired[Nullable[bool]] r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" - data_collection: NotRequired[Nullable[DataCollection]] + data_collection: NotRequired[Nullable[components_datacollection.DataCollection]] r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - - deny: use only providers which do not collect user data. + - deny: use only providers which do not collect user data. """ zdr: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -165,7 +206,7 @@ class CreateEmbeddingsProviderTypedDict(TypedDict): r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" quantizations: NotRequired[Nullable[List[components_quantization.Quantization]]] r"""A list of quantization levels to filter the provider by.""" - sort: NotRequired[Nullable[Sort]] + sort: NotRequired[Nullable[components_providersort.ProviderSort]] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" max_price: NotRequired[MaxPriceTypedDict] r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @@ -183,12 +224,13 @@ class CreateEmbeddingsProvider(BaseModel): r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" data_collection: Annotated[ - OptionalNullable[DataCollection], PlainValidator(validate_open_enum(False)) + OptionalNullable[components_datacollection.DataCollection], + PlainValidator(validate_open_enum(False)), ] = UNSET r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - - deny: use only providers which do not collect user data. + - deny: use only providers which do not collect user data. """ zdr: OptionalNullable[bool] = UNSET @@ -217,7 +259,8 @@ class CreateEmbeddingsProvider(BaseModel): r"""A list of quantization levels to filter the provider by.""" sort: Annotated[ - OptionalNullable[Sort], PlainValidator(validate_open_enum(False)) + OptionalNullable[components_providersort.ProviderSort], + PlainValidator(validate_open_enum(False)), ] = UNSET r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" @@ -278,41 +321,33 @@ class CreateEmbeddingsProvider(BaseModel): return m -EncodingFormatBase64 = Literal["base64",] - - -EncodingFormatFloat = Literal["float",] - - -EncodingFormatTypedDict = TypeAliasType( - "EncodingFormatTypedDict", Union[EncodingFormatFloat, EncodingFormatBase64] -) - - -EncodingFormat = TypeAliasType( - "EncodingFormat", Union[EncodingFormatFloat, EncodingFormatBase64] -) - - class CreateEmbeddingsRequestTypedDict(TypedDict): - input: InputTypedDict + input: InputUnionTypedDict model: str - provider: NotRequired[CreateEmbeddingsProviderTypedDict] - encoding_format: NotRequired[EncodingFormatTypedDict] + encoding_format: NotRequired[EncodingFormat] + dimensions: NotRequired[int] user: NotRequired[str] + provider: NotRequired[CreateEmbeddingsProviderTypedDict] + input_type: NotRequired[str] class CreateEmbeddingsRequest(BaseModel): - input: Input + input: InputUnion model: str - provider: Optional[CreateEmbeddingsProvider] = None + encoding_format: Annotated[ + Optional[EncodingFormat], PlainValidator(validate_open_enum(False)) + ] = None - encoding_format: Optional[EncodingFormat] = None + dimensions: Optional[int] = None user: Optional[str] = None + provider: Optional[CreateEmbeddingsProvider] = None + + input_type: Optional[str] = None + Object = Literal["list",] diff --git a/src/openrouter/operations/getparameters.py b/src/openrouter/operations/getparameters.py index 1a94a21..18da669 100644 --- a/src/openrouter/operations/getparameters.py +++ b/src/openrouter/operations/getparameters.py @@ -39,22 +39,21 @@ GetParametersProvider = Union[ "Alibaba", "Amazon Bedrock", "Anthropic", + "Arcee", "AtlasCloud", - "Atoma", "Avian", "Azure", "BaseTen", + "Black Forest Labs", "Cerebras", "Chutes", "Cirrascale", "Clarifai", "Cloudflare", "Cohere", - "CrofAI", "Crusoe", "DeepInfra", "DeepSeek", - "Enfer", "Featherless", "Fireworks", "Friendli", @@ -67,11 +66,8 @@ GetParametersProvider = Union[ "InferenceNet", "Infermatic", "Inflection", - "Kluster", - "Lambda", "Liquid", "Mancer 2", - "Meta", "Minimax", "ModelRun", "Mistral", @@ -81,7 +77,6 @@ GetParametersProvider = Union[ "NCompass", "Nebius", "NextBit", - "Nineteen", "Novita", "Nvidia", "OpenAI", @@ -96,7 +91,6 @@ GetParametersProvider = Union[ "Switchpoint", "Targon", "Together", - "Ubicloud", "Venice", "WandB", "xAI",