Compare commits

..
Author SHA1 Message Date
OpenRouter Team 82bbe75d87 Commits included in this export:
- 68922847c2969b773887310eb7aa9a814e199c5a
  - 729ee2338c39df22461526153e7f4ba868fd498e
  - e1074ff86fccf5e48406b7595298873106d3cc5a
  - 123bbdaf841d299162a82ee2573adfbb70a45b8f
  - ac457b8a8dad98fdf5ddcae8dd4711361cea3084
  - ea825199f4c59dd68fec01cf8d18a582963c9f25
  - 4d48e4f6bb936e785787314a965298da6b78fea0
  - 718729a573ee98893a4408d5a52ab4686661fe54
  - b867adcde6b64f3f2a11c4626254b39098e4b0b4
  - 21912c097b4066d109766c6b4492826595cd57c5
  - bc1ed85adc976a4634ca8a41b82e4fc2c39a864f
  - d145c89c941937a312ed1357590d2bfda9a3603d
  - 12f05b5dee397ead47cfcd545a7a2e3c7ff57524
  - dd28f75a19a015809797c7abf3f8758f7c37262e
  - c96e569781e07ab44172d9c69940ec17bafd81f4
  - c9d5a90e3c2b5077a2bdd49773f1a46d1a5a79c7
  - 58b08f87116ceab9076de2fdc0a4c74c919b44c4

GitOrigin-RevId: 68922847c2969b773887310eb7aa9a814e199c5a
2026-01-29 18:16:59 +00:00
85 changed files with 2453 additions and 1852 deletions
+42 -35
View File
@@ -1,12 +1,12 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
management: management:
docChecksum: 342e7e8ea9cb2b7ff1c1860e18d58822 docChecksum: 8e4409198e29bd1054772727ad1cd368
docVersion: 1.0.0 docVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
generationVersion: 2.768.0 generationVersion: 2.768.0
releaseVersion: 0.2.0 releaseVersion: 0.4.0
configChecksum: 65a367d36e219e834a1176c8ec421a0a configChecksum: 3a0d4d70223d25bf75028237ebd7e079
repoURL: https://github.com/OpenRouterTeam/python-sdk.git repoURL: https://github.com/OpenRouterTeam/python-sdk.git
installationURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true published: true
@@ -60,20 +60,7 @@ generatedFiles:
- docs/components/chatcompletionfinishreason.md - docs/components/chatcompletionfinishreason.md
- docs/components/chaterrorerror.md - docs/components/chaterrorerror.md
- docs/components/chatgenerationparams.md - docs/components/chatgenerationparams.md
- docs/components/chatgenerationparamsdatacollection.md
- docs/components/chatgenerationparamsimageconfig.md - docs/components/chatgenerationparamsimageconfig.md
- docs/components/chatgenerationparamsmaxprice.md
- docs/components/chatgenerationparamspluginautorouter.md
- docs/components/chatgenerationparamspluginfileparser.md
- docs/components/chatgenerationparamspluginmoderation.md
- docs/components/chatgenerationparamspluginresponsehealing.md
- docs/components/chatgenerationparamspluginunion.md
- docs/components/chatgenerationparamspluginweb.md
- docs/components/chatgenerationparamspreferredmaxlatency.md
- docs/components/chatgenerationparamspreferredmaxlatencyunion.md
- docs/components/chatgenerationparamspreferredminthroughput.md
- docs/components/chatgenerationparamspreferredminthroughputunion.md
- docs/components/chatgenerationparamsprovider.md
- docs/components/chatgenerationtokenusage.md - docs/components/chatgenerationtokenusage.md
- docs/components/chatmessagecontentitem.md - docs/components/chatmessagecontentitem.md
- docs/components/chatmessagecontentitemaudio.md - docs/components/chatmessagecontentitemaudio.md
@@ -104,12 +91,15 @@ generatedFiles:
- docs/components/chatstreamoptions.md - docs/components/chatstreamoptions.md
- docs/components/code.md - docs/components/code.md
- docs/components/codeenum.md - docs/components/codeenum.md
- docs/components/completion.md
- docs/components/completiontokensdetails.md - docs/components/completiontokensdetails.md
- docs/components/costdetails.md - docs/components/costdetails.md
- docs/components/createchargerequest.md - docs/components/createchargerequest.md
- docs/components/datacollection.md - docs/components/datacollection.md
- docs/components/debug.md - docs/components/debug.md
- docs/components/defaultparameters.md - docs/components/defaultparameters.md
- docs/components/developermessage.md
- docs/components/developermessagecontent.md
- docs/components/edgenetworktimeoutresponseerrordata.md - docs/components/edgenetworktimeoutresponseerrordata.md
- docs/components/effort.md - docs/components/effort.md
- docs/components/endpointstatus.md - docs/components/endpointstatus.md
@@ -134,8 +124,6 @@ generatedFiles:
- docs/components/listendpointsresponse.md - docs/components/listendpointsresponse.md
- docs/components/logprob.md - docs/components/logprob.md
- docs/components/message.md - docs/components/message.md
- docs/components/messagecontent.md
- docs/components/messagedeveloper.md
- docs/components/modality.md - docs/components/modality.md
- docs/components/model.md - docs/components/model.md
- docs/components/modelarchitecture.md - docs/components/modelarchitecture.md
@@ -257,13 +245,6 @@ generatedFiles:
- docs/components/openresponsesrequestmaxprice.md - docs/components/openresponsesrequestmaxprice.md
- docs/components/openresponsesrequestonly.md - docs/components/openresponsesrequestonly.md
- docs/components/openresponsesrequestorder.md - docs/components/openresponsesrequestorder.md
- docs/components/openresponsesrequestpluginautorouter.md
- docs/components/openresponsesrequestpluginfileparser.md
- docs/components/openresponsesrequestpluginmoderation.md
- docs/components/openresponsesrequestpluginresponsehealing.md
- docs/components/openresponsesrequestpluginunion.md
- docs/components/openresponsesrequestpluginweb.md
- docs/components/openresponsesrequestprovider.md
- docs/components/openresponsesrequestsort.md - docs/components/openresponsesrequestsort.md
- docs/components/openresponsesrequesttoolfunction.md - docs/components/openresponsesrequesttoolfunction.md
- docs/components/openresponsesrequesttoolunion.md - docs/components/openresponsesrequesttoolunion.md
@@ -326,10 +307,18 @@ generatedFiles:
- docs/components/percentilestats.md - docs/components/percentilestats.md
- docs/components/percentilethroughputcutoffs.md - docs/components/percentilethroughputcutoffs.md
- docs/components/perrequestlimits.md - docs/components/perrequestlimits.md
- docs/components/plugin.md
- docs/components/pluginautorouter.md
- docs/components/pluginfileparser.md
- docs/components/pluginmoderation.md
- docs/components/pluginresponsehealing.md
- docs/components/pluginweb.md
- docs/components/preferredmaxlatency.md - docs/components/preferredmaxlatency.md
- docs/components/preferredminthroughput.md - docs/components/preferredminthroughput.md
- docs/components/pricing.md - docs/components/pricing.md
- docs/components/prompt.md
- docs/components/prompttokensdetails.md - docs/components/prompttokensdetails.md
- docs/components/provider.md
- docs/components/providername.md - docs/components/providername.md
- docs/components/provideroverloadedresponseerrordata.md - docs/components/provideroverloadedresponseerrordata.md
- docs/components/providerpreferences.md - docs/components/providerpreferences.md
@@ -350,7 +339,6 @@ generatedFiles:
- docs/components/publicendpointquantization.md - docs/components/publicendpointquantization.md
- docs/components/publicpricing.md - docs/components/publicpricing.md
- docs/components/quantization.md - docs/components/quantization.md
- docs/components/quantizations.md
- docs/components/reason.md - docs/components/reason.md
- docs/components/reasoning.md - docs/components/reasoning.md
- docs/components/reasoningsummarytext.md - docs/components/reasoningsummarytext.md
@@ -425,12 +413,25 @@ generatedFiles:
- docs/components/responsetextconfigverbosity.md - docs/components/responsetextconfigverbosity.md
- docs/components/route.md - docs/components/route.md
- docs/components/schema0.md - docs/components/schema0.md
- docs/components/schema0enum.md - docs/components/schema10.md
- docs/components/schema2.md - docs/components/schema14.md
- docs/components/schema2reasoningencrypted.md - docs/components/schema15.md
- docs/components/schema2reasoningsummary.md - docs/components/schema15union.md
- docs/components/schema2reasoningtext.md - docs/components/schema17.md
- docs/components/schema4.md - docs/components/schema17autorouter.md
- docs/components/schema17fileparser.md
- docs/components/schema17moderation.md
- docs/components/schema17responsehealing.md
- docs/components/schema17web.md
- docs/components/schema19.md
- docs/components/schema19reasoningencrypted.md
- docs/components/schema19reasoningsummary.md
- docs/components/schema19reasoningtext.md
- docs/components/schema21.md
- docs/components/schema3.md
- docs/components/schema5.md
- docs/components/schema5enum.md
- docs/components/schema8.md
- docs/components/security.md - docs/components/security.md
- docs/components/servicetier.md - docs/components/servicetier.md
- docs/components/serviceunavailableresponseerrordata.md - docs/components/serviceunavailableresponseerrordata.md
@@ -593,6 +594,8 @@ generatedFiles:
- docs/operations/metadata.md - docs/operations/metadata.md
- docs/operations/object.md - docs/operations/object.md
- docs/operations/objectembedding.md - docs/operations/objectembedding.md
- docs/operations/providername.md
- docs/operations/providerresponse.md
- docs/operations/ratelimit.md - docs/operations/ratelimit.md
- docs/operations/sendchatcompletionrequestresponse.md - docs/operations/sendchatcompletionrequestresponse.md
- docs/operations/transferintent.md - docs/operations/transferintent.md
@@ -638,8 +641,11 @@ generatedFiles:
- src/openrouter/beta.py - src/openrouter/beta.py
- src/openrouter/chat.py - src/openrouter/chat.py
- src/openrouter/components/__init__.py - src/openrouter/components/__init__.py
- src/openrouter/components/_schema0.py - src/openrouter/components/_schema10.py
- src/openrouter/components/_schema2.py - src/openrouter/components/_schema14.py
- src/openrouter/components/_schema17.py
- src/openrouter/components/_schema19.py
- src/openrouter/components/_schema5.py
- src/openrouter/components/activityitem.py - src/openrouter/components/activityitem.py
- src/openrouter/components/assistantmessage.py - src/openrouter/components/assistantmessage.py
- src/openrouter/components/badgatewayresponseerrordata.py - src/openrouter/components/badgatewayresponseerrordata.py
@@ -667,6 +673,7 @@ generatedFiles:
- src/openrouter/components/createchargerequest.py - src/openrouter/components/createchargerequest.py
- src/openrouter/components/datacollection.py - src/openrouter/components/datacollection.py
- src/openrouter/components/defaultparameters.py - src/openrouter/components/defaultparameters.py
- src/openrouter/components/developermessage.py
- src/openrouter/components/edgenetworktimeoutresponseerrordata.py - src/openrouter/components/edgenetworktimeoutresponseerrordata.py
- src/openrouter/components/endpointstatus.py - src/openrouter/components/endpointstatus.py
- src/openrouter/components/filecitation.py - src/openrouter/components/filecitation.py
@@ -1001,7 +1008,7 @@ examples:
id: "<id>" id: "<id>"
responses: responses:
"200": "200":
application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto"}} application/json: {"data": {"id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "total_cost": 0.0015, "cache_discount": 0.0002, "upstream_inference_cost": 0.0012, "created_at": "2024-07-15T23:33:19.433273+00:00", "model": "sao10k/l3-stheno-8b", "app_id": 12345, "streamed": true, "cancelled": false, "provider_name": "Infermatic", "latency": 1250, "moderation_latency": 50, "generation_time": 1200, "finish_reason": "stop", "tokens_prompt": 10, "tokens_completion": 25, "native_tokens_prompt": 10, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_reasoning": 5, "native_tokens_cached": 3, "num_media_prompt": 1, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_search_results": 5, "origin": "https://openrouter.ai/", "usage": 0.0015, "is_byok": false, "native_finish_reason": "stop", "external_user": "user-123", "api_type": "completions", "router": "openrouter/auto", "provider_responses": []}}
"401": "401":
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"402": "402":
+1 -1
View File
@@ -31,7 +31,7 @@ generation:
skipResponseBodyAssertions: false skipResponseBodyAssertions: false
preApplyUnionDiscriminators: true preApplyUnionDiscriminators: true
python: python:
version: 0.2.0 version: 0.4.0
additionalDependencies: additionalDependencies:
dev: {} dev: {}
main: {} main: {}
Executable → Regular
+529 -313
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -8,19 +8,20 @@ sources:
- latest - latest
OpenRouter API: OpenRouter API:
sourceNamespace: open-router-chat-completions-api sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:5ba48c1ff7f13c2c5d9ab558e9ecd4638b65c12dd9c4e0cff7fb337674e94ceb sourceRevisionDigest: sha256:5a70452e80a4866581d37c656017d24be6d65f95748f11f4f1dc0e7e141d2bdb
sourceBlobDigest: sha256:082db9694677b85116bda99811c8b957f96d1c493a3c606643479a65dad79730 sourceBlobDigest: sha256:51b950d5a574b3b01e723aaa5bf02223c33b8ed92f749728653a4a4312d8f7c0
tags: tags:
- latest - latest
- main
- 1.0.0 - 1.0.0
targets: targets:
open-router: open-router:
source: OpenRouter API source: OpenRouter API
sourceNamespace: open-router-chat-completions-api sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:5ba48c1ff7f13c2c5d9ab558e9ecd4638b65c12dd9c4e0cff7fb337674e94ceb sourceRevisionDigest: sha256:5a70452e80a4866581d37c656017d24be6d65f95748f11f4f1dc0e7e141d2bdb
sourceBlobDigest: sha256:082db9694677b85116bda99811c8b957f96d1c493a3c606643479a65dad79730 sourceBlobDigest: sha256:51b950d5a574b3b01e723aaa5bf02223c33b8ed92f749728653a4a4312d8f7c0
codeSamplesNamespace: open-router-python-code-samples codeSamplesNamespace: open-router-python-code-samples
codeSamplesRevisionDigest: sha256:bfe86dbe763c7e6164cdcddd56ddda61a8981ca5b5dc0aa7cd97bbbb4a44142a codeSamplesRevisionDigest: sha256:bc0c0939ef451d21d3e6a1d4be4cd452012f2bb1547b25a2eb9f0b89445bf408
workflow: workflow:
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: 1.666.0 speakeasyVersion: 1.666.0
+1 -1
View File
@@ -11,5 +11,5 @@
| `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A | | `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A | | `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A |
| `images` | List[[components.Image](../components/image.md)] | :heavy_minus_sign: | N/A | | `images` | List[[components.Image](../components/image.md)] | :heavy_minus_sign: | N/A |
+4 -4
View File
@@ -4,12 +4,12 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | `provider` | [OptionalNullable[components.Schema0]](../components/schema0.md) | :heavy_minus_sign: | N/A |
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | `plugins` | List[[components.Schema17](../components/schema17.md)] | :heavy_minus_sign: | N/A |
| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A | | `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | | `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A | | `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A |
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | | `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `models` | List[*str*] | :heavy_minus_sign: | N/A | | `models` | List[*str*] | :heavy_minus_sign: | N/A |
@@ -1,14 +0,0 @@
# ChatGenerationParamsMaxPrice
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
## Fields
| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `prompt` | *Optional[Any]* | :heavy_minus_sign: | N/A |
| `completion` | *Optional[Any]* | :heavy_minus_sign: | N/A |
| `image` | *Optional[Any]* | :heavy_minus_sign: | N/A |
| `audio` | *Optional[Any]* | :heavy_minus_sign: | N/A |
| `request` | *Optional[Any]* | :heavy_minus_sign: | N/A |
@@ -1,35 +0,0 @@
# ChatGenerationParamsPluginUnion
## Supported Types
### `components.ChatGenerationParamsPluginAutoRouter`
```python
value: components.ChatGenerationParamsPluginAutoRouter = /* values here */
```
### `components.ChatGenerationParamsPluginModeration`
```python
value: components.ChatGenerationParamsPluginModeration = /* values here */
```
### `components.ChatGenerationParamsPluginWeb`
```python
value: components.ChatGenerationParamsPluginWeb = /* values here */
```
### `components.ChatGenerationParamsPluginFileParser`
```python
value: components.ChatGenerationParamsPluginFileParser = /* values here */
```
### `components.ChatGenerationParamsPluginResponseHealing`
```python
value: components.ChatGenerationParamsPluginResponseHealing = /* values here */
```
@@ -1,17 +0,0 @@
# ChatGenerationParamsPreferredMaxLatencyUnion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `components.ChatGenerationParamsPreferredMaxLatency`
```python
value: components.ChatGenerationParamsPreferredMaxLatency = /* values here */
```
@@ -1,11 +0,0 @@
# ChatGenerationParamsPreferredMinThroughput
## Fields
| Field | Type | Required | Description |
| ------------------------- | ------------------------- | ------------------------- | ------------------------- |
| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
@@ -1,17 +0,0 @@
# ChatGenerationParamsPreferredMinThroughputUnion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `components.ChatGenerationParamsPreferredMinThroughput`
```python
value: components.ChatGenerationParamsPreferredMinThroughput = /* values here */
```
@@ -1,20 +0,0 @@
# ChatGenerationParamsProvider
## Fields
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. |
| `data_collection` | [OptionalNullable[components.ChatGenerationParamsDataCollection]](../components/chatgenerationparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.<br/>- allow: (default) allow providers which store user data non-transiently and may train on it<br/><br/>- deny: use only providers which do not collect user data. |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `order` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. |
| `only` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. |
| `ignore` | List[[components.Schema0](../components/schema0.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. |
| `quantizations` | List[[components.Quantizations](../components/quantizations.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. |
| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. |
| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. |
| `preferred_min_throughput` | [OptionalNullable[components.ChatGenerationParamsPreferredMinThroughputUnion]](../components/chatgenerationparamspreferredminthroughputunion.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. |
| `preferred_max_latency` | [OptionalNullable[components.ChatGenerationParamsPreferredMaxLatencyUnion]](../components/chatgenerationparamspreferredmaxlatencyunion.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. |
+1 -1
View File
@@ -10,4 +10,4 @@
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A | | `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A |
| `reasoning_details` | List[[components.Schema2](../components/schema2.md)] | :heavy_minus_sign: | N/A | | `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A |
+23
View File
@@ -0,0 +1,23 @@
# Completion
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
+10
View File
@@ -0,0 +1,10 @@
# DeveloperMessage
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A |
| `content` | [components.DeveloperMessageContent](../components/developermessagecontent.md) | :heavy_check_mark: | N/A |
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
@@ -1,4 +1,4 @@
# MessageContent # DeveloperMessageContent
## Supported Types ## Supported Types
+2 -2
View File
@@ -15,10 +15,10 @@ value: components.SystemMessage = /* values here */
value: components.UserMessage = /* values here */ value: components.UserMessage = /* values here */
``` ```
### `components.MessageDeveloper` ### `components.DeveloperMessage`
```python ```python
value: components.MessageDeveloper = /* values here */ value: components.DeveloperMessage = /* values here */
``` ```
### `components.AssistantMessage` ### `components.AssistantMessage`
-10
View File
@@ -1,10 +0,0 @@
# MessageDeveloper
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A |
| `content` | [components.MessageContent](../components/messagecontent.md) | :heavy_check_mark: | N/A |
| `name` | *Optional[str]* | :heavy_minus_sign: | N/A |
+2 -2
View File
@@ -37,7 +37,7 @@ Request schema for Responses endpoint
| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | |
| `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | | `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
@@ -6,9 +6,9 @@ The object specifying the maximum price you want to pay for this request. USD pr
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 |
| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
@@ -1,35 +0,0 @@
# OpenResponsesRequestPluginUnion
## Supported Types
### `components.OpenResponsesRequestPluginAutoRouter`
```python
value: components.OpenResponsesRequestPluginAutoRouter = /* values here */
```
### `components.OpenResponsesRequestPluginModeration`
```python
value: components.OpenResponsesRequestPluginModeration = /* values here */
```
### `components.OpenResponsesRequestPluginWeb`
```python
value: components.OpenResponsesRequestPluginWeb = /* values here */
```
### `components.OpenResponsesRequestPluginFileParser`
```python
value: components.OpenResponsesRequestPluginFileParser = /* values here */
```
### `components.OpenResponsesRequestPluginResponseHealing`
```python
value: components.OpenResponsesRequestPluginResponseHealing = /* values here */
```
+35
View File
@@ -0,0 +1,35 @@
# Plugin
## Supported Types
### `components.PluginAutoRouter`
```python
value: components.PluginAutoRouter = /* values here */
```
### `components.PluginModeration`
```python
value: components.PluginModeration = /* values here */
```
### `components.PluginWeb`
```python
value: components.PluginWeb = /* values here */
```
### `components.PluginFileParser`
```python
value: components.PluginFileParser = /* values here */
```
### `components.PluginResponseHealing`
```python
value: components.PluginResponseHealing = /* values here */
```
@@ -1,4 +1,4 @@
# OpenResponsesRequestPluginAutoRouter # PluginAutoRouter
## Fields ## Fields
@@ -1,4 +1,4 @@
# OpenResponsesRequestPluginFileParser # PluginFileParser
## Fields ## Fields
@@ -1,4 +1,4 @@
# OpenResponsesRequestPluginModeration # PluginModeration
## Fields ## Fields
@@ -1,4 +1,4 @@
# OpenResponsesRequestPluginResponseHealing # PluginResponseHealing
## Fields ## Fields
@@ -1,4 +1,4 @@
# OpenResponsesRequestPluginWeb # PluginWeb
## Fields ## Fields
+14 -14
View File
@@ -4,18 +4,18 @@
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | | `prompt` | *str* | :heavy_check_mark: | N/A | 1000 |
| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | | `completion` | *str* | :heavy_check_mark: | N/A | 1000 |
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | | `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
+23
View File
@@ -0,0 +1,23 @@
# Prompt
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,4 +1,4 @@
# OpenResponsesRequestProvider # Provider
When multiple model providers are available, optionally indicate your routing preference. When multiple model providers are available, optionally indicate your routing preference.
+2
View File
@@ -8,6 +8,7 @@
| `AI21` | AI21 | | `AI21` | AI21 |
| `AION_LABS` | AionLabs | | `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba | | `ALIBABA` | Alibaba |
| `AMBIENT` | Ambient |
| `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_BEDROCK` | Amazon Bedrock |
| `AMAZON_NOVA` | Amazon Nova | | `AMAZON_NOVA` | Amazon Nova |
| `ANTHROPIC` | Anthropic | | `ANTHROPIC` | Anthropic |
@@ -64,6 +65,7 @@
| `SEED` | Seed | | `SEED` | Seed |
| `SILICON_FLOW` | SiliconFlow | | `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful | | `SOURCEFUL` | Sourceful |
| `STEP_FUN` | StepFun |
| `STEALTH` | Stealth | | `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake | | `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint | | `SWITCHPOINT` | Switchpoint |
@@ -6,9 +6,9 @@ The object specifying the maximum price you want to pay for this request. USD pr
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `prompt` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 |
| `completion` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
+14 -14
View File
@@ -6,18 +6,18 @@ Pricing information for the model
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | | -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
| `prompt` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | | `prompt` | *str* | :heavy_check_mark: | N/A | 1000 |
| `completion` | *str* | :heavy_check_mark: | A value in string format that is a large number | 1000 | | `completion` | *str* | :heavy_check_mark: | N/A | 1000 |
| `request` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image_token` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image_token` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `image_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `image_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `audio` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `audio_output` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `web_search` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `web_search` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | A value in string format that is a large number | 1000 | | `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 |
| `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | | | `discount` | *Optional[float]* | :heavy_minus_sign: | N/A | |
+16 -13
View File
@@ -1,17 +1,20 @@
# Schema0 # Schema0
## Supported Types ## Fields
### `components.Schema0Enum`
```python
value: components.Schema0Enum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `data_collection` | [OptionalNullable[components.Schema3]](../components/schema3.md) | :heavy_minus_sign: | N/A |
| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
| `order` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A |
| `only` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A |
| `ignore` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A |
| `quantizations` | List[[components.Schema8](../components/schema8.md)] | :heavy_minus_sign: | N/A |
| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | N/A |
| `max_price` | [Optional[components.Schema10]](../components/schema10.md) | :heavy_minus_sign: | N/A |
| `preferred_min_throughput` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A |
| `preferred_max_latency` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A |
+12
View File
@@ -0,0 +1,12 @@
# Schema10
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- |
| `prompt` | [Optional[components.Prompt]](../components/prompt.md) | :heavy_minus_sign: | N/A |
| `completion` | [Optional[components.Completion]](../components/completion.md) | :heavy_minus_sign: | N/A |
| `image` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A |
| `audio` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A |
| `request` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A |
+23
View File
@@ -0,0 +1,23 @@
# Schema14
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `str`
```python
value: str = /* values here */
```
### `Any`
```python
value: Any = /* values here */
```
@@ -1,4 +1,4 @@
# ChatGenerationParamsPreferredMaxLatency # Schema15
## Fields ## Fields
+17
View File
@@ -0,0 +1,17 @@
# Schema15Union
## Supported Types
### `float`
```python
value: float = /* values here */
```
### `components.Schema15`
```python
value: components.Schema15 = /* values here */
```
+35
View File
@@ -0,0 +1,35 @@
# Schema17
## Supported Types
### `components.Schema17AutoRouter`
```python
value: components.Schema17AutoRouter = /* values here */
```
### `components.Schema17Moderation`
```python
value: components.Schema17Moderation = /* values here */
```
### `components.Schema17Web`
```python
value: components.Schema17Web = /* values here */
```
### `components.Schema17FileParser`
```python
value: components.Schema17FileParser = /* values here */
```
### `components.Schema17ResponseHealing`
```python
value: components.Schema17ResponseHealing = /* values here */
```
@@ -1,4 +1,4 @@
# ChatGenerationParamsPluginAutoRouter # Schema17AutoRouter
## Fields ## Fields
@@ -1,4 +1,4 @@
# ChatGenerationParamsPluginFileParser # Schema17FileParser
## Fields ## Fields
@@ -1,4 +1,4 @@
# ChatGenerationParamsPluginModeration # Schema17Moderation
## Fields ## Fields
@@ -1,4 +1,4 @@
# ChatGenerationParamsPluginResponseHealing # Schema17ResponseHealing
## Fields ## Fields
@@ -1,4 +1,4 @@
# ChatGenerationParamsPluginWeb # Schema17Web
## Fields ## Fields
+23
View File
@@ -0,0 +1,23 @@
# Schema19
## Supported Types
### `components.Schema19ReasoningSummary`
```python
value: components.Schema19ReasoningSummary = /* values here */
```
### `components.Schema19ReasoningEncrypted`
```python
value: components.Schema19ReasoningEncrypted = /* values here */
```
### `components.Schema19ReasoningText`
```python
value: components.Schema19ReasoningText = /* values here */
```
@@ -0,0 +1,12 @@
# Schema19ReasoningEncrypted
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A |
| `data` | *str* | :heavy_check_mark: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
@@ -0,0 +1,12 @@
# Schema19ReasoningSummary
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A |
| `summary` | *str* | :heavy_check_mark: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
+13
View File
@@ -0,0 +1,13 @@
# Schema19ReasoningText
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A |
| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
-23
View File
@@ -1,23 +0,0 @@
# Schema2
## Supported Types
### `components.Schema2ReasoningSummary`
```python
value: components.Schema2ReasoningSummary = /* values here */
```
### `components.Schema2ReasoningEncrypted`
```python
value: components.Schema2ReasoningEncrypted = /* values here */
```
### `components.Schema2ReasoningText`
```python
value: components.Schema2ReasoningText = /* values here */
```
@@ -1,4 +1,4 @@
# Schema4 # Schema21
## Values ## Values
@@ -1,12 +0,0 @@
# Schema2ReasoningEncrypted
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A |
| `data` | *str* | :heavy_check_mark: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
@@ -1,12 +0,0 @@
# Schema2ReasoningSummary
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A |
| `summary` | *str* | :heavy_check_mark: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
-13
View File
@@ -1,13 +0,0 @@
# Schema2ReasoningText
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A |
| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
| `format_` | [OptionalNullable[components.Schema4]](../components/schema4.md) | :heavy_minus_sign: | N/A |
| `index` | *Optional[float]* | :heavy_minus_sign: | N/A |
@@ -1,4 +1,4 @@
# ChatGenerationParamsDataCollection # Schema3
## Values ## Values
+17
View File
@@ -0,0 +1,17 @@
# Schema5
## Supported Types
### `components.Schema5Enum`
```python
value: components.Schema5Enum = /* values here */
```
### `str`
```python
value: str = /* values here */
```
@@ -1,4 +1,4 @@
# Schema0Enum # Schema5Enum
## Values ## Values
@@ -8,6 +8,7 @@
| `AI21` | AI21 | | `AI21` | AI21 |
| `AION_LABS` | AionLabs | | `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba | | `ALIBABA` | Alibaba |
| `AMBIENT` | Ambient |
| `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_BEDROCK` | Amazon Bedrock |
| `AMAZON_NOVA` | Amazon Nova | | `AMAZON_NOVA` | Amazon Nova |
| `ANTHROPIC` | Anthropic | | `ANTHROPIC` | Anthropic |
@@ -64,6 +65,7 @@
| `SEED` | Seed | | `SEED` | Seed |
| `SILICON_FLOW` | SiliconFlow | | `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful | | `SOURCEFUL` | Sourceful |
| `STEP_FUN` | StepFun |
| `STEALTH` | Stealth | | `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake | | `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint | | `SWITCHPOINT` | Switchpoint |
@@ -1,4 +1,4 @@
# Quantizations # Schema8
## Values ## Values
+2 -1
View File
@@ -6,7 +6,7 @@ Generation data
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | | `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG |
| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 | | `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 |
| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 | | `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 |
@@ -40,3 +40,4 @@ Generation data
| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | | `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 |
| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | | | `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | |
| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto | | `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto |
| `provider_responses` | List[[operations.ProviderResponse](../operations/providerresponse.md)] | :heavy_check_mark: | List of provider responses for this generation, including fallback attempts | |
+107
View File
@@ -0,0 +1,107 @@
# ProviderName
## Values
| Name | Value |
| ------------------- | ------------------- |
| `ANY_SCALE` | AnyScale |
| `ATOMA` | Atoma |
| `CENT_ML` | Cent-ML |
| `CROF_AI` | CrofAI |
| `ENFER` | Enfer |
| `GO_POMELO` | GoPomelo |
| `HUGGING_FACE` | HuggingFace |
| `HYPERBOLIC_2` | Hyperbolic 2 |
| `INO_CLOUD` | InoCloud |
| `KLUSTER` | Kluster |
| `LAMBDA` | Lambda |
| `LEPTON` | Lepton |
| `LYNN_2` | Lynn 2 |
| `LYNN` | Lynn |
| `MANCER` | Mancer |
| `META` | Meta |
| `MODAL` | Modal |
| `NINETEEN` | Nineteen |
| `OCTO_AI` | OctoAI |
| `RECURSAL` | Recursal |
| `REFLECTION` | Reflection |
| `REPLICATE` | Replicate |
| `SAMBA_NOVA_2` | SambaNova 2 |
| `SF_COMPUTE` | SF Compute |
| `TARGON` | Targon |
| `TOGETHER_2` | Together 2 |
| `UBICLOUD` | Ubicloud |
| `ONE_DOT_AI` | 01.AI |
| `AI21` | AI21 |
| `AION_LABS` | AionLabs |
| `ALIBABA` | Alibaba |
| `AMBIENT` | Ambient |
| `AMAZON_BEDROCK` | Amazon Bedrock |
| `AMAZON_NOVA` | Amazon Nova |
| `ANTHROPIC` | Anthropic |
| `ARCEE_AI` | Arcee AI |
| `ATLAS_CLOUD` | AtlasCloud |
| `AVIAN` | Avian |
| `AZURE` | Azure |
| `BASE_TEN` | BaseTen |
| `BYTE_PLUS` | BytePlus |
| `BLACK_FOREST_LABS` | Black Forest Labs |
| `CEREBRAS` | Cerebras |
| `CHUTES` | Chutes |
| `CIRRASCALE` | Cirrascale |
| `CLARIFAI` | Clarifai |
| `CLOUDFLARE` | Cloudflare |
| `COHERE` | Cohere |
| `CRUSOE` | Crusoe |
| `DEEP_INFRA` | DeepInfra |
| `DEEP_SEEK` | DeepSeek |
| `FEATHERLESS` | Featherless |
| `FIREWORKS` | Fireworks |
| `FRIENDLI` | Friendli |
| `GMI_CLOUD` | GMICloud |
| `GOOGLE` | Google |
| `GOOGLE_AI_STUDIO` | Google AI Studio |
| `GROQ` | Groq |
| `HYPERBOLIC` | Hyperbolic |
| `INCEPTION` | Inception |
| `INCEPTRON` | Inceptron |
| `INFERENCE_NET` | InferenceNet |
| `INFERMATIC` | Infermatic |
| `INFLECTION` | Inflection |
| `LIQUID` | Liquid |
| `MARA` | Mara |
| `MANCER_2` | Mancer 2 |
| `MINIMAX` | Minimax |
| `MODEL_RUN` | ModelRun |
| `MISTRAL` | Mistral |
| `MODULAR` | Modular |
| `MOONSHOT_AI` | Moonshot AI |
| `MORPH` | Morph |
| `N_COMPASS` | NCompass |
| `NEBIUS` | Nebius |
| `NEXT_BIT` | NextBit |
| `NOVITA` | Novita |
| `NVIDIA` | Nvidia |
| `OPEN_AI` | OpenAI |
| `OPEN_INFERENCE` | OpenInference |
| `PARASAIL` | Parasail |
| `PERPLEXITY` | Perplexity |
| `PHALA` | Phala |
| `RELACE` | Relace |
| `SAMBA_NOVA` | SambaNova |
| `SEED` | Seed |
| `SILICON_FLOW` | SiliconFlow |
| `SOURCEFUL` | Sourceful |
| `STEP_FUN` | StepFun |
| `STEALTH` | Stealth |
| `STREAM_LAKE` | StreamLake |
| `SWITCHPOINT` | Switchpoint |
| `TOGETHER` | Together |
| `UPSTAGE` | Upstage |
| `VENICE` | Venice |
| `WAND_B` | WandB |
| `XIAOMI` | Xiaomi |
| `X_AI` | xAI |
| `Z_AI` | Z.AI |
| `FAKE_PROVIDER` | FakeProvider |
+14
View File
@@ -0,0 +1,14 @@
# ProviderResponse
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `endpoint_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `model_permaslug` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `provider_name` | [Optional[operations.ProviderName]](../operations/providername.md) | :heavy_minus_sign: | N/A |
| `status` | *Nullable[float]* | :heavy_check_mark: | N/A |
| `latency` | *Optional[float]* | :heavy_minus_sign: | N/A |
| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | N/A |
+4 -4
View File
@@ -35,13 +35,13 @@ with OpenRouter(
### Parameters ### Parameters
| Parameter | Type | Required | Description | | Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A | | `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A |
| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | `provider` | [OptionalNullable[components.Schema0]](../../components/schema0.md) | :heavy_minus_sign: | N/A |
| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | `plugins` | List[[components.Schema17](../../components/schema17.md)] | :heavy_minus_sign: | N/A |
| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A | | `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A |
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | | `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | | `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `models` | List[*str*] | :heavy_minus_sign: | N/A | | `models` | List[*str*] | :heavy_minus_sign: | N/A |
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
+2 -2
View File
@@ -67,8 +67,8 @@ with OpenRouter(
| `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | |
| `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | | `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "openrouter" name = "openrouter"
version = "0.2.0" version = "0.4.0"
description = "Official Python Client SDK for OpenRouter." description = "Official Python Client SDK for OpenRouter."
authors = [{ name = "OpenRouter" },] authors = [{ name = "OpenRouter" },]
readme = "README-PYPI.md" readme = "README-PYPI.md"
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata import importlib.metadata
__title__: str = "openrouter" __title__: str = "openrouter"
__version__: str = "0.2.0" __version__: str = "0.4.0"
__openapi_doc_version__: str = "1.0.0" __openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0" __gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.2.0 2.768.0 1.0.0 openrouter" __user_agent__: str = "speakeasy-sdk/python 0.4.0 2.768.0 1.0.0 openrouter"
try: try:
if __package__ is not None: if __package__ is not None:
+34 -70
View File
@@ -22,16 +22,10 @@ class Chat(BaseSDK):
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Schema0, components.Schema0TypedDict]
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Schema17], List[components.Schema17TypedDict]]
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.Route] = UNSET, route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
@@ -87,11 +81,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider:
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins:
:param route: :param route:
:param user: :param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. :param session_id:
:param model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -128,16 +122,10 @@ class Chat(BaseSDK):
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Schema0, components.Schema0TypedDict]
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Schema17], List[components.Schema17TypedDict]]
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.Route] = UNSET, route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
@@ -193,11 +181,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider:
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins:
:param route: :param route:
:param user: :param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. :param session_id:
:param model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -233,16 +221,10 @@ class Chat(BaseSDK):
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Schema0, components.Schema0TypedDict]
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Schema17], List[components.Schema17TypedDict]]
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.Route] = UNSET, route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
@@ -298,11 +280,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider:
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins:
:param route: :param route:
:param user: :param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. :param session_id:
:param model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -344,10 +326,10 @@ class Chat(BaseSDK):
request = components.ChatGenerationParams( request = components.ChatGenerationParams(
provider=utils.get_pydantic_model( provider=utils.get_pydantic_model(
provider, OptionalNullable[components.ChatGenerationParamsProvider] provider, OptionalNullable[components.Schema0]
), ),
plugins=utils.get_pydantic_model( plugins=utils.get_pydantic_model(
plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] plugins, Optional[List[components.Schema17]]
), ),
route=route, route=route,
user=user, user=user,
@@ -479,16 +461,10 @@ class Chat(BaseSDK):
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Schema0, components.Schema0TypedDict]
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Schema17], List[components.Schema17TypedDict]]
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.Route] = UNSET, route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
@@ -544,11 +520,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider:
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins:
:param route: :param route:
:param user: :param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. :param session_id:
:param model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -585,16 +561,10 @@ class Chat(BaseSDK):
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Schema0, components.Schema0TypedDict]
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Schema17], List[components.Schema17TypedDict]]
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.Route] = UNSET, route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
@@ -650,11 +620,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider:
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins:
:param route: :param route:
:param user: :param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. :param session_id:
:param model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -690,16 +660,10 @@ class Chat(BaseSDK):
*, *,
messages: Union[List[components.Message], List[components.MessageTypedDict]], messages: Union[List[components.Message], List[components.MessageTypedDict]],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Schema0, components.Schema0TypedDict]
components.ChatGenerationParamsProvider,
components.ChatGenerationParamsProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Schema17], List[components.Schema17TypedDict]]
List[components.ChatGenerationParamsPluginUnion],
List[components.ChatGenerationParamsPluginUnionTypedDict],
]
] = None, ] = None,
route: OptionalNullable[components.Route] = UNSET, route: OptionalNullable[components.Route] = UNSET,
user: Optional[str] = None, user: Optional[str] = None,
@@ -755,11 +719,11 @@ class Chat(BaseSDK):
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
:param messages: :param messages:
:param provider: When multiple model providers are available, optionally indicate your routing preference. :param provider:
:param plugins: Plugins you want to enable for this request, including their settings. :param plugins:
:param route: :param route:
:param user: :param user:
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. :param session_id:
:param model: :param model:
:param models: :param models:
:param frequency_penalty: :param frequency_penalty:
@@ -801,10 +765,10 @@ class Chat(BaseSDK):
request = components.ChatGenerationParams( request = components.ChatGenerationParams(
provider=utils.get_pydantic_model( provider=utils.get_pydantic_model(
provider, OptionalNullable[components.ChatGenerationParamsProvider] provider, OptionalNullable[components.Schema0]
), ),
plugins=utils.get_pydantic_model( plugins=utils.get_pydantic_model(
plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] plugins, Optional[List[components.Schema17]]
), ),
route=route, route=route,
user=user, user=user,
+185 -177
View File
@@ -6,18 +6,45 @@ import builtins
import sys import sys
if TYPE_CHECKING: if TYPE_CHECKING:
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict from ._schema10 import (
from ._schema2 import ( Completion,
Schema2, CompletionTypedDict,
Schema2ReasoningEncrypted, Prompt,
Schema2ReasoningEncryptedTypedDict, PromptTypedDict,
Schema2ReasoningSummary, Schema10,
Schema2ReasoningSummaryTypedDict, Schema10TypedDict,
Schema2ReasoningText,
Schema2ReasoningTextTypedDict,
Schema2TypedDict,
Schema4,
) )
from ._schema14 import Schema14, Schema14TypedDict
from ._schema17 import (
Engine,
Pdf,
PdfEngine,
PdfTypedDict,
Schema17,
Schema17AutoRouter,
Schema17AutoRouterTypedDict,
Schema17FileParser,
Schema17FileParserTypedDict,
Schema17Moderation,
Schema17ModerationTypedDict,
Schema17ResponseHealing,
Schema17ResponseHealingTypedDict,
Schema17TypedDict,
Schema17Web,
Schema17WebTypedDict,
)
from ._schema19 import (
Schema19,
Schema19ReasoningEncrypted,
Schema19ReasoningEncryptedTypedDict,
Schema19ReasoningSummary,
Schema19ReasoningSummaryTypedDict,
Schema19ReasoningText,
Schema19ReasoningTextTypedDict,
Schema19TypedDict,
Schema21,
)
from ._schema5 import Schema5, Schema5Enum, Schema5TypedDict
from .activityitem import ActivityItem, ActivityItemTypedDict from .activityitem import ActivityItem, ActivityItemTypedDict
from .assistantmessage import ( from .assistantmessage import (
AssistantMessage, AssistantMessage,
@@ -41,43 +68,13 @@ if TYPE_CHECKING:
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
from .chatgenerationparams import ( from .chatgenerationparams import (
ChatGenerationParams, ChatGenerationParams,
ChatGenerationParamsDataCollection,
ChatGenerationParamsImageConfig, ChatGenerationParamsImageConfig,
ChatGenerationParamsImageConfigTypedDict, ChatGenerationParamsImageConfigTypedDict,
ChatGenerationParamsMaxPrice,
ChatGenerationParamsMaxPriceTypedDict,
ChatGenerationParamsPluginAutoRouter,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParser,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginModeration,
ChatGenerationParamsPluginModerationTypedDict,
ChatGenerationParamsPluginResponseHealing,
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginUnion,
ChatGenerationParamsPluginUnionTypedDict,
ChatGenerationParamsPluginWeb,
ChatGenerationParamsPluginWebTypedDict,
ChatGenerationParamsPreferredMaxLatency,
ChatGenerationParamsPreferredMaxLatencyTypedDict,
ChatGenerationParamsPreferredMaxLatencyUnion,
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict,
ChatGenerationParamsPreferredMinThroughput,
ChatGenerationParamsPreferredMinThroughputTypedDict,
ChatGenerationParamsPreferredMinThroughputUnion,
ChatGenerationParamsPreferredMinThroughputUnionTypedDict,
ChatGenerationParamsProvider,
ChatGenerationParamsProviderTypedDict,
ChatGenerationParamsTypedDict, ChatGenerationParamsTypedDict,
Debug, Debug,
DebugTypedDict, DebugTypedDict,
Effort, Effort,
Engine,
Modality, Modality,
Pdf,
PdfEngine,
PdfTypedDict,
Quantizations,
Reasoning, Reasoning,
ReasoningTypedDict, ReasoningTypedDict,
ResponseFormat, ResponseFormat,
@@ -89,6 +86,14 @@ if TYPE_CHECKING:
ResponseFormatTextTypedDict, ResponseFormatTextTypedDict,
ResponseFormatTypedDict, ResponseFormatTypedDict,
Route, Route,
Schema0,
Schema0TypedDict,
Schema15,
Schema15TypedDict,
Schema15Union,
Schema15UnionTypedDict,
Schema3,
Schema8,
Stop, Stop,
StopTypedDict, StopTypedDict,
) )
@@ -184,6 +189,12 @@ if TYPE_CHECKING:
) )
from .datacollection import DataCollection from .datacollection import DataCollection
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
from .developermessage import (
DeveloperMessage,
DeveloperMessageContent,
DeveloperMessageContentTypedDict,
DeveloperMessageTypedDict,
)
from .edgenetworktimeoutresponseerrordata import ( from .edgenetworktimeoutresponseerrordata import (
EdgeNetworkTimeoutResponseErrorData, EdgeNetworkTimeoutResponseErrorData,
EdgeNetworkTimeoutResponseErrorDataTypedDict, EdgeNetworkTimeoutResponseErrorDataTypedDict,
@@ -210,14 +221,7 @@ if TYPE_CHECKING:
ListEndpointsResponseTypedDict, ListEndpointsResponseTypedDict,
Tokenizer, Tokenizer,
) )
from .message import ( from .message import Message, MessageTypedDict
Message,
MessageContent,
MessageContentTypedDict,
MessageDeveloper,
MessageDeveloperTypedDict,
MessageTypedDict,
)
from .model import Model, ModelTypedDict from .model import Model, ModelTypedDict
from .modelarchitecture import ( from .modelarchitecture import (
ModelArchitecture, ModelArchitecture,
@@ -469,20 +473,6 @@ if TYPE_CHECKING:
OpenResponsesRequestOnlyTypedDict, OpenResponsesRequestOnlyTypedDict,
OpenResponsesRequestOrder, OpenResponsesRequestOrder,
OpenResponsesRequestOrderTypedDict, OpenResponsesRequestOrderTypedDict,
OpenResponsesRequestPluginAutoRouter,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParser,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginModeration,
OpenResponsesRequestPluginModerationTypedDict,
OpenResponsesRequestPluginResponseHealing,
OpenResponsesRequestPluginResponseHealingTypedDict,
OpenResponsesRequestPluginUnion,
OpenResponsesRequestPluginUnionTypedDict,
OpenResponsesRequestPluginWeb,
OpenResponsesRequestPluginWebTypedDict,
OpenResponsesRequestProvider,
OpenResponsesRequestProviderTypedDict,
OpenResponsesRequestSort, OpenResponsesRequestSort,
OpenResponsesRequestSortTypedDict, OpenResponsesRequestSortTypedDict,
OpenResponsesRequestToolFunction, OpenResponsesRequestToolFunction,
@@ -491,6 +481,20 @@ if TYPE_CHECKING:
OpenResponsesRequestToolUnionTypedDict, OpenResponsesRequestToolUnionTypedDict,
OpenResponsesRequestType, OpenResponsesRequestType,
OpenResponsesRequestTypedDict, OpenResponsesRequestTypedDict,
Plugin,
PluginAutoRouter,
PluginAutoRouterTypedDict,
PluginFileParser,
PluginFileParserTypedDict,
PluginModeration,
PluginModerationTypedDict,
PluginResponseHealing,
PluginResponseHealingTypedDict,
PluginTypedDict,
PluginWeb,
PluginWebTypedDict,
Provider,
ProviderTypedDict,
ServiceTier, ServiceTier,
Truncation, Truncation,
) )
@@ -903,33 +907,8 @@ __all__ = [
"ChatErrorError", "ChatErrorError",
"ChatErrorErrorTypedDict", "ChatErrorErrorTypedDict",
"ChatGenerationParams", "ChatGenerationParams",
"ChatGenerationParamsDataCollection",
"ChatGenerationParamsImageConfig", "ChatGenerationParamsImageConfig",
"ChatGenerationParamsImageConfigTypedDict", "ChatGenerationParamsImageConfigTypedDict",
"ChatGenerationParamsMaxPrice",
"ChatGenerationParamsMaxPriceTypedDict",
"ChatGenerationParamsPluginAutoRouter",
"ChatGenerationParamsPluginAutoRouterTypedDict",
"ChatGenerationParamsPluginFileParser",
"ChatGenerationParamsPluginFileParserTypedDict",
"ChatGenerationParamsPluginModeration",
"ChatGenerationParamsPluginModerationTypedDict",
"ChatGenerationParamsPluginResponseHealing",
"ChatGenerationParamsPluginResponseHealingTypedDict",
"ChatGenerationParamsPluginUnion",
"ChatGenerationParamsPluginUnionTypedDict",
"ChatGenerationParamsPluginWeb",
"ChatGenerationParamsPluginWebTypedDict",
"ChatGenerationParamsPreferredMaxLatency",
"ChatGenerationParamsPreferredMaxLatencyTypedDict",
"ChatGenerationParamsPreferredMaxLatencyUnion",
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
"ChatGenerationParamsPreferredMinThroughput",
"ChatGenerationParamsPreferredMinThroughputTypedDict",
"ChatGenerationParamsPreferredMinThroughputUnion",
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
"ChatGenerationParamsProvider",
"ChatGenerationParamsProviderTypedDict",
"ChatGenerationParamsTypedDict", "ChatGenerationParamsTypedDict",
"ChatGenerationTokenUsage", "ChatGenerationTokenUsage",
"ChatGenerationTokenUsageTypedDict", "ChatGenerationTokenUsageTypedDict",
@@ -988,8 +967,10 @@ __all__ = [
"Code", "Code",
"CodeEnum", "CodeEnum",
"CodeTypedDict", "CodeTypedDict",
"Completion",
"CompletionTokensDetails", "CompletionTokensDetails",
"CompletionTokensDetailsTypedDict", "CompletionTokensDetailsTypedDict",
"CompletionTypedDict",
"CostDetails", "CostDetails",
"CostDetailsTypedDict", "CostDetailsTypedDict",
"CreateChargeRequest", "CreateChargeRequest",
@@ -999,6 +980,10 @@ __all__ = [
"DebugTypedDict", "DebugTypedDict",
"DefaultParameters", "DefaultParameters",
"DefaultParametersTypedDict", "DefaultParametersTypedDict",
"DeveloperMessage",
"DeveloperMessageContent",
"DeveloperMessageContentTypedDict",
"DeveloperMessageTypedDict",
"EdgeNetworkTimeoutResponseErrorData", "EdgeNetworkTimeoutResponseErrorData",
"EdgeNetworkTimeoutResponseErrorDataTypedDict", "EdgeNetworkTimeoutResponseErrorDataTypedDict",
"Effort", "Effort",
@@ -1033,10 +1018,6 @@ __all__ = [
"Logprob", "Logprob",
"LogprobTypedDict", "LogprobTypedDict",
"Message", "Message",
"MessageContent",
"MessageContentTypedDict",
"MessageDeveloper",
"MessageDeveloperTypedDict",
"MessageTypedDict", "MessageTypedDict",
"Modality", "Modality",
"Model", "Model",
@@ -1221,20 +1202,6 @@ __all__ = [
"OpenResponsesRequestOnlyTypedDict", "OpenResponsesRequestOnlyTypedDict",
"OpenResponsesRequestOrder", "OpenResponsesRequestOrder",
"OpenResponsesRequestOrderTypedDict", "OpenResponsesRequestOrderTypedDict",
"OpenResponsesRequestPluginAutoRouter",
"OpenResponsesRequestPluginAutoRouterTypedDict",
"OpenResponsesRequestPluginFileParser",
"OpenResponsesRequestPluginFileParserTypedDict",
"OpenResponsesRequestPluginModeration",
"OpenResponsesRequestPluginModerationTypedDict",
"OpenResponsesRequestPluginResponseHealing",
"OpenResponsesRequestPluginResponseHealingTypedDict",
"OpenResponsesRequestPluginUnion",
"OpenResponsesRequestPluginUnionTypedDict",
"OpenResponsesRequestPluginWeb",
"OpenResponsesRequestPluginWebTypedDict",
"OpenResponsesRequestProvider",
"OpenResponsesRequestProviderTypedDict",
"OpenResponsesRequestSort", "OpenResponsesRequestSort",
"OpenResponsesRequestSortTypedDict", "OpenResponsesRequestSortTypedDict",
"OpenResponsesRequestToolFunction", "OpenResponsesRequestToolFunction",
@@ -1343,14 +1310,29 @@ __all__ = [
"PercentileStatsTypedDict", "PercentileStatsTypedDict",
"PercentileThroughputCutoffs", "PercentileThroughputCutoffs",
"PercentileThroughputCutoffsTypedDict", "PercentileThroughputCutoffsTypedDict",
"Plugin",
"PluginAutoRouter",
"PluginAutoRouterTypedDict",
"PluginFileParser",
"PluginFileParserTypedDict",
"PluginModeration",
"PluginModerationTypedDict",
"PluginResponseHealing",
"PluginResponseHealingTypedDict",
"PluginTypedDict",
"PluginWeb",
"PluginWebTypedDict",
"PreferredMaxLatency", "PreferredMaxLatency",
"PreferredMaxLatencyTypedDict", "PreferredMaxLatencyTypedDict",
"PreferredMinThroughput", "PreferredMinThroughput",
"PreferredMinThroughputTypedDict", "PreferredMinThroughputTypedDict",
"Pricing", "Pricing",
"PricingTypedDict", "PricingTypedDict",
"Prompt",
"PromptTokensDetails", "PromptTokensDetails",
"PromptTokensDetailsTypedDict", "PromptTokensDetailsTypedDict",
"PromptTypedDict",
"Provider",
"ProviderName", "ProviderName",
"ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorData",
"ProviderOverloadedResponseErrorDataTypedDict", "ProviderOverloadedResponseErrorDataTypedDict",
@@ -1378,13 +1360,13 @@ __all__ = [
"ProviderSortConfigUnionTypedDict", "ProviderSortConfigUnionTypedDict",
"ProviderSortUnion", "ProviderSortUnion",
"ProviderSortUnionTypedDict", "ProviderSortUnionTypedDict",
"ProviderTypedDict",
"PublicEndpoint", "PublicEndpoint",
"PublicEndpointQuantization", "PublicEndpointQuantization",
"PublicEndpointTypedDict", "PublicEndpointTypedDict",
"PublicPricing", "PublicPricing",
"PublicPricingTypedDict", "PublicPricingTypedDict",
"Quantization", "Quantization",
"Quantizations",
"Reason", "Reason",
"Reasoning", "Reasoning",
"ReasoningSummaryText", "ReasoningSummaryText",
@@ -1495,17 +1477,41 @@ __all__ = [
"ResponsesWebSearchUserLocationTypedDict", "ResponsesWebSearchUserLocationTypedDict",
"Route", "Route",
"Schema0", "Schema0",
"Schema0Enum",
"Schema0TypedDict", "Schema0TypedDict",
"Schema2", "Schema10",
"Schema2ReasoningEncrypted", "Schema10TypedDict",
"Schema2ReasoningEncryptedTypedDict", "Schema14",
"Schema2ReasoningSummary", "Schema14TypedDict",
"Schema2ReasoningSummaryTypedDict", "Schema15",
"Schema2ReasoningText", "Schema15TypedDict",
"Schema2ReasoningTextTypedDict", "Schema15Union",
"Schema2TypedDict", "Schema15UnionTypedDict",
"Schema4", "Schema17",
"Schema17AutoRouter",
"Schema17AutoRouterTypedDict",
"Schema17FileParser",
"Schema17FileParserTypedDict",
"Schema17Moderation",
"Schema17ModerationTypedDict",
"Schema17ResponseHealing",
"Schema17ResponseHealingTypedDict",
"Schema17TypedDict",
"Schema17Web",
"Schema17WebTypedDict",
"Schema19",
"Schema19ReasoningEncrypted",
"Schema19ReasoningEncryptedTypedDict",
"Schema19ReasoningSummary",
"Schema19ReasoningSummaryTypedDict",
"Schema19ReasoningText",
"Schema19ReasoningTextTypedDict",
"Schema19TypedDict",
"Schema21",
"Schema3",
"Schema5",
"Schema5Enum",
"Schema5TypedDict",
"Schema8",
"Security", "Security",
"SecurityTypedDict", "SecurityTypedDict",
"ServiceTier", "ServiceTier",
@@ -1578,18 +1584,42 @@ __all__ = [
] ]
_dynamic_imports: dict[str, str] = { _dynamic_imports: dict[str, str] = {
"Schema0": "._schema0", "Completion": "._schema10",
"Schema0Enum": "._schema0", "CompletionTypedDict": "._schema10",
"Schema0TypedDict": "._schema0", "Prompt": "._schema10",
"Schema2": "._schema2", "PromptTypedDict": "._schema10",
"Schema2ReasoningEncrypted": "._schema2", "Schema10": "._schema10",
"Schema2ReasoningEncryptedTypedDict": "._schema2", "Schema10TypedDict": "._schema10",
"Schema2ReasoningSummary": "._schema2", "Schema14": "._schema14",
"Schema2ReasoningSummaryTypedDict": "._schema2", "Schema14TypedDict": "._schema14",
"Schema2ReasoningText": "._schema2", "Engine": "._schema17",
"Schema2ReasoningTextTypedDict": "._schema2", "Pdf": "._schema17",
"Schema2TypedDict": "._schema2", "PdfEngine": "._schema17",
"Schema4": "._schema2", "PdfTypedDict": "._schema17",
"Schema17": "._schema17",
"Schema17AutoRouter": "._schema17",
"Schema17AutoRouterTypedDict": "._schema17",
"Schema17FileParser": "._schema17",
"Schema17FileParserTypedDict": "._schema17",
"Schema17Moderation": "._schema17",
"Schema17ModerationTypedDict": "._schema17",
"Schema17ResponseHealing": "._schema17",
"Schema17ResponseHealingTypedDict": "._schema17",
"Schema17TypedDict": "._schema17",
"Schema17Web": "._schema17",
"Schema17WebTypedDict": "._schema17",
"Schema19": "._schema19",
"Schema19ReasoningEncrypted": "._schema19",
"Schema19ReasoningEncryptedTypedDict": "._schema19",
"Schema19ReasoningSummary": "._schema19",
"Schema19ReasoningSummaryTypedDict": "._schema19",
"Schema19ReasoningText": "._schema19",
"Schema19ReasoningTextTypedDict": "._schema19",
"Schema19TypedDict": "._schema19",
"Schema21": "._schema19",
"Schema5": "._schema5",
"Schema5Enum": "._schema5",
"Schema5TypedDict": "._schema5",
"ActivityItem": ".activityitem", "ActivityItem": ".activityitem",
"ActivityItemTypedDict": ".activityitem", "ActivityItemTypedDict": ".activityitem",
"AssistantMessage": ".assistantmessage", "AssistantMessage": ".assistantmessage",
@@ -1610,43 +1640,13 @@ _dynamic_imports: dict[str, str] = {
"Code": ".chaterror", "Code": ".chaterror",
"CodeTypedDict": ".chaterror", "CodeTypedDict": ".chaterror",
"ChatGenerationParams": ".chatgenerationparams", "ChatGenerationParams": ".chatgenerationparams",
"ChatGenerationParamsDataCollection": ".chatgenerationparams",
"ChatGenerationParamsImageConfig": ".chatgenerationparams", "ChatGenerationParamsImageConfig": ".chatgenerationparams",
"ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams", "ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams",
"ChatGenerationParamsMaxPrice": ".chatgenerationparams",
"ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
"ChatGenerationParamsPluginModerationTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginResponseHealing": ".chatgenerationparams",
"ChatGenerationParamsPluginResponseHealingTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginUnion": ".chatgenerationparams",
"ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginWeb": ".chatgenerationparams",
"ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatency": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyUnion": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughput": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputUnion": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsProvider": ".chatgenerationparams",
"ChatGenerationParamsProviderTypedDict": ".chatgenerationparams",
"ChatGenerationParamsTypedDict": ".chatgenerationparams", "ChatGenerationParamsTypedDict": ".chatgenerationparams",
"Debug": ".chatgenerationparams", "Debug": ".chatgenerationparams",
"DebugTypedDict": ".chatgenerationparams", "DebugTypedDict": ".chatgenerationparams",
"Effort": ".chatgenerationparams", "Effort": ".chatgenerationparams",
"Engine": ".chatgenerationparams",
"Modality": ".chatgenerationparams", "Modality": ".chatgenerationparams",
"Pdf": ".chatgenerationparams",
"PdfEngine": ".chatgenerationparams",
"PdfTypedDict": ".chatgenerationparams",
"Quantizations": ".chatgenerationparams",
"Reasoning": ".chatgenerationparams", "Reasoning": ".chatgenerationparams",
"ReasoningTypedDict": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams",
"ResponseFormat": ".chatgenerationparams", "ResponseFormat": ".chatgenerationparams",
@@ -1658,6 +1658,14 @@ _dynamic_imports: dict[str, str] = {
"ResponseFormatTextTypedDict": ".chatgenerationparams", "ResponseFormatTextTypedDict": ".chatgenerationparams",
"ResponseFormatTypedDict": ".chatgenerationparams", "ResponseFormatTypedDict": ".chatgenerationparams",
"Route": ".chatgenerationparams", "Route": ".chatgenerationparams",
"Schema0": ".chatgenerationparams",
"Schema0TypedDict": ".chatgenerationparams",
"Schema15": ".chatgenerationparams",
"Schema15TypedDict": ".chatgenerationparams",
"Schema15Union": ".chatgenerationparams",
"Schema15UnionTypedDict": ".chatgenerationparams",
"Schema3": ".chatgenerationparams",
"Schema8": ".chatgenerationparams",
"Stop": ".chatgenerationparams", "Stop": ".chatgenerationparams",
"StopTypedDict": ".chatgenerationparams", "StopTypedDict": ".chatgenerationparams",
"ChatGenerationTokenUsage": ".chatgenerationtokenusage", "ChatGenerationTokenUsage": ".chatgenerationtokenusage",
@@ -1729,6 +1737,10 @@ _dynamic_imports: dict[str, str] = {
"DataCollection": ".datacollection", "DataCollection": ".datacollection",
"DefaultParameters": ".defaultparameters", "DefaultParameters": ".defaultparameters",
"DefaultParametersTypedDict": ".defaultparameters", "DefaultParametersTypedDict": ".defaultparameters",
"DeveloperMessage": ".developermessage",
"DeveloperMessageContent": ".developermessage",
"DeveloperMessageContentTypedDict": ".developermessage",
"DeveloperMessageTypedDict": ".developermessage",
"EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata", "EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata",
"EdgeNetworkTimeoutResponseErrorDataTypedDict": ".edgenetworktimeoutresponseerrordata", "EdgeNetworkTimeoutResponseErrorDataTypedDict": ".edgenetworktimeoutresponseerrordata",
"EndpointStatus": ".endpointstatus", "EndpointStatus": ".endpointstatus",
@@ -1753,10 +1765,6 @@ _dynamic_imports: dict[str, str] = {
"ListEndpointsResponseTypedDict": ".listendpointsresponse", "ListEndpointsResponseTypedDict": ".listendpointsresponse",
"Tokenizer": ".listendpointsresponse", "Tokenizer": ".listendpointsresponse",
"Message": ".message", "Message": ".message",
"MessageContent": ".message",
"MessageContentTypedDict": ".message",
"MessageDeveloper": ".message",
"MessageDeveloperTypedDict": ".message",
"MessageTypedDict": ".message", "MessageTypedDict": ".message",
"Model": ".model", "Model": ".model",
"ModelTypedDict": ".model", "ModelTypedDict": ".model",
@@ -1950,20 +1958,6 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest", "OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest",
"OpenResponsesRequestOrder": ".openresponsesrequest", "OpenResponsesRequestOrder": ".openresponsesrequest",
"OpenResponsesRequestOrderTypedDict": ".openresponsesrequest", "OpenResponsesRequestOrderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParser": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginModeration": ".openresponsesrequest",
"OpenResponsesRequestPluginModerationTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginResponseHealing": ".openresponsesrequest",
"OpenResponsesRequestPluginResponseHealingTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginUnion": ".openresponsesrequest",
"OpenResponsesRequestPluginUnionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginWeb": ".openresponsesrequest",
"OpenResponsesRequestPluginWebTypedDict": ".openresponsesrequest",
"OpenResponsesRequestProvider": ".openresponsesrequest",
"OpenResponsesRequestProviderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestSort": ".openresponsesrequest", "OpenResponsesRequestSort": ".openresponsesrequest",
"OpenResponsesRequestSortTypedDict": ".openresponsesrequest", "OpenResponsesRequestSortTypedDict": ".openresponsesrequest",
"OpenResponsesRequestToolFunction": ".openresponsesrequest", "OpenResponsesRequestToolFunction": ".openresponsesrequest",
@@ -1972,6 +1966,20 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest", "OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestType": ".openresponsesrequest", "OpenResponsesRequestType": ".openresponsesrequest",
"OpenResponsesRequestTypedDict": ".openresponsesrequest", "OpenResponsesRequestTypedDict": ".openresponsesrequest",
"Plugin": ".openresponsesrequest",
"PluginAutoRouter": ".openresponsesrequest",
"PluginAutoRouterTypedDict": ".openresponsesrequest",
"PluginFileParser": ".openresponsesrequest",
"PluginFileParserTypedDict": ".openresponsesrequest",
"PluginModeration": ".openresponsesrequest",
"PluginModerationTypedDict": ".openresponsesrequest",
"PluginResponseHealing": ".openresponsesrequest",
"PluginResponseHealingTypedDict": ".openresponsesrequest",
"PluginTypedDict": ".openresponsesrequest",
"PluginWeb": ".openresponsesrequest",
"PluginWebTypedDict": ".openresponsesrequest",
"Provider": ".openresponsesrequest",
"ProviderTypedDict": ".openresponsesrequest",
"ServiceTier": ".openresponsesrequest", "ServiceTier": ".openresponsesrequest",
"Truncation": ".openresponsesrequest", "Truncation": ".openresponsesrequest",
"OpenResponsesResponseText": ".openresponsesresponsetext", "OpenResponsesResponseText": ".openresponsesresponsetext",
+39
View File
@@ -0,0 +1,39 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from ._schema14 import Schema14, Schema14TypedDict
from openrouter.types import BaseModel
from typing import Any, Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict
PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any])
Prompt = TypeAliasType("Prompt", Union[float, str, Any])
CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any])
Completion = TypeAliasType("Completion", Union[float, str, Any])
class Schema10TypedDict(TypedDict):
prompt: NotRequired[PromptTypedDict]
completion: NotRequired[CompletionTypedDict]
image: NotRequired[Schema14TypedDict]
audio: NotRequired[Schema14TypedDict]
request: NotRequired[Schema14TypedDict]
class Schema10(BaseModel):
prompt: Optional[Prompt] = None
completion: Optional[Completion] = None
image: Optional[Schema14] = None
audio: Optional[Schema14] = None
request: Optional[Schema14] = None
+11
View File
@@ -0,0 +1,11 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from typing import Any, Union
from typing_extensions import TypeAliasType
Schema14TypedDict = TypeAliasType("Schema14TypedDict", Union[float, str, Any])
Schema14 = TypeAliasType("Schema14", Union[float, str, Any])
+154
View File
@@ -0,0 +1,154 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
import pydantic
from pydantic import Discriminator, Tag
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
class Schema17ResponseHealingTypedDict(TypedDict):
id: Literal["response-healing"]
enabled: NotRequired[bool]
class Schema17ResponseHealing(BaseModel):
ID: Annotated[
Annotated[
Literal["response-healing"],
AfterValidator(validate_const("response-healing")),
],
pydantic.Field(alias="id"),
] = "response-healing"
enabled: Optional[bool] = None
PdfEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
"native",
],
UnrecognizedStr,
]
class PdfTypedDict(TypedDict):
engine: NotRequired[PdfEngine]
class Pdf(BaseModel):
engine: Annotated[
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
] = None
class Schema17FileParserTypedDict(TypedDict):
id: Literal["file-parser"]
enabled: NotRequired[bool]
pdf: NotRequired[PdfTypedDict]
class Schema17FileParser(BaseModel):
ID: Annotated[
Annotated[
Literal["file-parser"], AfterValidator(validate_const("file-parser"))
],
pydantic.Field(alias="id"),
] = "file-parser"
enabled: Optional[bool] = None
pdf: Optional[Pdf] = None
Engine = Union[
Literal[
"native",
"exa",
],
UnrecognizedStr,
]
class Schema17WebTypedDict(TypedDict):
id: Literal["web"]
enabled: NotRequired[bool]
max_results: NotRequired[float]
search_prompt: NotRequired[str]
engine: NotRequired[Engine]
class Schema17Web(BaseModel):
ID: Annotated[
Annotated[Literal["web"], AfterValidator(validate_const("web"))],
pydantic.Field(alias="id"),
] = "web"
enabled: Optional[bool] = None
max_results: Optional[float] = None
search_prompt: Optional[str] = None
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
None
)
class Schema17ModerationTypedDict(TypedDict):
id: Literal["moderation"]
class Schema17Moderation(BaseModel):
ID: Annotated[
Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))],
pydantic.Field(alias="id"),
] = "moderation"
class Schema17AutoRouterTypedDict(TypedDict):
id: Literal["auto-router"]
enabled: NotRequired[bool]
allowed_models: NotRequired[List[str]]
class Schema17AutoRouter(BaseModel):
ID: Annotated[
Annotated[
Literal["auto-router"], AfterValidator(validate_const("auto-router"))
],
pydantic.Field(alias="id"),
] = "auto-router"
enabled: Optional[bool] = None
allowed_models: Optional[List[str]] = None
Schema17TypedDict = TypeAliasType(
"Schema17TypedDict",
Union[
Schema17ModerationTypedDict,
Schema17ResponseHealingTypedDict,
Schema17AutoRouterTypedDict,
Schema17FileParserTypedDict,
Schema17WebTypedDict,
],
)
Schema17 = Annotated[
Union[
Annotated[Schema17AutoRouter, Tag("auto-router")],
Annotated[Schema17Moderation, Tag("moderation")],
Annotated[Schema17Web, Tag("web")],
Annotated[Schema17FileParser, Tag("file-parser")],
Annotated[Schema17ResponseHealing, Tag("response-healing")],
],
Discriminator(lambda m: get_discriminator(m, "id", "id")),
]
@@ -17,7 +17,7 @@ from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
Schema4 = Union[ Schema21 = Union[
Literal[ Literal[
"unknown", "unknown",
"openai-responses-v1", "openai-responses-v1",
@@ -30,16 +30,16 @@ Schema4 = Union[
] ]
class Schema2ReasoningTextTypedDict(TypedDict): class Schema19ReasoningTextTypedDict(TypedDict):
type: Literal["reasoning.text"] type: Literal["reasoning.text"]
text: NotRequired[Nullable[str]] text: NotRequired[Nullable[str]]
signature: NotRequired[Nullable[str]] signature: NotRequired[Nullable[str]]
id: NotRequired[Nullable[str]] id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema4]] format_: NotRequired[Nullable[Schema21]]
index: NotRequired[float] index: NotRequired[float]
class Schema2ReasoningText(BaseModel): class Schema19ReasoningText(BaseModel):
TYPE: Annotated[ TYPE: Annotated[
Annotated[ Annotated[
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text")) Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
@@ -54,7 +54,9 @@ class Schema2ReasoningText(BaseModel):
id: OptionalNullable[str] = UNSET id: OptionalNullable[str] = UNSET
format_: Annotated[ format_: Annotated[
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], Annotated[
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
],
pydantic.Field(alias="format"), pydantic.Field(alias="format"),
] = UNSET ] = UNSET
@@ -91,15 +93,15 @@ class Schema2ReasoningText(BaseModel):
return m return m
class Schema2ReasoningEncryptedTypedDict(TypedDict): class Schema19ReasoningEncryptedTypedDict(TypedDict):
data: str data: str
type: Literal["reasoning.encrypted"] type: Literal["reasoning.encrypted"]
id: NotRequired[Nullable[str]] id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema4]] format_: NotRequired[Nullable[Schema21]]
index: NotRequired[float] index: NotRequired[float]
class Schema2ReasoningEncrypted(BaseModel): class Schema19ReasoningEncrypted(BaseModel):
data: str data: str
TYPE: Annotated[ TYPE: Annotated[
@@ -113,7 +115,9 @@ class Schema2ReasoningEncrypted(BaseModel):
id: OptionalNullable[str] = UNSET id: OptionalNullable[str] = UNSET
format_: Annotated[ format_: Annotated[
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], Annotated[
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
],
pydantic.Field(alias="format"), pydantic.Field(alias="format"),
] = UNSET ] = UNSET
@@ -150,15 +154,15 @@ class Schema2ReasoningEncrypted(BaseModel):
return m return m
class Schema2ReasoningSummaryTypedDict(TypedDict): class Schema19ReasoningSummaryTypedDict(TypedDict):
summary: str summary: str
type: Literal["reasoning.summary"] type: Literal["reasoning.summary"]
id: NotRequired[Nullable[str]] id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema4]] format_: NotRequired[Nullable[Schema21]]
index: NotRequired[float] index: NotRequired[float]
class Schema2ReasoningSummary(BaseModel): class Schema19ReasoningSummary(BaseModel):
summary: str summary: str
TYPE: Annotated[ TYPE: Annotated[
@@ -172,7 +176,9 @@ class Schema2ReasoningSummary(BaseModel):
id: OptionalNullable[str] = UNSET id: OptionalNullable[str] = UNSET
format_: Annotated[ format_: Annotated[
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))], Annotated[
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
],
pydantic.Field(alias="format"), pydantic.Field(alias="format"),
] = UNSET ] = UNSET
@@ -209,21 +215,21 @@ class Schema2ReasoningSummary(BaseModel):
return m return m
Schema2TypedDict = TypeAliasType( Schema19TypedDict = TypeAliasType(
"Schema2TypedDict", "Schema19TypedDict",
Union[ Union[
Schema2ReasoningSummaryTypedDict, Schema19ReasoningSummaryTypedDict,
Schema2ReasoningEncryptedTypedDict, Schema19ReasoningEncryptedTypedDict,
Schema2ReasoningTextTypedDict, Schema19ReasoningTextTypedDict,
], ],
) )
Schema2 = Annotated[ Schema19 = Annotated[
Union[ Union[
Annotated[Schema2ReasoningSummary, Tag("reasoning.summary")], Annotated[Schema19ReasoningSummary, Tag("reasoning.summary")],
Annotated[Schema2ReasoningEncrypted, Tag("reasoning.encrypted")], Annotated[Schema19ReasoningEncrypted, Tag("reasoning.encrypted")],
Annotated[Schema2ReasoningText, Tag("reasoning.text")], Annotated[Schema19ReasoningText, Tag("reasoning.text")],
], ],
Discriminator(lambda m: get_discriminator(m, "type", "type")), Discriminator(lambda m: get_discriminator(m, "type", "type")),
] ]
@@ -8,11 +8,12 @@ from typing import Literal, Union
from typing_extensions import Annotated, TypeAliasType from typing_extensions import Annotated, TypeAliasType
Schema0Enum = Union[ Schema5Enum = Union[
Literal[ Literal[
"AI21", "AI21",
"AionLabs", "AionLabs",
"Alibaba", "Alibaba",
"Ambient",
"Amazon Bedrock", "Amazon Bedrock",
"Amazon Nova", "Amazon Nova",
"Anthropic", "Anthropic",
@@ -69,6 +70,7 @@ Schema0Enum = Union[
"Seed", "Seed",
"SiliconFlow", "SiliconFlow",
"Sourceful", "Sourceful",
"StepFun",
"Stealth", "Stealth",
"StreamLake", "StreamLake",
"Switchpoint", "Switchpoint",
@@ -85,10 +87,10 @@ Schema0Enum = Union[
] ]
Schema0TypedDict = TypeAliasType("Schema0TypedDict", Union[Schema0Enum, str]) Schema5TypedDict = TypeAliasType("Schema5TypedDict", Union[Schema5Enum, str])
Schema0 = TypeAliasType( Schema5 = TypeAliasType(
"Schema0", "Schema5",
Union[Annotated[Schema0Enum, PlainValidator(validate_open_enum(False))], str], Union[Annotated[Schema5Enum, PlainValidator(validate_open_enum(False))], str],
) )
@@ -1,7 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from ._schema2 import Schema2, Schema2TypedDict from ._schema19 import Schema19, Schema19TypedDict
from .chatmessagecontentitem import ( from .chatmessagecontentitem import (
ChatMessageContentItem, ChatMessageContentItem,
ChatMessageContentItemTypedDict, ChatMessageContentItemTypedDict,
@@ -56,7 +56,7 @@ class AssistantMessageTypedDict(TypedDict):
tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]] tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]]
refusal: NotRequired[Nullable[str]] refusal: NotRequired[Nullable[str]]
reasoning: NotRequired[Nullable[str]] reasoning: NotRequired[Nullable[str]]
reasoning_details: NotRequired[List[Schema2TypedDict]] reasoning_details: NotRequired[List[Schema19TypedDict]]
images: NotRequired[List[ImageTypedDict]] images: NotRequired[List[ImageTypedDict]]
@@ -76,7 +76,7 @@ class AssistantMessage(BaseModel):
reasoning: OptionalNullable[str] = UNSET reasoning: OptionalNullable[str] = UNSET
reasoning_details: Optional[List[Schema2]] = None reasoning_details: Optional[List[Schema19]] = None
images: Optional[List[Image]] = None images: Optional[List[Image]] = None
+32 -314
View File
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from ._schema0 import Schema0, Schema0TypedDict from ._schema10 import Schema10, Schema10TypedDict
from ._schema17 import Schema17, Schema17TypedDict
from ._schema5 import Schema5, Schema5TypedDict
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
from .message import Message, MessageTypedDict from .message import Message, MessageTypedDict
from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict
@@ -31,7 +33,7 @@ from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
ChatGenerationParamsDataCollection = Union[ Schema3 = Union[
Literal[ Literal[
"deny", "deny",
"allow", "allow",
@@ -40,7 +42,7 @@ ChatGenerationParamsDataCollection = Union[
] ]
Quantizations = Union[ Schema8 = Union[
Literal[ Literal[
"int4", "int4",
"int8", "int8",
@@ -56,38 +58,14 @@ Quantizations = Union[
] ]
class ChatGenerationParamsMaxPriceTypedDict(TypedDict): class Schema15TypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: NotRequired[Any]
completion: NotRequired[Any]
image: NotRequired[Any]
audio: NotRequired[Any]
request: NotRequired[Any]
class ChatGenerationParamsMaxPrice(BaseModel):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: Optional[Any] = None
completion: Optional[Any] = None
image: Optional[Any] = None
audio: Optional[Any] = None
request: Optional[Any] = None
class ChatGenerationParamsPreferredMinThroughputTypedDict(TypedDict):
p50: NotRequired[Nullable[float]] p50: NotRequired[Nullable[float]]
p75: NotRequired[Nullable[float]] p75: NotRequired[Nullable[float]]
p90: NotRequired[Nullable[float]] p90: NotRequired[Nullable[float]]
p99: NotRequired[Nullable[float]] p99: NotRequired[Nullable[float]]
class ChatGenerationParamsPreferredMinThroughput(BaseModel): class Schema15(BaseModel):
p50: OptionalNullable[float] = UNSET p50: OptionalNullable[float] = UNSET
p75: OptionalNullable[float] = UNSET p75: OptionalNullable[float] = UNSET
@@ -127,170 +105,60 @@ class ChatGenerationParamsPreferredMinThroughput(BaseModel):
return m return m
ChatGenerationParamsPreferredMinThroughputUnionTypedDict = TypeAliasType( Schema15UnionTypedDict = TypeAliasType(
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict", "Schema15UnionTypedDict", Union[Schema15TypedDict, float]
Union[ChatGenerationParamsPreferredMinThroughputTypedDict, float],
) )
ChatGenerationParamsPreferredMinThroughputUnion = TypeAliasType( Schema15Union = TypeAliasType("Schema15Union", Union[Schema15, float])
"ChatGenerationParamsPreferredMinThroughputUnion",
Union[ChatGenerationParamsPreferredMinThroughput, float],
)
class ChatGenerationParamsPreferredMaxLatencyTypedDict(TypedDict): class Schema0TypedDict(TypedDict):
p50: NotRequired[Nullable[float]]
p75: NotRequired[Nullable[float]]
p90: NotRequired[Nullable[float]]
p99: NotRequired[Nullable[float]]
class ChatGenerationParamsPreferredMaxLatency(BaseModel):
p50: OptionalNullable[float] = UNSET
p75: OptionalNullable[float] = UNSET
p90: OptionalNullable[float] = UNSET
p99: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["p50", "p75", "p90", "p99"]
nullable_fields = ["p50", "p75", "p90", "p99"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
Union[ChatGenerationParamsPreferredMaxLatencyTypedDict, float],
)
ChatGenerationParamsPreferredMaxLatencyUnion = TypeAliasType(
"ChatGenerationParamsPreferredMaxLatencyUnion",
Union[ChatGenerationParamsPreferredMaxLatency, float],
)
class ChatGenerationParamsProviderTypedDict(TypedDict):
allow_fallbacks: NotRequired[Nullable[bool]] allow_fallbacks: NotRequired[Nullable[bool]]
r"""Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
"""
require_parameters: NotRequired[Nullable[bool]] 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[Schema3]]
data_collection: NotRequired[Nullable[ChatGenerationParamsDataCollection]]
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
"""
zdr: NotRequired[Nullable[bool]] zdr: NotRequired[Nullable[bool]]
enforce_distillable_text: NotRequired[Nullable[bool]] enforce_distillable_text: NotRequired[Nullable[bool]]
order: NotRequired[Nullable[List[Schema0TypedDict]]] order: NotRequired[Nullable[List[Schema5TypedDict]]]
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" only: NotRequired[Nullable[List[Schema5TypedDict]]]
only: NotRequired[Nullable[List[Schema0TypedDict]]] ignore: NotRequired[Nullable[List[Schema5TypedDict]]]
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" quantizations: NotRequired[Nullable[List[Schema8]]]
ignore: NotRequired[Nullable[List[Schema0TypedDict]]]
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: NotRequired[Nullable[List[Quantizations]]]
r"""A list of quantization levels to filter the provider by."""
sort: NotRequired[Nullable[ProviderSortUnionTypedDict]] sort: NotRequired[Nullable[ProviderSortUnionTypedDict]]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" max_price: NotRequired[Schema10TypedDict]
max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict] preferred_min_throughput: NotRequired[Nullable[Schema15UnionTypedDict]]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" preferred_max_latency: NotRequired[Nullable[Schema15UnionTypedDict]]
preferred_min_throughput: NotRequired[
Nullable[ChatGenerationParamsPreferredMinThroughputUnionTypedDict]
]
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[
Nullable[ChatGenerationParamsPreferredMaxLatencyUnionTypedDict]
]
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
class ChatGenerationParamsProvider(BaseModel): class Schema0(BaseModel):
allow_fallbacks: OptionalNullable[bool] = UNSET allow_fallbacks: OptionalNullable[bool] = UNSET
r"""Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
"""
require_parameters: OptionalNullable[bool] = UNSET require_parameters: OptionalNullable[bool] = UNSET
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
data_collection: Annotated[ data_collection: Annotated[
OptionalNullable[ChatGenerationParamsDataCollection], OptionalNullable[Schema3], PlainValidator(validate_open_enum(False))
PlainValidator(validate_open_enum(False)),
] = UNSET ] = UNSET
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
"""
zdr: OptionalNullable[bool] = UNSET zdr: OptionalNullable[bool] = UNSET
enforce_distillable_text: OptionalNullable[bool] = UNSET enforce_distillable_text: OptionalNullable[bool] = UNSET
order: OptionalNullable[List[Schema0]] = UNSET order: OptionalNullable[List[Schema5]] = UNSET
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: OptionalNullable[List[Schema0]] = UNSET only: OptionalNullable[List[Schema5]] = UNSET
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: OptionalNullable[List[Schema0]] = UNSET ignore: OptionalNullable[List[Schema5]] = UNSET
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: OptionalNullable[ quantizations: OptionalNullable[
List[Annotated[Quantizations, PlainValidator(validate_open_enum(False))]] List[Annotated[Schema8, PlainValidator(validate_open_enum(False))]]
] = UNSET ] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: OptionalNullable[ProviderSortUnion] = UNSET sort: OptionalNullable[ProviderSortUnion] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: Optional[ChatGenerationParamsMaxPrice] = None max_price: Optional[Schema10] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
preferred_min_throughput: OptionalNullable[ preferred_min_throughput: OptionalNullable[Schema15Union] = UNSET
ChatGenerationParamsPreferredMinThroughputUnion
] = UNSET
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: OptionalNullable[ preferred_max_latency: OptionalNullable[Schema15Union] = UNSET
ChatGenerationParamsPreferredMaxLatencyUnion
] = UNSET
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
@@ -350,150 +218,6 @@ class ChatGenerationParamsProvider(BaseModel):
return m return m
class ChatGenerationParamsPluginResponseHealingTypedDict(TypedDict):
id: Literal["response-healing"]
enabled: NotRequired[bool]
class ChatGenerationParamsPluginResponseHealing(BaseModel):
ID: Annotated[
Annotated[
Literal["response-healing"],
AfterValidator(validate_const("response-healing")),
],
pydantic.Field(alias="id"),
] = "response-healing"
enabled: Optional[bool] = None
PdfEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
"native",
],
UnrecognizedStr,
]
class PdfTypedDict(TypedDict):
engine: NotRequired[PdfEngine]
class Pdf(BaseModel):
engine: Annotated[
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
] = None
class ChatGenerationParamsPluginFileParserTypedDict(TypedDict):
id: Literal["file-parser"]
enabled: NotRequired[bool]
pdf: NotRequired[PdfTypedDict]
class ChatGenerationParamsPluginFileParser(BaseModel):
ID: Annotated[
Annotated[
Literal["file-parser"], AfterValidator(validate_const("file-parser"))
],
pydantic.Field(alias="id"),
] = "file-parser"
enabled: Optional[bool] = None
pdf: Optional[Pdf] = None
Engine = Union[
Literal[
"native",
"exa",
],
UnrecognizedStr,
]
class ChatGenerationParamsPluginWebTypedDict(TypedDict):
id: Literal["web"]
enabled: NotRequired[bool]
max_results: NotRequired[float]
search_prompt: NotRequired[str]
engine: NotRequired[Engine]
class ChatGenerationParamsPluginWeb(BaseModel):
ID: Annotated[
Annotated[Literal["web"], AfterValidator(validate_const("web"))],
pydantic.Field(alias="id"),
] = "web"
enabled: Optional[bool] = None
max_results: Optional[float] = None
search_prompt: Optional[str] = None
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
None
)
class ChatGenerationParamsPluginModerationTypedDict(TypedDict):
id: Literal["moderation"]
class ChatGenerationParamsPluginModeration(BaseModel):
ID: Annotated[
Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))],
pydantic.Field(alias="id"),
] = "moderation"
class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict):
id: Literal["auto-router"]
enabled: NotRequired[bool]
allowed_models: NotRequired[List[str]]
class ChatGenerationParamsPluginAutoRouter(BaseModel):
ID: Annotated[
Annotated[
Literal["auto-router"], AfterValidator(validate_const("auto-router"))
],
pydantic.Field(alias="id"),
] = "auto-router"
enabled: Optional[bool] = None
allowed_models: Optional[List[str]] = None
ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPluginUnionTypedDict",
Union[
ChatGenerationParamsPluginModerationTypedDict,
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginWebTypedDict,
],
)
ChatGenerationParamsPluginUnion = Annotated[
Union[
Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")],
Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")],
Annotated[ChatGenerationParamsPluginWeb, Tag("web")],
Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")],
Annotated[ChatGenerationParamsPluginResponseHealing, Tag("response-healing")],
],
Discriminator(lambda m: get_discriminator(m, "id", "id")),
]
Route = Union[ Route = Union[
Literal[ Literal[
"fallback", "fallback",
@@ -656,14 +380,11 @@ Modality = Union[
class ChatGenerationParamsTypedDict(TypedDict): class ChatGenerationParamsTypedDict(TypedDict):
messages: List[MessageTypedDict] messages: List[MessageTypedDict]
provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]] provider: NotRequired[Nullable[Schema0TypedDict]]
r"""When multiple model providers are available, optionally indicate your routing preference.""" plugins: NotRequired[List[Schema17TypedDict]]
plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]]
r"""Plugins you want to enable for this request, including their settings."""
route: NotRequired[Nullable[Route]] route: NotRequired[Nullable[Route]]
user: NotRequired[str] user: NotRequired[str]
session_id: NotRequired[str] session_id: NotRequired[str]
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
model: NotRequired[str] model: NotRequired[str]
models: NotRequired[List[str]] models: NotRequired[List[str]]
frequency_penalty: NotRequired[Nullable[float]] frequency_penalty: NotRequired[Nullable[float]]
@@ -692,11 +413,9 @@ class ChatGenerationParamsTypedDict(TypedDict):
class ChatGenerationParams(BaseModel): class ChatGenerationParams(BaseModel):
messages: List[Message] messages: List[Message]
provider: OptionalNullable[ChatGenerationParamsProvider] = UNSET provider: OptionalNullable[Schema0] = UNSET
r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: Optional[List[ChatGenerationParamsPluginUnion]] = None plugins: Optional[List[Schema17]] = None
r"""Plugins you want to enable for this request, including their settings."""
route: Annotated[ route: Annotated[
OptionalNullable[Route], PlainValidator(validate_open_enum(False)) OptionalNullable[Route], PlainValidator(validate_open_enum(False))
@@ -705,7 +424,6 @@ class ChatGenerationParams(BaseModel):
user: Optional[str] = None user: Optional[str] = None
session_id: Optional[str] = None session_id: Optional[str] = None
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
model: Optional[str] = None model: Optional[str] = None
@@ -1,7 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations from __future__ import annotations
from ._schema2 import Schema2, Schema2TypedDict from ._schema19 import Schema19, Schema19TypedDict
from .chatstreamingmessagetoolcall import ( from .chatstreamingmessagetoolcall import (
ChatStreamingMessageToolCall, ChatStreamingMessageToolCall,
ChatStreamingMessageToolCallTypedDict, ChatStreamingMessageToolCallTypedDict,
@@ -27,7 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict):
reasoning: NotRequired[Nullable[str]] reasoning: NotRequired[Nullable[str]]
refusal: NotRequired[Nullable[str]] refusal: NotRequired[Nullable[str]]
tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]] tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]]
reasoning_details: NotRequired[List[Schema2TypedDict]] reasoning_details: NotRequired[List[Schema19TypedDict]]
class ChatStreamingMessageChunk(BaseModel): class ChatStreamingMessageChunk(BaseModel):
@@ -41,7 +41,7 @@ class ChatStreamingMessageChunk(BaseModel):
tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None
reasoning_details: Optional[List[Schema2]] = None reasoning_details: Optional[List[Schema19]] = None
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
@@ -0,0 +1,41 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatmessagecontentitemtext import (
ChatMessageContentItemText,
ChatMessageContentItemTextTypedDict,
)
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
DeveloperMessageContentTypedDict = TypeAliasType(
"DeveloperMessageContentTypedDict",
Union[str, List[ChatMessageContentItemTextTypedDict]],
)
DeveloperMessageContent = TypeAliasType(
"DeveloperMessageContent", Union[str, List[ChatMessageContentItemText]]
)
class DeveloperMessageTypedDict(TypedDict):
content: DeveloperMessageContentTypedDict
role: Literal["developer"]
name: NotRequired[str]
class DeveloperMessage(BaseModel):
content: DeveloperMessageContent
ROLE: Annotated[
Annotated[Literal["developer"], AfterValidator(validate_const("developer"))],
pydantic.Field(alias="role"),
] = "developer"
name: Optional[str] = None
+6 -39
View File
@@ -2,47 +2,14 @@
from __future__ import annotations from __future__ import annotations
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .chatmessagecontentitemtext import ( from .developermessage import DeveloperMessage, DeveloperMessageTypedDict
ChatMessageContentItemText,
ChatMessageContentItemTextTypedDict,
)
from .systemmessage import SystemMessage, SystemMessageTypedDict from .systemmessage import SystemMessage, SystemMessageTypedDict
from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict from .toolresponsemessage import ToolResponseMessage, ToolResponseMessageTypedDict
from .usermessage import UserMessage, UserMessageTypedDict from .usermessage import UserMessage, UserMessageTypedDict
from openrouter.types import BaseModel from openrouter.utils import get_discriminator
from openrouter.utils import get_discriminator, validate_const
import pydantic
from pydantic import Discriminator, Tag from pydantic import Discriminator, Tag
from pydantic.functional_validators import AfterValidator from typing import Union
from typing import List, Literal, Optional, Union from typing_extensions import Annotated, TypeAliasType
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
MessageContentTypedDict = TypeAliasType(
"MessageContentTypedDict", Union[str, List[ChatMessageContentItemTextTypedDict]]
)
MessageContent = TypeAliasType(
"MessageContent", Union[str, List[ChatMessageContentItemText]]
)
class MessageDeveloperTypedDict(TypedDict):
content: MessageContentTypedDict
role: Literal["developer"]
name: NotRequired[str]
class MessageDeveloper(BaseModel):
content: MessageContent
ROLE: Annotated[
Annotated[Literal["developer"], AfterValidator(validate_const("developer"))],
pydantic.Field(alias="role"),
] = "developer"
name: Optional[str] = None
MessageTypedDict = TypeAliasType( MessageTypedDict = TypeAliasType(
@@ -50,7 +17,7 @@ MessageTypedDict = TypeAliasType(
Union[ Union[
SystemMessageTypedDict, SystemMessageTypedDict,
UserMessageTypedDict, UserMessageTypedDict,
MessageDeveloperTypedDict, DeveloperMessageTypedDict,
ToolResponseMessageTypedDict, ToolResponseMessageTypedDict,
AssistantMessageTypedDict, AssistantMessageTypedDict,
], ],
@@ -61,7 +28,7 @@ Message = Annotated[
Union[ Union[
Annotated[SystemMessage, Tag("system")], Annotated[SystemMessage, Tag("system")],
Annotated[UserMessage, Tag("user")], Annotated[UserMessage, Tag("user")],
Annotated[MessageDeveloper, Tag("developer")], Annotated[DeveloperMessage, Tag("developer")],
Annotated[AssistantMessage, Tag("assistant")], Annotated[AssistantMessage, Tag("assistant")],
Annotated[ToolResponseMessage, Tag("tool")], Annotated[ToolResponseMessage, Tag("tool")],
], ],
@@ -222,37 +222,29 @@ class OpenResponsesRequestMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: NotRequired[str] prompt: NotRequired[str]
r"""A value in string format that is a large number""" r"""Price per million prompt tokens"""
completion: NotRequired[str] completion: NotRequired[str]
r"""A value in string format that is a large number"""
image: NotRequired[str] image: NotRequired[str]
r"""A value in string format that is a large number"""
audio: NotRequired[str] audio: NotRequired[str]
r"""A value in string format that is a large number"""
request: NotRequired[str] request: NotRequired[str]
r"""A value in string format that is a large number"""
class OpenResponsesRequestMaxPrice(BaseModel): class OpenResponsesRequestMaxPrice(BaseModel):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: Optional[str] = None prompt: Optional[str] = None
r"""A value in string format that is a large number""" r"""Price per million prompt tokens"""
completion: Optional[str] = None completion: Optional[str] = None
r"""A value in string format that is a large number"""
image: Optional[str] = None image: Optional[str] = None
r"""A value in string format that is a large number"""
audio: Optional[str] = None audio: Optional[str] = None
r"""A value in string format that is a large number"""
request: Optional[str] = None request: Optional[str] = None
r"""A value in string format that is a large number"""
class OpenResponsesRequestProviderTypedDict(TypedDict): class ProviderTypedDict(TypedDict):
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
allow_fallbacks: NotRequired[Nullable[bool]] allow_fallbacks: NotRequired[Nullable[bool]]
@@ -291,7 +283,7 @@ class OpenResponsesRequestProviderTypedDict(TypedDict):
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
class OpenResponsesRequestProvider(BaseModel): class Provider(BaseModel):
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
allow_fallbacks: OptionalNullable[bool] = UNSET allow_fallbacks: OptionalNullable[bool] = UNSET
@@ -406,13 +398,13 @@ class OpenResponsesRequestProvider(BaseModel):
IDResponseHealing = Literal["response-healing",] IDResponseHealing = Literal["response-healing",]
class OpenResponsesRequestPluginResponseHealingTypedDict(TypedDict): class PluginResponseHealingTypedDict(TypedDict):
id: IDResponseHealing id: IDResponseHealing
enabled: NotRequired[bool] enabled: NotRequired[bool]
r"""Set to false to disable the response-healing plugin for this request. Defaults to true.""" r"""Set to false to disable the response-healing plugin for this request. Defaults to true."""
class OpenResponsesRequestPluginResponseHealing(BaseModel): class PluginResponseHealing(BaseModel):
id: IDResponseHealing id: IDResponseHealing
enabled: Optional[bool] = None enabled: Optional[bool] = None
@@ -422,7 +414,7 @@ class OpenResponsesRequestPluginResponseHealing(BaseModel):
IDFileParser = Literal["file-parser",] IDFileParser = Literal["file-parser",]
class OpenResponsesRequestPluginFileParserTypedDict(TypedDict): class PluginFileParserTypedDict(TypedDict):
id: IDFileParser id: IDFileParser
enabled: NotRequired[bool] enabled: NotRequired[bool]
r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
@@ -430,7 +422,7 @@ class OpenResponsesRequestPluginFileParserTypedDict(TypedDict):
r"""Options for PDF parsing.""" r"""Options for PDF parsing."""
class OpenResponsesRequestPluginFileParser(BaseModel): class PluginFileParser(BaseModel):
id: IDFileParser id: IDFileParser
enabled: Optional[bool] = None enabled: Optional[bool] = None
@@ -443,7 +435,7 @@ class OpenResponsesRequestPluginFileParser(BaseModel):
IDWeb = Literal["web",] IDWeb = Literal["web",]
class OpenResponsesRequestPluginWebTypedDict(TypedDict): class PluginWebTypedDict(TypedDict):
id: IDWeb id: IDWeb
enabled: NotRequired[bool] enabled: NotRequired[bool]
r"""Set to false to disable the web-search plugin for this request. Defaults to true.""" r"""Set to false to disable the web-search plugin for this request. Defaults to true."""
@@ -453,7 +445,7 @@ class OpenResponsesRequestPluginWebTypedDict(TypedDict):
r"""The search engine to use for web search.""" r"""The search engine to use for web search."""
class OpenResponsesRequestPluginWeb(BaseModel): class PluginWeb(BaseModel):
id: IDWeb id: IDWeb
enabled: Optional[bool] = None enabled: Optional[bool] = None
@@ -472,18 +464,18 @@ class OpenResponsesRequestPluginWeb(BaseModel):
IDModeration = Literal["moderation",] IDModeration = Literal["moderation",]
class OpenResponsesRequestPluginModerationTypedDict(TypedDict): class PluginModerationTypedDict(TypedDict):
id: IDModeration id: IDModeration
class OpenResponsesRequestPluginModeration(BaseModel): class PluginModeration(BaseModel):
id: IDModeration id: IDModeration
IDAutoRouter = Literal["auto-router",] IDAutoRouter = Literal["auto-router",]
class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict): class PluginAutoRouterTypedDict(TypedDict):
id: IDAutoRouter id: IDAutoRouter
enabled: NotRequired[bool] enabled: NotRequired[bool]
r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" r"""Set to false to disable the auto-router plugin for this request. Defaults to true."""
@@ -491,7 +483,7 @@ class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict):
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
class OpenResponsesRequestPluginAutoRouter(BaseModel): class PluginAutoRouter(BaseModel):
id: IDAutoRouter id: IDAutoRouter
enabled: Optional[bool] = None enabled: Optional[bool] = None
@@ -501,25 +493,25 @@ class OpenResponsesRequestPluginAutoRouter(BaseModel):
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
OpenResponsesRequestPluginUnionTypedDict = TypeAliasType( PluginTypedDict = TypeAliasType(
"OpenResponsesRequestPluginUnionTypedDict", "PluginTypedDict",
Union[ Union[
OpenResponsesRequestPluginModerationTypedDict, PluginModerationTypedDict,
OpenResponsesRequestPluginResponseHealingTypedDict, PluginResponseHealingTypedDict,
OpenResponsesRequestPluginAutoRouterTypedDict, PluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParserTypedDict, PluginFileParserTypedDict,
OpenResponsesRequestPluginWebTypedDict, PluginWebTypedDict,
], ],
) )
OpenResponsesRequestPluginUnion = Annotated[ Plugin = Annotated[
Union[ Union[
Annotated[OpenResponsesRequestPluginAutoRouter, Tag("auto-router")], Annotated[PluginAutoRouter, Tag("auto-router")],
Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")], Annotated[PluginModeration, Tag("moderation")],
Annotated[OpenResponsesRequestPluginWeb, Tag("web")], Annotated[PluginWeb, Tag("web")],
Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")], Annotated[PluginFileParser, Tag("file-parser")],
Annotated[OpenResponsesRequestPluginResponseHealing, Tag("response-healing")], Annotated[PluginResponseHealing, Tag("response-healing")],
], ],
Discriminator(lambda m: get_discriminator(m, "id", "id")), Discriminator(lambda m: get_discriminator(m, "id", "id")),
] ]
@@ -564,9 +556,9 @@ class OpenResponsesRequestTypedDict(TypedDict):
service_tier: NotRequired[ServiceTier] service_tier: NotRequired[ServiceTier]
truncation: NotRequired[Nullable[Truncation]] truncation: NotRequired[Nullable[Truncation]]
stream: NotRequired[bool] stream: NotRequired[bool]
provider: NotRequired[Nullable[OpenResponsesRequestProviderTypedDict]] provider: NotRequired[Nullable[ProviderTypedDict]]
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]] plugins: NotRequired[List[PluginTypedDict]]
r"""Plugins you want to enable for this request, including their settings.""" r"""Plugins you want to enable for this request, including their settings."""
user: NotRequired[str] user: NotRequired[str]
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.""" r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
@@ -660,10 +652,10 @@ class OpenResponsesRequest(BaseModel):
stream: Optional[bool] = False stream: Optional[bool] = False
provider: OptionalNullable[OpenResponsesRequestProvider] = UNSET provider: OptionalNullable[Provider] = UNSET
r"""When multiple model providers are available, optionally indicate your routing preference.""" r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None plugins: Optional[List[Plugin]] = None
r"""Plugins you want to enable for this request, including their settings.""" r"""Plugins you want to enable for this request, including their settings."""
user: Optional[str] = None user: Optional[str] = None
@@ -10,6 +10,7 @@ ProviderName = Union[
"AI21", "AI21",
"AionLabs", "AionLabs",
"Alibaba", "Alibaba",
"Ambient",
"Amazon Bedrock", "Amazon Bedrock",
"Amazon Nova", "Amazon Nova",
"Anthropic", "Anthropic",
@@ -66,6 +67,7 @@ ProviderName = Union[
"Seed", "Seed",
"SiliconFlow", "SiliconFlow",
"Sourceful", "Sourceful",
"StepFun",
"Stealth", "Stealth",
"StreamLake", "StreamLake",
"Switchpoint", "Switchpoint",
@@ -176,34 +176,26 @@ class ProviderPreferencesMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: NotRequired[str] prompt: NotRequired[str]
r"""A value in string format that is a large number""" r"""Price per million prompt tokens"""
completion: NotRequired[str] completion: NotRequired[str]
r"""A value in string format that is a large number"""
image: NotRequired[str] image: NotRequired[str]
r"""A value in string format that is a large number"""
audio: NotRequired[str] audio: NotRequired[str]
r"""A value in string format that is a large number"""
request: NotRequired[str] request: NotRequired[str]
r"""A value in string format that is a large number"""
class ProviderPreferencesMaxPrice(BaseModel): class ProviderPreferencesMaxPrice(BaseModel):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: Optional[str] = None prompt: Optional[str] = None
r"""A value in string format that is a large number""" r"""Price per million prompt tokens"""
completion: Optional[str] = None completion: Optional[str] = None
r"""A value in string format that is a large number"""
image: Optional[str] = None image: Optional[str] = None
r"""A value in string format that is a large number"""
audio: Optional[str] = None audio: Optional[str] = None
r"""A value in string format that is a large number"""
request: Optional[str] = None request: Optional[str] = None
r"""A value in string format that is a large number"""
class ProviderPreferencesTypedDict(TypedDict): class ProviderPreferencesTypedDict(TypedDict):
@@ -15,73 +15,47 @@ from typing_extensions import Annotated, NotRequired, TypedDict
class PricingTypedDict(TypedDict): class PricingTypedDict(TypedDict):
prompt: str prompt: str
r"""A value in string format that is a large number"""
completion: str completion: str
r"""A value in string format that is a large number"""
request: NotRequired[str] request: NotRequired[str]
r"""A value in string format that is a large number"""
image: NotRequired[str] image: NotRequired[str]
r"""A value in string format that is a large number"""
image_token: NotRequired[str] image_token: NotRequired[str]
r"""A value in string format that is a large number"""
image_output: NotRequired[str] image_output: NotRequired[str]
r"""A value in string format that is a large number"""
audio: NotRequired[str] audio: NotRequired[str]
r"""A value in string format that is a large number"""
audio_output: NotRequired[str] audio_output: NotRequired[str]
r"""A value in string format that is a large number"""
input_audio_cache: NotRequired[str] input_audio_cache: NotRequired[str]
r"""A value in string format that is a large number"""
web_search: NotRequired[str] web_search: NotRequired[str]
r"""A value in string format that is a large number"""
internal_reasoning: NotRequired[str] internal_reasoning: NotRequired[str]
r"""A value in string format that is a large number"""
input_cache_read: NotRequired[str] input_cache_read: NotRequired[str]
r"""A value in string format that is a large number"""
input_cache_write: NotRequired[str] input_cache_write: NotRequired[str]
r"""A value in string format that is a large number"""
discount: NotRequired[float] discount: NotRequired[float]
class Pricing(BaseModel): class Pricing(BaseModel):
prompt: str prompt: str
r"""A value in string format that is a large number"""
completion: str completion: str
r"""A value in string format that is a large number"""
request: Optional[str] = None request: Optional[str] = None
r"""A value in string format that is a large number"""
image: Optional[str] = None image: Optional[str] = None
r"""A value in string format that is a large number"""
image_token: Optional[str] = None image_token: Optional[str] = None
r"""A value in string format that is a large number"""
image_output: Optional[str] = None image_output: Optional[str] = None
r"""A value in string format that is a large number"""
audio: Optional[str] = None audio: Optional[str] = None
r"""A value in string format that is a large number"""
audio_output: Optional[str] = None audio_output: Optional[str] = None
r"""A value in string format that is a large number"""
input_audio_cache: Optional[str] = None input_audio_cache: Optional[str] = None
r"""A value in string format that is a large number"""
web_search: Optional[str] = None web_search: Optional[str] = None
r"""A value in string format that is a large number"""
internal_reasoning: Optional[str] = None internal_reasoning: Optional[str] = None
r"""A value in string format that is a large number"""
input_cache_read: Optional[str] = None input_cache_read: Optional[str] = None
r"""A value in string format that is a large number"""
input_cache_write: Optional[str] = None input_cache_write: Optional[str] = None
r"""A value in string format that is a large number"""
discount: Optional[float] = None discount: Optional[float] = None
@@ -10,31 +10,18 @@ class PublicPricingTypedDict(TypedDict):
r"""Pricing information for the model""" r"""Pricing information for the model"""
prompt: str prompt: str
r"""A value in string format that is a large number"""
completion: str completion: str
r"""A value in string format that is a large number"""
request: NotRequired[str] request: NotRequired[str]
r"""A value in string format that is a large number"""
image: NotRequired[str] image: NotRequired[str]
r"""A value in string format that is a large number"""
image_token: NotRequired[str] image_token: NotRequired[str]
r"""A value in string format that is a large number"""
image_output: NotRequired[str] image_output: NotRequired[str]
r"""A value in string format that is a large number"""
audio: NotRequired[str] audio: NotRequired[str]
r"""A value in string format that is a large number"""
audio_output: NotRequired[str] audio_output: NotRequired[str]
r"""A value in string format that is a large number"""
input_audio_cache: NotRequired[str] input_audio_cache: NotRequired[str]
r"""A value in string format that is a large number"""
web_search: NotRequired[str] web_search: NotRequired[str]
r"""A value in string format that is a large number"""
internal_reasoning: NotRequired[str] internal_reasoning: NotRequired[str]
r"""A value in string format that is a large number"""
input_cache_read: NotRequired[str] input_cache_read: NotRequired[str]
r"""A value in string format that is a large number"""
input_cache_write: NotRequired[str] input_cache_write: NotRequired[str]
r"""A value in string format that is a large number"""
discount: NotRequired[float] discount: NotRequired[float]
@@ -42,42 +29,29 @@ class PublicPricing(BaseModel):
r"""Pricing information for the model""" r"""Pricing information for the model"""
prompt: str prompt: str
r"""A value in string format that is a large number"""
completion: str completion: str
r"""A value in string format that is a large number"""
request: Optional[str] = None request: Optional[str] = None
r"""A value in string format that is a large number"""
image: Optional[str] = None image: Optional[str] = None
r"""A value in string format that is a large number"""
image_token: Optional[str] = None image_token: Optional[str] = None
r"""A value in string format that is a large number"""
image_output: Optional[str] = None image_output: Optional[str] = None
r"""A value in string format that is a large number"""
audio: Optional[str] = None audio: Optional[str] = None
r"""A value in string format that is a large number"""
audio_output: Optional[str] = None audio_output: Optional[str] = None
r"""A value in string format that is a large number"""
input_audio_cache: Optional[str] = None input_audio_cache: Optional[str] = None
r"""A value in string format that is a large number"""
web_search: Optional[str] = None web_search: Optional[str] = None
r"""A value in string format that is a large number"""
internal_reasoning: Optional[str] = None internal_reasoning: Optional[str] = None
r"""A value in string format that is a large number"""
input_cache_read: Optional[str] = None input_cache_read: Optional[str] = None
r"""A value in string format that is a large number"""
input_cache_write: Optional[str] = None input_cache_write: Optional[str] = None
r"""A value in string format that is a large number"""
discount: Optional[float] = None discount: Optional[float] = None
+9
View File
@@ -160,6 +160,9 @@ if TYPE_CHECKING:
GetGenerationRequestTypedDict, GetGenerationRequestTypedDict,
GetGenerationResponse, GetGenerationResponse,
GetGenerationResponseTypedDict, GetGenerationResponseTypedDict,
ProviderName,
ProviderResponse,
ProviderResponseTypedDict,
) )
from .getguardrail import ( from .getguardrail import (
GetGuardrailData, GetGuardrailData,
@@ -462,6 +465,9 @@ __all__ = [
"MetadataTypedDict", "MetadataTypedDict",
"Object", "Object",
"ObjectEmbedding", "ObjectEmbedding",
"ProviderName",
"ProviderResponse",
"ProviderResponseTypedDict",
"RateLimit", "RateLimit",
"RateLimitTypedDict", "RateLimitTypedDict",
"SendChatCompletionRequestResponse", "SendChatCompletionRequestResponse",
@@ -619,6 +625,9 @@ _dynamic_imports: dict[str, str] = {
"GetGenerationRequestTypedDict": ".getgeneration", "GetGenerationRequestTypedDict": ".getgeneration",
"GetGenerationResponse": ".getgeneration", "GetGenerationResponse": ".getgeneration",
"GetGenerationResponseTypedDict": ".getgeneration", "GetGenerationResponseTypedDict": ".getgeneration",
"ProviderName": ".getgeneration",
"ProviderResponse": ".getgeneration",
"ProviderResponseTypedDict": ".getgeneration",
"GetGuardrailData": ".getguardrail", "GetGuardrailData": ".getguardrail",
"GetGuardrailDataTypedDict": ".getguardrail", "GetGuardrailDataTypedDict": ".getguardrail",
"GetGuardrailRequest": ".getguardrail", "GetGuardrailRequest": ".getguardrail",
+180 -2
View File
@@ -5,8 +5,8 @@ from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedSt
from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum from openrouter.utils import FieldMetadata, QueryParamMetadata, validate_open_enum
from pydantic import model_serializer from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator from pydantic.functional_validators import PlainValidator
from typing import Literal, Union from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, TypedDict from typing_extensions import Annotated, NotRequired, TypedDict
class GetGenerationRequestTypedDict(TypedDict): class GetGenerationRequestTypedDict(TypedDict):
@@ -29,6 +29,178 @@ APIType = Union[
r"""Type of API used for the generation""" r"""Type of API used for the generation"""
ProviderName = Union[
Literal[
"AnyScale",
"Atoma",
"Cent-ML",
"CrofAI",
"Enfer",
"GoPomelo",
"HuggingFace",
"Hyperbolic 2",
"InoCloud",
"Kluster",
"Lambda",
"Lepton",
"Lynn 2",
"Lynn",
"Mancer",
"Meta",
"Modal",
"Nineteen",
"OctoAI",
"Recursal",
"Reflection",
"Replicate",
"SambaNova 2",
"SF Compute",
"Targon",
"Together 2",
"Ubicloud",
"01.AI",
"AI21",
"AionLabs",
"Alibaba",
"Ambient",
"Amazon Bedrock",
"Amazon Nova",
"Anthropic",
"Arcee AI",
"AtlasCloud",
"Avian",
"Azure",
"BaseTen",
"BytePlus",
"Black Forest Labs",
"Cerebras",
"Chutes",
"Cirrascale",
"Clarifai",
"Cloudflare",
"Cohere",
"Crusoe",
"DeepInfra",
"DeepSeek",
"Featherless",
"Fireworks",
"Friendli",
"GMICloud",
"Google",
"Google AI Studio",
"Groq",
"Hyperbolic",
"Inception",
"Inceptron",
"InferenceNet",
"Infermatic",
"Inflection",
"Liquid",
"Mara",
"Mancer 2",
"Minimax",
"ModelRun",
"Mistral",
"Modular",
"Moonshot AI",
"Morph",
"NCompass",
"Nebius",
"NextBit",
"Novita",
"Nvidia",
"OpenAI",
"OpenInference",
"Parasail",
"Perplexity",
"Phala",
"Relace",
"SambaNova",
"Seed",
"SiliconFlow",
"Sourceful",
"StepFun",
"Stealth",
"StreamLake",
"Switchpoint",
"Together",
"Upstage",
"Venice",
"WandB",
"Xiaomi",
"xAI",
"Z.AI",
"FakeProvider",
],
UnrecognizedStr,
]
class ProviderResponseTypedDict(TypedDict):
status: Nullable[float]
id: NotRequired[str]
endpoint_id: NotRequired[str]
model_permaslug: NotRequired[str]
provider_name: NotRequired[ProviderName]
latency: NotRequired[float]
is_byok: NotRequired[bool]
class ProviderResponse(BaseModel):
status: Nullable[float]
id: Optional[str] = None
endpoint_id: Optional[str] = None
model_permaslug: Optional[str] = None
provider_name: Annotated[
Optional[ProviderName], PlainValidator(validate_open_enum(False))
] = None
latency: Optional[float] = None
is_byok: Optional[bool] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"id",
"endpoint_id",
"model_permaslug",
"provider_name",
"latency",
"is_byok",
]
nullable_fields = ["status"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class GetGenerationDataTypedDict(TypedDict): class GetGenerationDataTypedDict(TypedDict):
r"""Generation data""" r"""Generation data"""
@@ -98,6 +270,8 @@ class GetGenerationDataTypedDict(TypedDict):
r"""Type of API used for the generation""" r"""Type of API used for the generation"""
router: Nullable[str] router: Nullable[str]
r"""Router used for the request (e.g., openrouter/auto)""" r"""Router used for the request (e.g., openrouter/auto)"""
provider_responses: Nullable[List[ProviderResponseTypedDict]]
r"""List of provider responses for this generation, including fallback attempts"""
class GetGenerationData(BaseModel): class GetGenerationData(BaseModel):
@@ -202,6 +376,9 @@ class GetGenerationData(BaseModel):
router: Nullable[str] router: Nullable[str]
r"""Router used for the request (e.g., openrouter/auto)""" r"""Router used for the request (e.g., openrouter/auto)"""
provider_responses: Nullable[List[ProviderResponse]]
r"""List of provider responses for this generation, including fallback attempts"""
@model_serializer(mode="wrap") @model_serializer(mode="wrap")
def serialize_model(self, handler): def serialize_model(self, handler):
optional_fields = [] optional_fields = []
@@ -232,6 +409,7 @@ class GetGenerationData(BaseModel):
"external_user", "external_user",
"api_type", "api_type",
"router", "router",
"provider_responses",
] ]
null_default_fields = [] null_default_fields = []
+16 -52
View File
@@ -84,16 +84,10 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None, stream: Union[Literal[False], None] = None,
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Provider, components.ProviderTypedDict]
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Plugin], List[components.PluginTypedDict]]
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None, session_id: Optional[str] = None,
@@ -212,16 +206,10 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True], stream: Literal[True],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Provider, components.ProviderTypedDict]
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Plugin], List[components.PluginTypedDict]]
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None, session_id: Optional[str] = None,
@@ -339,16 +327,10 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False, stream: Optional[bool] = False,
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Provider, components.ProviderTypedDict]
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Plugin], List[components.PluginTypedDict]]
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None, session_id: Optional[str] = None,
@@ -453,10 +435,10 @@ class Responses(BaseSDK):
truncation=truncation, truncation=truncation,
stream=stream, stream=stream,
provider=utils.get_pydantic_model( provider=utils.get_pydantic_model(
provider, OptionalNullable[components.OpenResponsesRequestProvider] provider, OptionalNullable[components.Provider]
), ),
plugins=utils.get_pydantic_model( plugins=utils.get_pydantic_model(
plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] plugins, Optional[List[components.Plugin]]
), ),
user=user, user=user,
session_id=session_id, session_id=session_id,
@@ -717,16 +699,10 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None, stream: Union[Literal[False], None] = None,
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Provider, components.ProviderTypedDict]
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Plugin], List[components.PluginTypedDict]]
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None, session_id: Optional[str] = None,
@@ -845,16 +821,10 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True], stream: Literal[True],
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Provider, components.ProviderTypedDict]
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Plugin], List[components.PluginTypedDict]]
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None, session_id: Optional[str] = None,
@@ -972,16 +942,10 @@ class Responses(BaseSDK):
truncation: OptionalNullable[components.Truncation] = UNSET, truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False, stream: Optional[bool] = False,
provider: OptionalNullable[ provider: OptionalNullable[
Union[ Union[components.Provider, components.ProviderTypedDict]
components.OpenResponsesRequestProvider,
components.OpenResponsesRequestProviderTypedDict,
]
] = UNSET, ] = UNSET,
plugins: Optional[ plugins: Optional[
Union[ Union[List[components.Plugin], List[components.PluginTypedDict]]
List[components.OpenResponsesRequestPluginUnion],
List[components.OpenResponsesRequestPluginUnionTypedDict],
]
] = None, ] = None,
user: Optional[str] = None, user: Optional[str] = None,
session_id: Optional[str] = None, session_id: Optional[str] = None,
@@ -1086,10 +1050,10 @@ class Responses(BaseSDK):
truncation=truncation, truncation=truncation,
stream=stream, stream=stream,
provider=utils.get_pydantic_model( provider=utils.get_pydantic_model(
provider, OptionalNullable[components.OpenResponsesRequestProvider] provider, OptionalNullable[components.Provider]
), ),
plugins=utils.get_pydantic_model( plugins=utils.get_pydantic_model(
plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] plugins, Optional[List[components.Plugin]]
), ),
user=user, user=user,
session_id=session_id, session_id=session_id,