diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index bf97b34d..fe48a002 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 760d004875633e6348b9bfb890c3bd8c + docChecksum: 71a40d3e7b0f5a986bebaf119c8585d6 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.21 - configChecksum: 35810a7fae971b75e145e6ddf5b5f316 + releaseVersion: 1.3.22 + configChecksum: 238dc871088e377fa31c2687cfb5afb2 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 6fec7917-f08d-434d-b959-507ed8cfe7cf - pristine_commit_hash: 85c0ac656b6f26377214e1c9ef35f34a15fed715 - pristine_tree_hash: b46ac90e077e5e8c6697a9ef837470606e04cd13 + generation_id: c4477706-7b60-41e2-9d6f-5bf3512be933 + pristine_commit_hash: 428319492f51382f83f9daf56731d626fd7916ca + pristine_tree_hash: 3fb99917fb3c65b19b0c5a7176cff17a93c7c892 features: python: acceptHeaders: 3.0.0 @@ -6808,12 +6808,16 @@ trackedFiles: pristine_git_object: 34f4f07fb3008df83646fa3d88ce04009274246a docs/components/speechrequest.mdx: id: 06e81b0433f6 - last_write_checksum: sha1:66843df708017c70a8f112dcd4994d821ff6726f - pristine_git_object: 0f96859b4a173354fca9bd0da703fcf555c44e0f + last_write_checksum: sha1:b8cafb4ce14ea3983bd792eeaf95be0dbf4c8c3e + pristine_git_object: 1ffadd62bda287f96c35e4b83a7408f3c0fc117b + docs/components/speechrequestdatacollection.mdx: + id: 6c5938568888 + last_write_checksum: sha1:89a08b4c4de66c1ef7676792a38747e030ed6729 + pristine_git_object: 01f84221304dd8b2ff9c1ad99b796177b7ba84d1 docs/components/speechrequestprovider.mdx: id: 4f78ed0394c4 - last_write_checksum: sha1:99d94c6b01dbd3e875c213584f97c7dca545a6a9 - pristine_git_object: 3a95d19f4a88dbd0c96cec7cf53d9264927a3c0d + last_write_checksum: sha1:9f3f0e2abb87d2b509d39bc4d70291c69335fa65 + pristine_git_object: fbfa71493de4d04872309c96b1453bf51c7d2035 docs/components/speechrequestresponseformat.mdx: id: bd09f77a4a90 last_write_checksum: sha1:1b87242f33c6d22a08dd085d0ef41335ec2e9b0c @@ -6952,12 +6956,16 @@ trackedFiles: pristine_git_object: 45d1eef7be13575aac15391f23c310480852abf8 docs/components/sttrequest.mdx: id: 6a5e33cf6dbe - last_write_checksum: sha1:d15f6c0a8e2fc792b37668f55807879cf446586f - pristine_git_object: 49ab89dfaa79e89ab50bfa71b815a8139303a004 + last_write_checksum: sha1:6dd4e031bf02e6188c2cf524bf63d60132cd1d94 + pristine_git_object: 928d5db30f7f4561578dadc3e67db46a61afe951 + docs/components/sttrequestdatacollection.mdx: + id: d8523e72c962 + last_write_checksum: sha1:485caf2a759a45e6666f611663eea23924032df6 + pristine_git_object: 293a4f1162a245b3945674974fa399b1c0cae9b4 docs/components/sttrequestprovider.mdx: id: d8b1bac8e745 - last_write_checksum: sha1:e15551eddbe4c1f7c4515fa556d4873075512eea - pristine_git_object: 5eebff082dc885ed94ec0e6ceed8446c2ca104ae + last_write_checksum: sha1:20f3e76af21a43325087b16c63a3dcb7a0f80c56 + pristine_git_object: ddc964b62bef962373bf57f096bb3b3abd2f80ac docs/components/sttrequestresponseformat.mdx: id: ab58b1666609 last_write_checksum: sha1:f0cbf9b5b35d8ef8c049a3b84c47f6c43778a00a @@ -8124,8 +8132,8 @@ trackedFiles: pristine_git_object: b5031668ec1156a4157609e4812b7a3937b802a2 docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx: id: 0550cc56c73a - last_write_checksum: sha1:5f488a3854feb0fb865ce68b50b39a735a3bd94c - pristine_git_object: 3c8affe78a49e03bde0b56b5f7865daa3e88a8b3 + last_write_checksum: sha1:33b9c5e6e94a8cb209b1d83cdd9fd398d8d8c772 + pristine_git_object: 784fc7b0f092c77bcf4cfe534903d94f190848d9 docs/operations/createaudiotranscriptionsrequest.mdx: id: 68a813383936 last_write_checksum: sha1:a3ad7e4691917927539d6c614788da7f4d6b4892 @@ -9916,8 +9924,8 @@ trackedFiles: pristine_git_object: 240f5da9d86fc9dbbaa7efe345da740768c773b3 docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 - last_write_checksum: sha1:a01c41c73ba10dc2ae69a7f1b404551721312c7d - pristine_git_object: c4b66757c280205b008221b84356d92015974ec7 + last_write_checksum: sha1:4e8456d718c605e733f4d3b51f35fc4c36c637d3 + pristine_git_object: 50c67920c8155ab8d39fcc09fb1cfc94208556d8 docs/sdks/systemone/README.mdx: id: 55c317c71f3d last_write_checksum: sha1:b1ad82361fe1dbef6bedeead3783c75ec36283b6 @@ -9928,8 +9936,8 @@ trackedFiles: pristine_git_object: 1dd30f0b898f2a842d1bb585b03d887be90e7845 docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:a13e2ce78709e0c7b1977d8a518ff2447c8f37a6 - pristine_git_object: 345d9688a3dd09ae04e9e82efc7f7611e7df3f06 + last_write_checksum: sha1:c79acf8b375dfd535a3f5948da5f65446397c49a + pristine_git_object: 2a3eda6822076c9de566cbe56bbe5cfdc691cf9d docs/sdks/vault/README.mdx: id: 3738c6722acd last_write_checksum: sha1:12acdfed4c2a32488d98b6091fd8c392af516494 @@ -9948,8 +9956,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:b7e0b8d7420690eeb9bf098a294279645db0b65c - pristine_git_object: e3e7ae7f960e9d1baeab971bcade558710a80664 + last_write_checksum: sha1:a432e127e5cd756ec845119ec104af99b2a806e2 + pristine_git_object: 3b4cd992ae65f59d2dd59144aded9311be0aa88a scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -9976,8 +9984,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:194010eeca6ea4256079ef235ac549751778f5e3 - pristine_git_object: 23ec6d61b1489ced1f8f923a5f68a121dae58568 + last_write_checksum: sha1:1d37211f882a611fac524f44f05e86a75e8448f1 + pristine_git_object: ba4305600ee7c677fb0962b892eaa30da4c126d4 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -10024,8 +10032,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:9bbb17a6eaf23c3cef14d9a72be85336a5321490 - pristine_git_object: 518612f8ee2321c331a1b097ee8c5c5136129020 + last_write_checksum: sha1:7075570f13cc6d2d06d7169e2a777ceaf563452e + pristine_git_object: bc6c75f42fe5f7993ac396fb11707cc60e83634f src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -12908,8 +12916,8 @@ trackedFiles: pristine_git_object: 4633e5d7658c500aa903ce8caa8ef86cc97b78eb src/openrouter/components/speechrequest.py: id: 2a9400167112 - last_write_checksum: sha1:aaa3848b4d94cddc33136487e412390faafa9b74 - pristine_git_object: 1f95cfee9d7afc406419c11e4b4c38005af50cfc + last_write_checksum: sha1:282f155b9d0b09e015d3dda0a73abe8f42e44dbc + pristine_git_object: 5a62dc470dde417e458ab488dd92c385dcc59459 src/openrouter/components/stopservertoolswhencondition.py: id: 2deeda4209ac last_write_checksum: sha1:581e0ee62776d42bf598b9f68b998faabfecd3ce @@ -12984,8 +12992,8 @@ trackedFiles: pristine_git_object: 75281f477b0ce85cd1032ed4b0c949a30a51b7f9 src/openrouter/components/sttrequest.py: id: 5fb1d469e16e - last_write_checksum: sha1:84b196eb8bfb9eac3c35879bcd28602ce666ff70 - pristine_git_object: 452ad0871db45705ff25bdf582e4dd245c2de4b8 + last_write_checksum: sha1:95244cf352fde4190323e0560d934bb1c410fcd2 + pristine_git_object: 8deaa5590b601df3481051db86c7b4cab58dfc92 src/openrouter/components/sttresponse.py: id: 2dc8eb8daaca last_write_checksum: sha1:420c65736ba0db3da84592d5639b41b81b6f87c4 @@ -13624,8 +13632,8 @@ trackedFiles: pristine_git_object: 4e8414f223370bff1e4f060919f36f70da6ec40c src/openrouter/operations/createaudiotranscriptions_multipart.py: id: da07d463225a - last_write_checksum: sha1:d7909d045c4116267c398ac0c735037b382c78bc - pristine_git_object: 91eaa7501c49f081ae44ba9d0c307f46b2630e43 + last_write_checksum: sha1:8682e1f679b20c9f20ed9cbc303d129764c4eb84 + pristine_git_object: 62e0f114856f94fed418ea19cf5b279ea918bcd7 src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 last_write_checksum: sha1:8f496fd0e965aba76a0882a3af0382649d0f8c4d @@ -14212,8 +14220,8 @@ trackedFiles: pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 src/openrouter/stt.py: id: fc0c2f669423 - last_write_checksum: sha1:2bd6bfa152883e3b95fbafb097fe77156d89379f - pristine_git_object: d368541ca6c3dc15e7adf5925db8d698afd93ad6 + last_write_checksum: sha1:33a6a6f9973fd1578d6c98720dcde1c17e428f5e + pristine_git_object: 9787a43efe6fbf7233ffcc14a340a29663e61a01 src/openrouter/systemone.py: id: 7e0a0e237bb1 last_write_checksum: sha1:fffd7413e70f4840b793888763631b51929eb766 @@ -14224,8 +14232,8 @@ trackedFiles: pristine_git_object: 701fa8597ff85f41a60736ade55fcb32f9ec7125 src/openrouter/tts.py: id: 5055d4b95f1d - last_write_checksum: sha1:7a6e8693577e95b12772a6b4a60a057cf57ee5eb - pristine_git_object: ddd202a1d8ddc65802990dff8facf2e61e36a7d8 + last_write_checksum: sha1:e771b211ff92fd56d79f2c6ce05fa43211cfdbd8 + pristine_git_object: 6da4bd907cfe243374782b9523bccfad7071976d src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -18244,7 +18252,5 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.observability.list()`: `response.data[]` **Changed** - * `open_router.observability.create()`: `response.data` **Changed** - * `open_router.observability.get()`: `response.data` **Changed** - * `open_router.observability.update()`: `response.data` **Changed** + * `open_router.tts.create_speech()`: `request.provider` **Changed** + * `open_router.stt.create_transcription()`: `request.provider` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 449570e6..f8a63883 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.21 + version: 1.3.22 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 73933ccf..be140ddb 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -28905,10 +28905,28 @@ components: example: 'mistralai/voxtral-mini-tts-2603' type: 'string' provider: - description: 'Provider-specific passthrough configuration' + description: 'Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options' properties: + data_collection: + description: "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + enum: + - 'deny' + - 'allow' + - null + example: 'allow' + title: 'SpeechRequestDataCollection' + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow options: $ref: '#/components/schemas/ProviderOptions' + zdr: + description: 'Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.' + example: true + type: + - 'boolean' + - 'null' type: 'object' response_format: default: 'pcm' @@ -29462,10 +29480,28 @@ components: example: 'openai/whisper-large-v3' type: 'string' provider: - description: 'Provider-specific passthrough configuration' + description: 'Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options' properties: + data_collection: + description: "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + enum: + - 'deny' + - 'allow' + - null + example: 'allow' + title: 'STTRequestDataCollection' + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow options: $ref: '#/components/schemas/ProviderOptions' + zdr: + description: 'Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.' + example: true + type: + - 'boolean' + - 'null' type: 'object' response_format: description: 'Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.' @@ -34223,7 +34259,7 @@ paths: description: 'The model to use for transcription.' type: 'string' provider: - description: 'JSON-encoded provider preferences object, the same shape as the JSON body field: { "options": { "": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.' + description: 'JSON-encoded provider preferences object, the same shape as the JSON body field: { "zdr": true, "data_collection": "deny", "options": { "": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.' type: 'string' response_format: description: 'The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 71310725..e4a17bd1 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:7ecc59f8477c2a4dad600eb698d22e9107814a9062c15b48037813417d96855b - sourceBlobDigest: sha256:c5e595300f1ffcb043e161c34cb62f56f367dc8758066514fa1ae536bb1be990 + sourceRevisionDigest: sha256:ca24e1566753d8f7a103f4983ae6638c283950b90b0dcc6c151c5747819577c4 + sourceBlobDigest: sha256:e6942a48b2145b89c68feb7ed14991264eea09734a53ff363f6a2848296c9d8c tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:7ecc59f8477c2a4dad600eb698d22e9107814a9062c15b48037813417d96855b - sourceBlobDigest: sha256:c5e595300f1ffcb043e161c34cb62f56f367dc8758066514fa1ae536bb1be990 + sourceRevisionDigest: sha256:ca24e1566753d8f7a103f4983ae6638c283950b90b0dcc6c151c5747819577c4 + sourceBlobDigest: sha256:e6942a48b2145b89c68feb7ed14991264eea09734a53ff363f6a2848296c9d8c codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:647bd195e588b6bff60866f8bef70e7bf645e3fefd16af22ebdd7586a3fd9e66 + codeSamplesRevisionDigest: sha256:19fcc3ebdfdb5d287219132c54f7a853732f8c5576e2eea6633af423c75e79b2 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index a9e4c1c5..eb978237 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2979,4 +2979,14 @@ Based on: ### Generated - [python v1.3.21] . ### Releases -- [PyPI v1.3.21] https://pypi.org/project/openrouter/1.3.21 - . \ No newline at end of file +- [PyPI v1.3.21] https://pypi.org/project/openrouter/1.3.21 - . + +## 2026-10-02 21:44:38 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.22] . +### Releases +- [PyPI v1.3.22] https://pypi.org/project/openrouter/1.3.22 - . \ No newline at end of file diff --git a/docs/components/speechrequest.mdx b/docs/components/speechrequest.mdx index 0f96859b..1ffadd62 100644 --- a/docs/components/speechrequest.mdx +++ b/docs/components/speechrequest.mdx @@ -12,7 +12,7 @@ Text-to-speech request input | `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | | `input_references` | List[[components.SpeechInputReference](../components/speechinputreference.mdx)] | :heavy_minus_sign: | Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip); only routed to endpoints that support voice cloning (and multiple references when more than one part is sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. The two modes cannot be mixed. An empty array is treated as no reference. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | | `model` | *str* | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | -| `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | | `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Honored by models that support it (e.g. OpenAI TTS). Other providers either ignore it or return a 400 for a non-default value when the model has no speed control. | 1 | diff --git a/docs/components/speechrequestdatacollection.mdx b/docs/components/speechrequestdatacollection.mdx new file mode 100644 index 00000000..01f84221 --- /dev/null +++ b/docs/components/speechrequestdatacollection.mdx @@ -0,0 +1,25 @@ +--- +title: "SpeechRequestDataCollection" +--- + +Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it + +- deny: use only providers which do not collect user data. + +## Example Usage + +```python +from openrouter.components import SpeechRequestDataCollection + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: SpeechRequestDataCollection = "deny" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"deny"` +- `"allow"` diff --git a/docs/components/speechrequestprovider.mdx b/docs/components/speechrequestprovider.mdx index 3a95d19f..fbfa7149 100644 --- a/docs/components/speechrequestprovider.mdx +++ b/docs/components/speechrequestprovider.mdx @@ -2,11 +2,13 @@ title: "SpeechRequestProvider" --- -Provider-specific passthrough configuration +Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `options` | [Optional[components.ProviderOptions]](../components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data_collection` | [OptionalNullable[components.SpeechRequestDataCollection]](../components/speechrequestdatacollection.mdx) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | allow | +| `options` | [Optional[components.ProviderOptions]](../components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | +| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | \ No newline at end of file diff --git a/docs/components/sttrequest.mdx b/docs/components/sttrequest.mdx index 49ab89df..928d5db3 100644 --- a/docs/components/sttrequest.mdx +++ b/docs/components/sttrequest.mdx @@ -14,7 +14,7 @@ Speech-to-text request input. Accepts a JSON body with input_audio containing ba | `keyterms` | List[*str*] | :heavy_minus_sign: | Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. | [
"OpenRouter",
"Scribe"
] | | `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | | `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | -| `provider` | [Optional[components.STTRequestProvider]](../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `provider` | [Optional[components.STTRequestProvider]](../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `response_format` | [Optional[components.STTRequestResponseFormat]](../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | | `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | diff --git a/docs/components/sttrequestdatacollection.mdx b/docs/components/sttrequestdatacollection.mdx new file mode 100644 index 00000000..293a4f11 --- /dev/null +++ b/docs/components/sttrequestdatacollection.mdx @@ -0,0 +1,25 @@ +--- +title: "STTRequestDataCollection" +--- + +Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it + +- deny: use only providers which do not collect user data. + +## Example Usage + +```python +from openrouter.components import STTRequestDataCollection + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: STTRequestDataCollection = "deny" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"deny"` +- `"allow"` diff --git a/docs/components/sttrequestprovider.mdx b/docs/components/sttrequestprovider.mdx index 5eebff08..ddc964b6 100644 --- a/docs/components/sttrequestprovider.mdx +++ b/docs/components/sttrequestprovider.mdx @@ -2,11 +2,13 @@ title: "STTRequestProvider" --- -Provider-specific passthrough configuration +Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `options` | [Optional[components.ProviderOptions]](../components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data_collection` | [OptionalNullable[components.STTRequestDataCollection]](../components/sttrequestdatacollection.mdx) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | allow | +| `options` | [Optional[components.ProviderOptions]](../components/provideroptions.mdx) | :heavy_minus_sign: | Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. | \{
"openai": \{
"max_tokens": 1000
}
} | +| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | \ No newline at end of file diff --git a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx index 3c8affe7..784fc7b0 100644 --- a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx +++ b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx @@ -11,7 +11,7 @@ title: "CreateAudioTranscriptionsMultipartRequestBody" | `keyterms` | List[*str*] | :heavy_minus_sign: | Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. | | `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | | `model` | *str* | :heavy_check_mark: | The model to use for transcription. | -| `provider` | *Optional[str]* | :heavy_minus_sign: | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | +| `provider` | *Optional[str]* | :heavy_minus_sign: | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "zdr": true, "data_collection": "deny", "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | | `response_format` | [Optional[operations.ResponseFormat]](../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. | | `source_url` | *Optional[str]* | :heavy_minus_sign: | Publicly reachable http(s) URL of the audio file, downloaded by the provider directly (no size limit on our side). The format is derived from the URL path extension. Only supported by some providers; exactly one of file or source_url is required. | diff --git a/docs/sdks/stt/README.mdx b/docs/sdks/stt/README.mdx index c4b66757..50c67920 100644 --- a/docs/sdks/stt/README.mdx +++ b/docs/sdks/stt/README.mdx @@ -52,7 +52,7 @@ with OpenRouter( | `diarize` | *Optional[bool]* | :heavy_minus_sign: | Label each word with the speaker who said it. Speaker labels are returned on the words array (speaker, speaker_label), so response_format must be "verbose_json" (a "json" request is rejected with a 400) and word timestamps are included even when timestamp_granularities omits "word". Only supported by some providers; the request is rejected with a 400 when the selected model cannot diarize. Providers may charge extra. | true | | `keyterms` | List[*str*] | :heavy_minus_sign: | Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. | [
"OpenRouter",
"Scribe"
] | | `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | -| `provider` | [Optional[components.STTRequestProvider]](../../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `provider` | [Optional[components.STTRequestProvider]](../../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `response_format` | [Optional[components.STTRequestResponseFormat]](../../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | | `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | @@ -124,7 +124,7 @@ with OpenRouter( | `file` | [Optional[operations.CreateAudioTranscriptionsMultipartFile]](../../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_minus_sign: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio, or by URL via source_url. Exactly one of file or source_url is required. | | `keyterms` | List[*str*] | :heavy_minus_sign: | Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. | | `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | -| `provider` | *Optional[str]* | :heavy_minus_sign: | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | +| `provider` | *Optional[str]* | :heavy_minus_sign: | JSON-encoded provider preferences object, the same shape as the JSON body field: \{ "zdr": true, "data_collection": "deny", "options": \{ "\": \{ ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. | | `response_format` | [Optional[operations.ResponseFormat]](../../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. | | `source_url` | *Optional[str]* | :heavy_minus_sign: | Publicly reachable http(s) URL of the audio file, downloaded by the provider directly (no size limit on our side). The format is derived from the URL path extension. Only supported by some providers; exactly one of file or source_url is required. | diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index 345d9688..2a3eda68 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -46,7 +46,7 @@ with OpenRouter( | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `input_references` | List[[components.SpeechInputReference](../../components/speechinputreference.mdx)] | :heavy_minus_sign: | Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip); only routed to endpoints that support voice cloning (and multiple references when more than one part is sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. The two modes cannot be mixed. An empty array is treated as no reference. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | -| `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | | `response_format` | [Optional[components.SpeechRequestResponseFormat]](../../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | | `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Honored by models that support it (e.g. OpenAI TTS). Other providers either ignore it or return a 400 for a non-default value when the model has no speed control. | 1 | diff --git a/pyproject.toml b/pyproject.toml index e3e7ae7f..3b4cd992 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.21" +version = "1.3.22" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 23ec6d61..ba430560 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.21" +__version__: str = "1.3.22" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.21 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.22 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 518612f8..bc6c75f4 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -3855,6 +3855,7 @@ ) from .speechrequest import ( SpeechRequest, + SpeechRequestDataCollection, SpeechRequestProvider, SpeechRequestProviderTypedDict, SpeechRequestResponseFormat, @@ -3931,6 +3932,7 @@ from .sttinputaudio import STTInputAudio, STTInputAudioTypedDict from .sttrequest import ( STTRequest, + STTRequestDataCollection, STTRequestProvider, STTRequestProviderTypedDict, STTRequestResponseFormat, @@ -6914,6 +6916,7 @@ "STTInputAudio", "STTInputAudioTypedDict", "STTRequest", + "STTRequestDataCollection", "STTRequestProvider", "STTRequestProviderTypedDict", "STTRequestResponseFormat", @@ -7028,6 +7031,7 @@ "SpeechInputReferenceTextTypedDict", "SpeechInputReferenceTypedDict", "SpeechRequest", + "SpeechRequestDataCollection", "SpeechRequestProvider", "SpeechRequestProviderTypedDict", "SpeechRequestResponseFormat", @@ -10295,6 +10299,7 @@ "SpeechInputReferenceTextType": ".speechinputreferencetext", "SpeechInputReferenceTextTypedDict": ".speechinputreferencetext", "SpeechRequest": ".speechrequest", + "SpeechRequestDataCollection": ".speechrequest", "SpeechRequestProvider": ".speechrequest", "SpeechRequestProviderTypedDict": ".speechrequest", "SpeechRequestResponseFormat": ".speechrequest", @@ -10349,6 +10354,7 @@ "STTInputAudio": ".sttinputaudio", "STTInputAudioTypedDict": ".sttinputaudio", "STTRequest": ".sttrequest", + "STTRequestDataCollection": ".sttrequest", "STTRequestProvider": ".sttrequest", "STTRequestProviderTypedDict": ".sttrequest", "STTRequestResponseFormat": ".sttrequest", diff --git a/src/openrouter/components/speechrequest.py b/src/openrouter/components/speechrequest.py index 1f95cfee..5a62dc47 100644 --- a/src/openrouter/components/speechrequest.py +++ b/src/openrouter/components/speechrequest.py @@ -4,37 +4,85 @@ from .provideroptions import ProviderOptions, ProviderOptionsTypedDict from .speechinputreference import SpeechInputReference, SpeechInputReferenceTypedDict from .traceconfig import TraceConfig, TraceConfigTypedDict -from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) from pydantic import model_serializer from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypedDict +SpeechRequestDataCollection = Union[ + Literal[ + "deny", + "allow", + ], + UnrecognizedStr, +] +r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it + +- deny: use only providers which do not collect user data. +""" + + class SpeechRequestProviderTypedDict(TypedDict): - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" + + data_collection: NotRequired[Nullable[SpeechRequestDataCollection]] + 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. + """ options: NotRequired[ProviderOptionsTypedDict] r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" + zdr: NotRequired[Nullable[bool]] + r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" class SpeechRequestProvider(BaseModel): - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" + + data_collection: OptionalNullable[SpeechRequestDataCollection] = 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. + """ options: Optional[ProviderOptions] = None r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" + zdr: OptionalNullable[bool] = UNSET + r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["options"]) + optional_fields = set(["data_collection", "options", "zdr"]) + nullable_fields = set(["data_collection", "zdr"]) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): m[k] = val return m @@ -60,7 +108,7 @@ class SpeechRequestTypedDict(TypedDict): input_references: NotRequired[List[SpeechInputReferenceTypedDict]] r"""Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip); only routed to endpoints that support voice cloning (and multiple references when more than one part is sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. The two modes cannot be mixed. An empty array is treated as no reference.""" provider: NotRequired[SpeechRequestProviderTypedDict] - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" response_format: NotRequired[SpeechRequestResponseFormat] r"""Audio output format""" session_id: NotRequired[str] @@ -88,7 +136,7 @@ class SpeechRequest(BaseModel): r"""Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip); only routed to endpoints that support voice cloning (and multiple references when more than one part is sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. The two modes cannot be mixed. An empty array is treated as no reference.""" provider: Optional[SpeechRequestProvider] = None - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" response_format: Optional[SpeechRequestResponseFormat] = "pcm" r"""Audio output format""" diff --git a/src/openrouter/components/sttrequest.py b/src/openrouter/components/sttrequest.py index 452ad087..8deaa559 100644 --- a/src/openrouter/components/sttrequest.py +++ b/src/openrouter/components/sttrequest.py @@ -5,37 +5,85 @@ from .sttinputaudio import STTInputAudio, STTInputAudioTypedDict from .stttimestampgranularity import STTTimestampGranularity from .traceconfig import TraceConfig, TraceConfigTypedDict -from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) from pydantic import model_serializer from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypedDict +STTRequestDataCollection = Union[ + Literal[ + "deny", + "allow", + ], + UnrecognizedStr, +] +r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it + +- deny: use only providers which do not collect user data. +""" + + class STTRequestProviderTypedDict(TypedDict): - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" + + data_collection: NotRequired[Nullable[STTRequestDataCollection]] + 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. + """ options: NotRequired[ProviderOptionsTypedDict] r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" + zdr: NotRequired[Nullable[bool]] + r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" class STTRequestProvider(BaseModel): - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" + + data_collection: OptionalNullable[STTRequestDataCollection] = 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. + """ options: Optional[ProviderOptions] = None r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" + zdr: OptionalNullable[bool] = UNSET + r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["options"]) + optional_fields = set(["data_collection", "options", "zdr"]) + nullable_fields = set(["data_collection", "zdr"]) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): m[k] = val return m @@ -65,7 +113,7 @@ class STTRequestTypedDict(TypedDict): language: NotRequired[str] r"""ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.""" provider: NotRequired[STTRequestProviderTypedDict] - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" response_format: NotRequired[STTRequestResponseFormat] r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" session_id: NotRequired[str] @@ -99,7 +147,7 @@ class STTRequest(BaseModel): r"""ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.""" provider: Optional[STTRequestProvider] = None - r"""Provider-specific passthrough configuration""" + r"""Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" response_format: Optional[STTRequestResponseFormat] = None r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" diff --git a/src/openrouter/operations/createaudiotranscriptions_multipart.py b/src/openrouter/operations/createaudiotranscriptions_multipart.py index 91eaa750..62e0f114 100644 --- a/src/openrouter/operations/createaudiotranscriptions_multipart.py +++ b/src/openrouter/operations/createaudiotranscriptions_multipart.py @@ -150,7 +150,7 @@ class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict): language: NotRequired[str] r"""The language of the input audio (ISO-639-1).""" provider: NotRequired[str] - r"""JSON-encoded provider preferences object, the same shape as the JSON body field: { \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.""" + r"""JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.""" response_format: NotRequired[ResponseFormat] r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).""" session_id: NotRequired[str] @@ -191,7 +191,7 @@ class CreateAudioTranscriptionsMultipartRequestBody(BaseModel): r"""The language of the input audio (ISO-639-1).""" provider: Annotated[Optional[str], FieldMetadata(multipart=True)] = None - r"""JSON-encoded provider preferences object, the same shape as the JSON body field: { \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.""" + r"""JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object.""" response_format: Annotated[ Optional[ResponseFormat], FieldMetadata(multipart=True) diff --git a/src/openrouter/stt.py b/src/openrouter/stt.py index d368541c..9787a43e 100644 --- a/src/openrouter/stt.py +++ b/src/openrouter/stt.py @@ -57,7 +57,7 @@ def create_transcription( :param diarize: Label each word with the speaker who said it. Speaker labels are returned on the words array (speaker, speaker_label), so response_format must be \"verbose_json\" (a \"json\" request is rejected with a 400) and word timestamps are included even when timestamp_granularities omits \"word\". Only supported by some providers; the request is rejected with a 400 when the selected model cannot diarize. Providers may charge extra. :param keyterms: Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. - :param provider: Provider-specific passthrough configuration + :param provider: Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. :param temperature: Sampling temperature for transcription @@ -286,7 +286,7 @@ async def create_transcription_async( :param diarize: Label each word with the speaker who said it. Speaker labels are returned on the words array (speaker, speaker_label), so response_format must be \"verbose_json\" (a \"json\" request is rejected with a 400) and word timestamps are included even when timestamp_granularities omits \"word\". Only supported by some providers; the request is rejected with a 400 when the selected model cannot diarize. Providers may charge extra. :param keyterms: Domain terms, names, or phrases to bias recognition toward. Only supported by some providers; the request is rejected with a 400 when the selected model cannot use keyterms. Providers may cap the number of terms or characters per term and may charge extra. :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. - :param provider: Provider-specific passthrough configuration + :param provider: Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. :param temperature: Sampling temperature for transcription @@ -517,7 +517,7 @@ def create_transcription_multipart( :param file: The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio, or by URL via source_url. Exactly one of file or source_url is required. :param keyterms: Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. :param language: The language of the input audio (ISO-639-1). - :param provider: JSON-encoded provider preferences object, the same shape as the JSON body field: { \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. + :param provider: JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. :param source_url: Publicly reachable http(s) URL of the audio file, downloaded by the provider directly (no size limit on our side). The format is derived from the URL path extension. Only supported by some providers; exactly one of file or source_url is required. @@ -752,7 +752,7 @@ async def create_transcription_multipart_async( :param file: The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio, or by URL via source_url. Exactly one of file or source_url is required. :param keyterms: Domain terms, names, or phrases to bias recognition toward; repeat the part once per term (keyterms=... is also accepted). Only supported by some providers; 400 when the selected model cannot use keyterms. :param language: The language of the input audio (ISO-639-1). - :param provider: JSON-encoded provider preferences object, the same shape as the JSON body field: { \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. + :param provider: JSON-encoded provider preferences object, the same shape as the JSON body field: { \"zdr\": true, \"data_collection\": \"deny\", \"options\": { \"\": { ... } } }. Only options for the matched provider are forwarded. Must decode to a JSON object. :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. :param source_url: Publicly reachable http(s) URL of the audio file, downloaded by the provider directly (no size limit on our side). The format is derived from the URL path extension. Only supported by some providers; exactly one of file or source_url is required. diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py index ddd202a1..6da4bd90 100644 --- a/src/openrouter/tts.py +++ b/src/openrouter/tts.py @@ -60,7 +60,7 @@ def create_speech( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param input_references: Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip); only routed to endpoints that support voice cloning (and multiple references when more than one part is sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. The two modes cannot be mixed. An empty array is treated as no reference. - :param provider: Provider-specific passthrough configuration + :param provider: Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options :param response_format: Audio output format :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. :param speed: Playback speed multiplier. Honored by models that support it (e.g. OpenAI TTS). Other providers either ignore it or return a 400 for a non-default value when the model has no speed control. @@ -313,7 +313,7 @@ async def create_speech_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param input_references: Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip); only routed to endpoints that support voice cloning (and multiple references when more than one part is sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. The two modes cannot be mixed. An empty array is treated as no reference. - :param provider: Provider-specific passthrough configuration + :param provider: Provider configuration: data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options :param response_format: Audio output format :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. :param speed: Playback speed multiplier. Honored by models that support it (e.g. OpenAI TTS). Other providers either ignore it or return a 400 for a non-default value when the model has no speed control. diff --git a/uv.lock b/uv.lock index fb12f003..eb20c0a7 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.21" +version = "1.3.22" source = { editable = "." } dependencies = [ { name = "httpcore" },