diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 88923a8c..035cf037 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: da3ef99dd6fb0701b7b3b4ec84d77525 + docChecksum: 64e7b923ccc491202799aba529f33eca docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.240 - configChecksum: 4533f531616726421777636817f13109 + releaseVersion: 1.3.241 + configChecksum: 733df664ae737d2162cb634fbc9338c0 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: d5fab7d1-c810-43a6-9f63-74fe3a57b674 - pristine_commit_hash: 617c5a2d83097a5c512d7f11afed0ca3397e9ef3 - pristine_tree_hash: a99176549e8fc9caa467a1630587ee90d4427087 + generation_id: 20d27faa-55db-4f93-9708-fb179c4a5942 + pristine_commit_hash: 2381b4072d2e03c024a6a9753b6a41d6da36e0b9 + pristine_tree_hash: 071fd4b08db4cc8a3dde2ed11d87e386dea75762 features: python: acceptHeaders: 3.0.0 @@ -8684,8 +8684,8 @@ trackedFiles: pristine_git_object: 79cc36d2d2449741618ff97eaf90f1867a6eb72b docs/components/speechinputmodalitysupportedinputs3.mdx: id: 6d3a586321bf - last_write_checksum: sha1:d2b7aed01d1a75f3901db7e4d9fe3a75da46d5aa - pristine_git_object: 60ae8dfdb9ba9c92fe446def171f0ebb4511666c + last_write_checksum: sha1:841d926d4f7e56b172d6650ee4efb426a0751542 + pristine_git_object: 8f8d7782eec88b3ec8c001154079ded9439e52c9 docs/components/speechinputmodalitytext.mdx: id: bc020871a6bd last_write_checksum: sha1:f6663f63dee7bcc357c1453fd3b7986921195dce @@ -8708,8 +8708,8 @@ trackedFiles: pristine_git_object: 5c8b67ed230b146d2b15199b9cdeb34cb6c69718 docs/components/speechinputmodalityvideo.mdx: id: 99ea114b6fa5 - last_write_checksum: sha1:40a448891f421152c44c815fc9161f78c6be7e04 - pristine_git_object: f2404cb0512baf06556e71fba9f0032db146911d + last_write_checksum: sha1:6a1fd98ca0bb31aaed0d2220544089698ab83f04 + pristine_git_object: 5168f36a734cc1047e256e0cdba5480603b98088 docs/components/speechinputreference.mdx: id: eb5af16936c7 last_write_checksum: sha1:b696e042b0ad5f55d76a12f10492ab763c34c5f4 @@ -8748,8 +8748,8 @@ trackedFiles: pristine_git_object: 34f4f07fb3008df83646fa3d88ce04009274246a docs/components/speechinputreferencevideo.mdx: id: 62b98e023125 - last_write_checksum: sha1:ea573c5d7e096ad1e57f49678a8d0b369b28c88a - pristine_git_object: c1d68b1a481378c99f6194a438a44f5736fdbd92 + last_write_checksum: sha1:27435d2eb070841c1e6a087548cfbc042bb3dc05 + pristine_git_object: 08390aed703799ac92e3c2ebdcc3812c93266257 docs/components/speechinputreferencevideoinput.mdx: id: e949ba183b5a last_write_checksum: sha1:d13e41894939538d1a18142926aa1422d008bfd0 @@ -8796,8 +8796,8 @@ trackedFiles: pristine_git_object: 38be122fce694e660cd56d82182dd3d15098479d docs/components/speechrequest.mdx: id: 06e81b0433f6 - last_write_checksum: sha1:cc260ca2df52bda4375414e89f584f07e00cd26b - pristine_git_object: b790ed7575b3bbaa6449fc3ab5b49ba6601ae704 + last_write_checksum: sha1:f4a57410dea91dc21a19a50493051e2cf0c2d563 + pristine_git_object: 97d60e2b42e158b78ff0d39a1b0116ae72abadc9 docs/components/speechrequestdatacollection.mdx: id: 6c5938568888 last_write_checksum: sha1:89a08b4c4de66c1ef7676792a38747e030ed6729 @@ -8820,8 +8820,8 @@ trackedFiles: pristine_git_object: bd91e8ae980d60e10df4aeb9db617cbf3fd20e43 docs/components/speechrequestresponseformat.mdx: id: bd09f77a4a90 - last_write_checksum: sha1:1cc50580c3e1594851a1cfbfe4b56ec7397817c2 - pristine_git_object: 9e08b7ba425de5f336923a69054fc4a238f504b6 + last_write_checksum: sha1:5a010f864526cc43df754ece68da5e144da44ec9 + pristine_git_object: 28816d7a32f629289c2a932e9c16a17183c25e69 docs/components/speechsupportedparameters.mdx: id: e40d7c8fb1e4 last_write_checksum: sha1:aa79177157900a8673a1e31311462e645d933e29 @@ -12636,8 +12636,8 @@ trackedFiles: pristine_git_object: bcbe30fccceb97caa3a0e170038245dcc7f1e540 docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:f2252822abd85d585c44ff05bb768bfbeb8b64a4 - pristine_git_object: dcd1338038d52e7d49f309a67d02ead65c64c5d3 + last_write_checksum: sha1:ac8c0a881fbee9549e886c00414834cac5a66cb9 + pristine_git_object: ef6bb7ffbb2f294c7e361d1d1629610794ad8b51 docs/sdks/vault/README.mdx: id: 3738c6722acd last_write_checksum: sha1:290b439ff730b9eabf4a6ef93737d1c61006b0fa @@ -12656,8 +12656,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:cbda1a63debfd6b18986ab731046184f24d6aeee - pristine_git_object: 5b190307c9e3ceaa6494cd57486013136ad207b7 + last_write_checksum: sha1:a6edd047dbf95c88285116f5b1cb44088c9105b3 + pristine_git_object: ab4270953f477a9df0259b496171ace44dc03324 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -12684,8 +12684,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:20ad8201ea701bf76991447f9ee1adcf2e55d9be - pristine_git_object: 3e10020211fd4f18910da7acd0aaf3da351dd651 + last_write_checksum: sha1:36793cac21bd57fa89d3bead4576c38cf4a2d309 + pristine_git_object: 5e3770576718d990d4f714713ad2c40241a2e9aa src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -16216,8 +16216,8 @@ trackedFiles: pristine_git_object: cc45b6da88350cd9ab4b9c6456b5dd81c0b4c8e9 src/openrouter/components/speechinputmodality.py: id: d475c5a1288b - last_write_checksum: sha1:53410a032e6e412c23abe7f5d1be61e8470625cb - pristine_git_object: 2b8402c3566dc9826fa0dcd17af4d23625db3162 + last_write_checksum: sha1:e5a37779aea96d97c8c41b128117d814ebd50375 + pristine_git_object: beba53e284182e3e3793b26ba3e4a9c1f46c356a src/openrouter/components/speechinputreference.py: id: 8e2b63f83354 last_write_checksum: sha1:ca75ac4bf88336c0a6c00d0d9fce34fd4b34af87 @@ -16244,8 +16244,8 @@ trackedFiles: pristine_git_object: 4633e5d7658c500aa903ce8caa8ef86cc97b78eb src/openrouter/components/speechinputreferencevideo.py: id: 8f9dad33c87b - last_write_checksum: sha1:ae5090d88f4a0f7af4c1abdd1b350fb85a92e233 - pristine_git_object: 5f045bb6f885f7041c2baa5dbd4a26d0f45002c3 + last_write_checksum: sha1:351fc104881ef93f909a6194581e96b7f1b12248 + pristine_git_object: 682182187f5d3170825961f2b0815952c5a35bd7 src/openrouter/components/speechinputreferencevideoinput.py: id: 1bb987c0328e last_write_checksum: sha1:07bcdcf0170efc4b3f3b1968df04456e7d7256df @@ -16276,8 +16276,8 @@ trackedFiles: pristine_git_object: 69c0355e7d575e6b7c52183d3cd5696611e4e8bf src/openrouter/components/speechrequest.py: id: 2a9400167112 - last_write_checksum: sha1:061ab23a6ac8233a6cb0031fceafd28862c04b3f - pristine_git_object: 5246bf6da0a5906a4a88bcdeab7c220aaa89e884 + last_write_checksum: sha1:92375ff35858416c3e95123e58f6ad564a9a0e86 + pristine_git_object: 8262e372b4308b7eeb0909ebd1f4dd238b2ffb21 src/openrouter/components/speechsupportedparameters.py: id: 618f33cc9229 last_write_checksum: sha1:6f3fe1b11d56407227306a93fb6d232066158913 @@ -17844,8 +17844,8 @@ trackedFiles: pristine_git_object: 701fa8597ff85f41a60736ade55fcb32f9ec7125 src/openrouter/tts.py: id: 5055d4b95f1d - last_write_checksum: sha1:a199e7b11cda1346acf9809160644c4ec80ab463 - pristine_git_object: 8ab79410ac82a6547979d53b6005a83852fa3f13 + last_write_checksum: sha1:ad38f58ec523d58d5dabcd9174ad6f34974b2e77 + pristine_git_object: 1726f3c855f4a89ba3d1adbec1f88f08003098c6 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -23395,4 +23395,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.batch.create_batches()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.batch.get_batches()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.batch.cancel()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.batch.get_results()`: `response.data[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.tts.create_speech()`: \n * `request.input_references[].union(video_url)` **Added**\n* `open_router.tts.list_models()`: `response.data[].endpoints[].input_modalities[].union(video)` **Added**\n* `open_router.tts.get_model()`: `response.endpoints[].input_modalities[].union(video)` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.messages[].content.union(Array<>)[]` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 951b437c..238e4ae9 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.240 + version: 1.3.241 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 9ff044ee..16a52aac 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -36593,7 +36593,7 @@ components: type: 'object' - properties: supported_inputs: - description: '`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint''s video rate.' + description: '`references` is how many `video_url` parts a request may send. A video may come with `input_audio` clips, never with an image, but only on an endpoint that accepts both itself: the model lists each modality from any endpoint, so check the endpoint''s own `audio` modality for its clip limit; and the request bills at the endpoint''s video rate.' properties: references: $ref: '#/components/schemas/SpeechReferenceCount' @@ -36716,7 +36716,7 @@ components: - 'text' type: 'object' SpeechInputReferenceVideo: - description: 'Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate.' + description: 'Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). At most one per request; it may come with one to three `input_audio` parts (voices for the footage, with `input` giving the words they speak) but never with an `image_url` part. Only routed to endpoints that support video references, which bill at their video rate.' example: type: 'video_url' video_url: @@ -37024,7 +37024,7 @@ components: input: $ref: '#/components/schemas/SpeechInput' input_references: - description: '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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference.' + description: '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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL, optionally with one to three `input_audio` parts (and their `text` transcripts) grouped as in audio mode, and no `image_url` part; Seed Audio 1.5 ignores those transcripts, so the words the voices speak go in `input`; only routed to endpoints that support video references (and voice cloning when clips are sent, plus multiple references for two or three clips). An empty array is treated as no reference.' example: - input_audio: data: 'data:audio/wav;base64,UklGRuQXDABXQVZF...' @@ -37117,7 +37117,7 @@ components: type: 'object' response_format: default: 'pcm' - description: 'Audio output format' + description: 'Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty.' enum: - 'mp3' - 'pcm' @@ -37136,7 +37136,7 @@ components: format: 'double' type: 'number' timestamp_granularities: - description: 'Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings.' + description: 'Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. The audio defaults to `mp3` unless `response_format` is set. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings.' example: - 'word' items: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 13c811da..8817746f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:502093455748746ced1b5a75d7f2679fb7a63d58a0d640187714f81a76ea8d8c - sourceBlobDigest: sha256:64142d11f18120cbc817c7e3922fecb9f547447c2672f6e52b05e959912382ae + sourceRevisionDigest: sha256:7f7594a96488070a331c79d089e447dec670c4b6c5d2131817a36c308cc6c839 + sourceBlobDigest: sha256:f5ad4581090d525c83cb0c48330156ea7a27956b7f6a98a2f41fa4a276d27bbc tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:502093455748746ced1b5a75d7f2679fb7a63d58a0d640187714f81a76ea8d8c - sourceBlobDigest: sha256:64142d11f18120cbc817c7e3922fecb9f547447c2672f6e52b05e959912382ae + sourceRevisionDigest: sha256:7f7594a96488070a331c79d089e447dec670c4b6c5d2131817a36c308cc6c839 + sourceBlobDigest: sha256:f5ad4581090d525c83cb0c48330156ea7a27956b7f6a98a2f41fa4a276d27bbc codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:655ccaabfdf517078bc953cd3ac42038a7f8f90834a8e754dd664bc89ecc7059 + codeSamplesRevisionDigest: sha256:05a8368709d998b1baac96acfa5925e174e4e95049684059ccecb5f1d41ab315 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 50306e5e..87b59e93 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -5169,4 +5169,14 @@ Based on: ### Generated - [python v1.3.240] . ### Releases -- [PyPI v1.3.240] https://pypi.org/project/openrouter/1.3.240 - . \ No newline at end of file +- [PyPI v1.3.240] https://pypi.org/project/openrouter/1.3.240 - . + +## 2026-12-04 00:57:51 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.241] . +### Releases +- [PyPI v1.3.241] https://pypi.org/project/openrouter/1.3.241 - . \ No newline at end of file diff --git a/docs/components/speechinputmodalitysupportedinputs3.mdx b/docs/components/speechinputmodalitysupportedinputs3.mdx index 60ae8dfd..8f8d7782 100644 --- a/docs/components/speechinputmodalitysupportedinputs3.mdx +++ b/docs/components/speechinputmodalitysupportedinputs3.mdx @@ -2,7 +2,7 @@ title: "SpeechInputModalitySupportedInputs3" --- -`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate. +`references` is how many `video_url` parts a request may send. A video may come with `input_audio` clips, never with an image, but only on an endpoint that accepts both itself: the model lists each modality from any endpoint, so check the endpoint's own `audio` modality for its clip limit; and the request bills at the endpoint's video rate. ## Fields diff --git a/docs/components/speechinputmodalityvideo.mdx b/docs/components/speechinputmodalityvideo.mdx index f2404cb0..5168f36a 100644 --- a/docs/components/speechinputmodalityvideo.mdx +++ b/docs/components/speechinputmodalityvideo.mdx @@ -4,7 +4,7 @@ title: "SpeechInputModalityVideo" ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `supported_inputs` | [components.SpeechInputModalitySupportedInputs3](../components/speechinputmodalitysupportedinputs3.mdx) | ✔️ | `references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate. | -| `type` | [components.SpeechInputModalityTypeVideo](../components/speechinputmodalitytypevideo.mdx) | ✔️ | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `supported_inputs` | [components.SpeechInputModalitySupportedInputs3](../components/speechinputmodalitysupportedinputs3.mdx) | ✔️ | `references` is how many `video_url` parts a request may send. A video may come with `input_audio` clips, never with an image, but only on an endpoint that accepts both itself: the model lists each modality from any endpoint, so check the endpoint's own `audio` modality for its clip limit; and the request bills at the endpoint's video rate. | +| `type` | [components.SpeechInputModalityTypeVideo](../components/speechinputmodalitytypevideo.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechinputreferencevideo.mdx b/docs/components/speechinputreferencevideo.mdx index c1d68b1a..08390aed 100644 --- a/docs/components/speechinputreferencevideo.mdx +++ b/docs/components/speechinputreferencevideo.mdx @@ -2,7 +2,7 @@ title: "SpeechInputReferenceVideo" --- -Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate. +Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). At most one per request; it may come with one to three `input_audio` parts (voices for the footage, with `input` giving the words they speak) but never with an `image_url` part. Only routed to endpoints that support video references, which bill at their video rate. ## Fields diff --git a/docs/components/speechrequest.mdx b/docs/components/speechrequest.mdx index b790ed75..97d60e2b 100644 --- a/docs/components/speechrequest.mdx +++ b/docs/components/speechrequest.mdx @@ -7,18 +7,18 @@ Text-to-speech request input ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `input` | [components.SpeechInput](../components/speechinput.mdx) | ✔️ | Text to synthesize, or a list of turns for multi-speaker input. Each turn has its own text, voice, and instructions. Multi-speaker input is supported by Gemini TTS models, by Fish Audio models other than S1, and by Speechify dialogue models. | Hello world | -| `input_references` | List[[components.SpeechInputReference](../components/speechinputreference.mdx)] | ➖ | 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. 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"
}
] | -| `instructions` | *Optional[str]* | ➖ | Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. | Speak in a warm and friendly tone. | -| `model` | *str* | ✔️ | TTS model identifier | mistralai/voxtral-mini-tts-2603 | -| `output_delivery` | [Optional[components.OutputDelivery]](../components/outputdelivery.mdx) | ➖ | `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. | stream | -| `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | -| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | ➖ | Audio output format | pcm | -| `session_id` | *Optional[str]* | ➖ | 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]* | ➖ | 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 | -| `timestamp_granularities` | List[[components.TimestampGranularity](../components/timestampgranularity.mdx)] | ➖ | Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. | [
"word"
] | -| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | -| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | -| `voice` | *Optional[str]* | ➖ | Voice identifier (provider-specific). Required by most providers; only Seed Audio, HeyGen, Fish Audio, AssemblyAI, Speechify accept requests without it. | en_paul_neutral | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `input` | [components.SpeechInput](../components/speechinput.mdx) | ✔️ | Text to synthesize, or a list of turns for multi-speaker input. Each turn has its own text, voice, and instructions. Multi-speaker input is supported by Gemini TTS models, by Fish Audio models other than S1, and by Speechify dialogue models. | Hello world | +| `input_references` | List[[components.SpeechInputReference](../components/speechinputreference.mdx)] | ➖ | 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL, optionally with one to three `input_audio` parts (and their `text` transcripts) grouped as in audio mode, and no `image_url` part; Seed Audio 1.5 ignores those transcripts, so the words the voices speak go in `input`; only routed to endpoints that support video references (and voice cloning when clips are sent, plus multiple references for two or three clips). 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"
}
] | +| `instructions` | *Optional[str]* | ➖ | Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. | Speak in a warm and friendly tone. | +| `model` | *str* | ✔️ | TTS model identifier | mistralai/voxtral-mini-tts-2603 | +| `output_delivery` | [Optional[components.OutputDelivery]](../components/outputdelivery.mdx) | ➖ | `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. | stream | +| `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | ➖ | Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty. | pcm | +| `session_id` | *Optional[str]* | ➖ | 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]* | ➖ | 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 | +| `timestamp_granularities` | List[[components.TimestampGranularity](../components/timestampgranularity.mdx)] | ➖ | Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. The audio defaults to `mp3` unless `response_format` is set. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. | [
"word"
] | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | +| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | +| `voice` | *Optional[str]* | ➖ | Voice identifier (provider-specific). Required by most providers; only Seed Audio, HeyGen, Fish Audio, AssemblyAI, Speechify accept requests without it. | en_paul_neutral | \ No newline at end of file diff --git a/docs/components/speechrequestresponseformat.mdx b/docs/components/speechrequestresponseformat.mdx index 9e08b7ba..28816d7a 100644 --- a/docs/components/speechrequestresponseformat.mdx +++ b/docs/components/speechrequestresponseformat.mdx @@ -2,7 +2,7 @@ title: "SpeechRequestResponseFormat" --- -Audio output format +Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty. ## Example Usage diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index dcd13380..ef6bb7ff 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -40,25 +40,25 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `input` | [components.SpeechInput](../../components/speechinput.mdx) | ✔️ | Text to synthesize, or a list of turns for multi-speaker input. Each turn has its own text, voice, and instructions. Multi-speaker input is supported by Gemini TTS models, by Fish Audio models other than S1, and by Speechify dialogue models. | Hello world | -| `model` | *str* | ✔️ | TTS model identifier | mistralai/voxtral-mini-tts-2603 | -| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | -| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `input_references` | List[[components.SpeechInputReference](../../components/speechinputreference.mdx)] | ➖ | 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. 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"
}
] | -| `instructions` | *Optional[str]* | ➖ | Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. | Speak in a warm and friendly tone. | -| `output_delivery` | [Optional[components.OutputDelivery]](../../components/outputdelivery.mdx) | ➖ | `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. | stream | -| `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | -| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../../components/speechrequestresponseformat.mdx) | ➖ | Audio output format | pcm | -| `session_id` | *Optional[str]* | ➖ | 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]* | ➖ | 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 | -| `timestamp_granularities` | List[[components.TimestampGranularity](../../components/timestampgranularity.mdx)] | ➖ | Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. | [
"word"
] | -| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | -| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | -| `voice` | *Optional[str]* | ➖ | Voice identifier (provider-specific). Required by most providers; only Seed Audio, HeyGen, Fish Audio, AssemblyAI, Speechify accept requests without it. | en_paul_neutral | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `input` | [components.SpeechInput](../../components/speechinput.mdx) | ✔️ | Text to synthesize, or a list of turns for multi-speaker input. Each turn has its own text, voice, and instructions. Multi-speaker input is supported by Gemini TTS models, by Fish Audio models other than S1, and by Speechify dialogue models. | Hello world | +| `model` | *str* | ✔️ | TTS model identifier | mistralai/voxtral-mini-tts-2603 | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `input_references` | List[[components.SpeechInputReference](../../components/speechinputreference.mdx)] | ➖ | 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL, optionally with one to three `input_audio` parts (and their `text` transcripts) grouped as in audio mode, and no `image_url` part; Seed Audio 1.5 ignores those transcripts, so the words the voices speak go in `input`; only routed to endpoints that support video references (and voice cloning when clips are sent, plus multiple references for two or three clips). 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"
}
] | +| `instructions` | *Optional[str]* | ➖ | Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. | Speak in a warm and friendly tone. | +| `output_delivery` | [Optional[components.OutputDelivery]](../../components/outputdelivery.mdx) | ➖ | `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. | stream | +| `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../../components/speechrequestresponseformat.mdx) | ➖ | Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty. | pcm | +| `session_id` | *Optional[str]* | ➖ | 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]* | ➖ | 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 | +| `timestamp_granularities` | List[[components.TimestampGranularity](../../components/timestampgranularity.mdx)] | ➖ | Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. The audio defaults to `mp3` unless `response_format` is set. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. | [
"word"
] | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | +| `user` | *Optional[str]* | ➖ | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 | +| `voice` | *Optional[str]* | ➖ | Voice identifier (provider-specific). Required by most providers; only Seed Audio, HeyGen, Fish Audio, AssemblyAI, Speechify accept requests without it. | en_paul_neutral | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 5b190307..ab427095 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.240" +version = "1.3.241" 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 3e100202..5e377057 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.240" +__version__: str = "1.3.241" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.240 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.241 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/speechinputmodality.py b/src/openrouter/components/speechinputmodality.py index 2b8402c3..beba53e2 100644 --- a/src/openrouter/components/speechinputmodality.py +++ b/src/openrouter/components/speechinputmodality.py @@ -12,13 +12,13 @@ class SpeechInputModalitySupportedInputs3TypedDict(TypedDict): - r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + r"""`references` is how many `video_url` parts a request may send. A video may come with `input_audio` clips, never with an image, but only on an endpoint that accepts both itself: the model lists each modality from any endpoint, so check the endpoint's own `audio` modality for its clip limit; and the request bills at the endpoint's video rate.""" references: SpeechReferenceCountTypedDict class SpeechInputModalitySupportedInputs3(BaseModel): - r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + r"""`references` is how many `video_url` parts a request may send. A video may come with `input_audio` clips, never with an image, but only on an endpoint that accepts both itself: the model lists each modality from any endpoint, so check the endpoint's own `audio` modality for its clip limit; and the request bills at the endpoint's video rate.""" references: SpeechReferenceCount @@ -28,13 +28,13 @@ class SpeechInputModalitySupportedInputs3(BaseModel): class SpeechInputModalityVideoTypedDict(TypedDict): supported_inputs: SpeechInputModalitySupportedInputs3TypedDict - r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + r"""`references` is how many `video_url` parts a request may send. A video may come with `input_audio` clips, never with an image, but only on an endpoint that accepts both itself: the model lists each modality from any endpoint, so check the endpoint's own `audio` modality for its clip limit; and the request bills at the endpoint's video rate.""" type: SpeechInputModalityTypeVideo class SpeechInputModalityVideo(BaseModel): supported_inputs: SpeechInputModalitySupportedInputs3 - r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + r"""`references` is how many `video_url` parts a request may send. A video may come with `input_audio` clips, never with an image, but only on an endpoint that accepts both itself: the model lists each modality from any endpoint, so check the endpoint's own `audio` modality for its clip limit; and the request bills at the endpoint's video rate.""" type: SpeechInputModalityTypeVideo diff --git a/src/openrouter/components/speechinputreferencevideo.py b/src/openrouter/components/speechinputreferencevideo.py index 5f045bb6..68218218 100644 --- a/src/openrouter/components/speechinputreferencevideo.py +++ b/src/openrouter/components/speechinputreferencevideo.py @@ -14,7 +14,7 @@ class SpeechInputReferenceVideoTypedDict(TypedDict): - r"""Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate.""" + r"""Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). At most one per request; it may come with one to three `input_audio` parts (voices for the footage, with `input` giving the words they speak) but never with an `image_url` part. Only routed to endpoints that support video references, which bill at their video rate.""" type: SpeechInputReferenceVideoType video_url: SpeechInputReferenceVideoInputTypedDict @@ -22,7 +22,7 @@ class SpeechInputReferenceVideoTypedDict(TypedDict): class SpeechInputReferenceVideo(BaseModel): - r"""Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate.""" + r"""Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). At most one per request; it may come with one to three `input_audio` parts (voices for the footage, with `input` giving the words they speak) but never with an `image_url` part. Only routed to endpoints that support video references, which bill at their video rate.""" type: SpeechInputReferenceVideoType diff --git a/src/openrouter/components/speechrequest.py b/src/openrouter/components/speechrequest.py index 5246bf6d..8262e372 100644 --- a/src/openrouter/components/speechrequest.py +++ b/src/openrouter/components/speechrequest.py @@ -172,7 +172,7 @@ def serialize_model(self, handler): ], UnrecognizedStr, ] -r"""Audio output format""" +r"""Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty.""" TimestampGranularity = Union[ @@ -192,7 +192,7 @@ class SpeechRequestTypedDict(TypedDict): model: str r"""TTS model identifier""" 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference.""" + 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL, optionally with one to three `input_audio` parts (and their `text` transcripts) grouped as in audio mode, and no `image_url` part; Seed Audio 1.5 ignores those transcripts, so the words the voices speak go in `input`; only routed to endpoints that support video references (and voice cloning when clips are sent, plus multiple references for two or three clips). An empty array is treated as no reference.""" instructions: NotRequired[str] r"""Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers.""" output_delivery: NotRequired[OutputDelivery] @@ -200,13 +200,13 @@ class SpeechRequestTypedDict(TypedDict): provider: NotRequired[SpeechRequestProviderTypedDict] r"""Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" response_format: NotRequired[SpeechRequestResponseFormat] - r"""Audio output format""" + r"""Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty.""" session_id: NotRequired[str] r"""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.""" speed: NotRequired[float] r"""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.""" timestamp_granularities: NotRequired[List[TimestampGranularity]] - r"""Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings.""" + r"""Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. The audio defaults to `mp3` unless `response_format` is set. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings.""" trace: NotRequired[TraceConfigTypedDict] r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" user: NotRequired[str] @@ -225,7 +225,7 @@ class SpeechRequest(BaseModel): r"""TTS model identifier""" input_references: Optional[List[SpeechInputReference]] = None - 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference.""" + 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL, optionally with one to three `input_audio` parts (and their `text` transcripts) grouped as in audio mode, and no `image_url` part; Seed Audio 1.5 ignores those transcripts, so the words the voices speak go in `input`; only routed to endpoints that support video references (and voice cloning when clips are sent, plus multiple references for two or three clips). An empty array is treated as no reference.""" instructions: Optional[str] = None r"""Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers.""" @@ -237,7 +237,7 @@ class SpeechRequest(BaseModel): r"""Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options""" response_format: Optional[SpeechRequestResponseFormat] = "pcm" - r"""Audio output format""" + r"""Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty.""" session_id: Optional[str] = None r"""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.""" @@ -246,7 +246,7 @@ class SpeechRequest(BaseModel): r"""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.""" timestamp_granularities: Optional[List[TimestampGranularity]] = None - r"""Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings.""" + r"""Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. The audio defaults to `mp3` unless `response_format` is set. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings.""" trace: Optional[TraceConfig] = None r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py index 8ab79410..1726f3c8 100644 --- a/src/openrouter/tts.py +++ b/src/openrouter/tts.py @@ -64,14 +64,14 @@ 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference. + :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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL, optionally with one to three `input_audio` parts (and their `text` transcripts) grouped as in audio mode, and no `image_url` part; Seed Audio 1.5 ignores those transcripts, so the words the voices speak go in `input`; only routed to endpoints that support video references (and voice cloning when clips are sent, plus multiple references for two or three clips). An empty array is treated as no reference. :param instructions: Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. :param output_delivery: `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. :param provider: Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options - :param response_format: Audio output format + :param response_format: Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty. :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. - :param timestamp_granularities: Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. + :param timestamp_granularities: Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. The audio defaults to `mp3` unless `response_format` is set. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param user: A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. :param voice: Voice identifier (provider-specific). Required by most providers; only Seed Audio, HeyGen, Fish Audio, AssemblyAI, Speechify accept requests without it. @@ -339,14 +339,14 @@ 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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference. + :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), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL, optionally with one to three `input_audio` parts (and their `text` transcripts) grouped as in audio mode, and no `image_url` part; Seed Audio 1.5 ignores those transcripts, so the words the voices speak go in `input`; only routed to endpoints that support video references (and voice cloning when clips are sent, plus multiple references for two or three clips). An empty array is treated as no reference. :param instructions: Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. :param output_delivery: `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. :param provider: Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options - :param response_format: Audio output format + :param response_format: Audio output format. Defaults to `pcm`, or to `mp3` when `timestamp_granularities` is nonempty. :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. - :param timestamp_granularities: Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. + :param timestamp_granularities: Timings to return with the audio. When nonempty, the response is JSON instead of raw audio bytes: `{audio, media_type, words?, characters?}` with base64 audio, or `{url, expires_at, media_type, words?, characters?}` when `output_delivery` is `url`. If a signed URL cannot be issued (ZDR, no workspace, or storage failure), timed `url` requests fall back to the inline `{audio, media_type, ...}` envelope with no `url`. The audio defaults to `mp3` unless `response_format` is set. Each timing entry is `{text, start, end}` in seconds. Only routed to endpoints that support every requested granularity (`supported_parameters.timestamp_granularities` on the speech models list). A timed response is sent once the whole audio is generated, not streamed, and is capped at 10 MiB of decoded audio for both inline and `url` delivery (the provider timed response, including its alignment data, is capped too); longer outputs return an error, so use a shorter input or a smaller audio format. Generated SDKs still type the 200 response as binary audio for compatibility; call the HTTP endpoint directly and parse the JSON response when using `timestamp_granularities`. An empty array is treated as no timings. :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :param user: A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. :param voice: Voice identifier (provider-specific). Required by most providers; only Seed Audio, HeyGen, Fish Audio, AssemblyAI, Speechify accept requests without it. diff --git a/uv.lock b/uv.lock index 39816d8d..687d7fcb 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.240" +version = "1.3.241" source = { editable = "." } dependencies = [ { name = "httpcore" },