Compare commits

..
1 Commits
Author SHA1 Message Date
OpenRouter Team 4cbb39da19 Commits included in this export:
- ac457b8a8dad98fdf5ddcae8dd4711361cea3084
  - ea825199f4c59dd68fec01cf8d18a582963c9f25
  - 4d48e4f6bb936e785787314a965298da6b78fea0
  - 718729a573ee98893a4408d5a52ab4686661fe54
  - b867adcde6b64f3f2a11c4626254b39098e4b0b4
  - 21912c097b4066d109766c6b4492826595cd57c5
  - bc1ed85adc976a4634ca8a41b82e4fc2c39a864f
  - d145c89c941937a312ed1357590d2bfda9a3603d
  - 12f05b5dee397ead47cfcd545a7a2e3c7ff57524
  - dd28f75a19a015809797c7abf3f8758f7c37262e
  - c96e569781e07ab44172d9c69940ec17bafd81f4
  - c9d5a90e3c2b5077a2bdd49773f1a46d1a5a79c7
  - 58b08f87116ceab9076de2fdc0a4c74c919b44c4

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