diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ccbbfc777..6b8dd0faf 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: dea17b49afcf9328c109f7fa5782d37a + docChecksum: 83a66c1e4d3d049101bba8c81f0e17f7 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.163 - configChecksum: bb53b28dbe3e699dc07f5d0d91d7ed11 + releaseVersion: 1.3.164 + configChecksum: e851fa826eba158e743ab6a9a1cba756 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 19769bad-7674-42a8-8726-fce31df8dac5 - pristine_commit_hash: 5e9bd0bd577e3dc60bb35e4275bc2c2d10d06602 - pristine_tree_hash: 7677021b49ff1400994c5ea608410eaa0b1f0c8a + generation_id: d3a158e1-f4db-4d9b-ae2d-bb6c74594de1 + pristine_commit_hash: 5b3481d65b3820d405dabe5c47dfed688dc50434 + pristine_tree_hash: 03c4263565a0fdd0a04d1d768d16202728dab411 features: python: acceptHeaders: 3.0.0 @@ -1342,6 +1342,18 @@ trackedFiles: id: b6cf4ec2516f last_write_checksum: sha1:df65b3677c5af1efd75d7804c929cbbd5a075609 pristine_git_object: e30726d85f338bc157b5fae5a10c626935f3a76a + docs/components/audio.mdx: + id: 95fff54d2a97 + last_write_checksum: sha1:b31d52d6031e10053c6382f766d6e3a18f6f78d7 + pristine_git_object: 1736fc3d8cf14e38ff3938d3dd452ff2d89eaf29 + docs/components/audiopcm1.mdx: + id: 0d9e561d3657 + last_write_checksum: sha1:512956fbe16e68404df957e4893c51212680706b + pristine_git_object: 5470626a5efeca41db12697fa754e29d263f4502 + docs/components/audiopcm2.mdx: + id: 817bede92729 + last_write_checksum: sha1:ed7138963448dfcae6bcd95226b919b837f98250 + pristine_git_object: 5fdefb6462d7e081bde74a011b5c20802acb6d90 docs/components/audiourl.mdx: id: c457db82a4ac last_write_checksum: sha1:bad796549e68c147f1799575e982b57664d84288 @@ -1566,6 +1578,14 @@ trackedFiles: id: e33ab9d77832 last_write_checksum: sha1:dc16c3f8969de224d506830015e82cd995914f0a pristine_git_object: 14f045ed9fc30fbe0b62d3991114ef7c237cf473 + docs/components/batchobjectformat1.mdx: + id: 1ca56ab46c42 + last_write_checksum: sha1:b7c640f171489479780c7693dd690ef5cad75698 + pristine_git_object: 33d785a91d6c7db0ac0bef00f924b71982b86654 + docs/components/batchobjectformat2.mdx: + id: c4157adfd9fd + last_write_checksum: sha1:02fa50cb9e9e833c66a2dff3cf1cdbe27027ed95 + pristine_git_object: f84e3bf1e4312a60806f70aef47d5a722ad2dcc7 docs/components/batchobjectfunction.mdx: id: d93e178d8bbd last_write_checksum: sha1:20912f0ee8cec79bf8fb482fdcb7437fd81451e9 @@ -1680,8 +1700,12 @@ trackedFiles: pristine_git_object: a907902b407eac76aae4cbd5ce4814b36168123d docs/components/body.mdx: id: fc4484e326cb - last_write_checksum: sha1:8fa1a54b29dfbb8ce28618180f20aee724b340d5 - pristine_git_object: 8871db442a93fb93e245159c6bf52a758e734c28 + last_write_checksum: sha1:c41e92b10ff076c3c7fed6c37405ad37d4828fcb + pristine_git_object: bbbf166d9fd2738e14622e0f8d07a719931e8ade + docs/components/bodyaudiospeech.mdx: + id: 887ed62d2933 + last_write_checksum: sha1:389aff12a53c91c8f35f0411010ec71778f43b16 + pristine_git_object: caa64aa906fba587b62540b19bff2aa5ca8e9628 docs/components/bodychatcompletion.mdx: id: e03ae2d0f8d2 last_write_checksum: sha1:3ec2fff2a48bea904edc391d9c63c022ae4445cb @@ -1730,6 +1754,10 @@ trackedFiles: id: d1f4fdaef272 last_write_checksum: sha1:32f1341440b7f2e75bd576dc419d4d088c3d7294 pristine_git_object: b7d2e1b7952bf80222a8a18cec557c389887da35 + docs/components/bodyusage4.mdx: + id: 4e9bfa13f237 + last_write_checksum: sha1:241f063dd216b578c7278aca9104b2e4b9894861 + pristine_git_object: 425d64aefd8452319ee14d74257f93793e2c33dd docs/components/booleancapability.mdx: id: 514674d4ad70 last_write_checksum: sha1:0b9bd6471f97a6fb319bec066b96eea6b0d10fb6 @@ -3300,8 +3328,8 @@ trackedFiles: pristine_git_object: 5b155412cf75006c71e148911d0df802c4861c91 docs/components/endpoint.mdx: id: bab712ee633d - last_write_checksum: sha1:77300824d3d0f875c20092c09677ee0d491e5a38 - pristine_git_object: 557833b9d2a6b5c01176c9433f80da832f6367a4 + last_write_checksum: sha1:7bf3794a20d7fd8753034354ebd8c006c1e85153 + pristine_git_object: 5a3fda8f8a93d34f6cf9dfc3b43d197fcaacb4a2 docs/components/endpointinfo.mdx: id: 6dcdfc7379a9 last_write_checksum: sha1:9d74487fce60c77fa0477eb32e7b647edd01ea6b @@ -5686,6 +5714,10 @@ trackedFiles: id: 95e16bc8c6fb last_write_checksum: sha1:0833e8424830bc555374581f3a51c4a86270d15e pristine_git_object: bf941515c4a6226d6086879b92870e6e63f1a1d3 + docs/components/objectaudiospeech.mdx: + id: 5bb4ab166501 + last_write_checksum: sha1:2d6b63ccc49af505ef23f09cd8dbac2b47be4321 + pristine_git_object: c1b49f92c20f0a06f041dfa28ec8119019b0a3d6 docs/components/objectembedding.mdx: id: b79fc83c75ad last_write_checksum: sha1:22b80618d6e977507d67d37c69b643234fc49f4b @@ -11436,8 +11468,8 @@ trackedFiles: pristine_git_object: c57d9d064d27b93eee0d99f597c6f7785c27503b docs/sdks/batch/README.mdx: id: e367aa4f4295 - last_write_checksum: sha1:e5084fc19c2bfc9aa28e90a86d4accb5c9153130 - pristine_git_object: a5c5dea3ac36e655c835273fb51479b86d3cf23f + last_write_checksum: sha1:a9395712d06a85088deae5d274d3c44a09ef0354 + pristine_git_object: 545e4c043057437610e981e4517531cb6fb782e4 docs/sdks/benchmarks/README.mdx: id: 5b483a6770ba last_write_checksum: sha1:1123cde0a42d442dd80c502c40b3072f795cdd84 @@ -11588,8 +11620,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:2c2a0f82f6d0ba654a45d2f93b4933bdcdfcb100 - pristine_git_object: f4c5f7665f25f683c364023027f8db014c4b0361 + last_write_checksum: sha1:bdd5cc34f3f0a8af450afed5a3da30544cd15e2b + pristine_git_object: 32cd0d3b1f3f9056c0f834e655bd51be4b9aa47d scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11616,8 +11648,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:4b2959c4fddc86509490bc7f9ceab25f73a28b0f - pristine_git_object: 4af1be0c5458ff6014b829c9afce6995c250e48b + last_write_checksum: sha1:e1cf3fe0a23400c7514ffab6dcbcf99f1f5b7950 + pristine_git_object: be5ca24775c1c3a974a9a639bae411fce7e01761 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -11636,8 +11668,8 @@ trackedFiles: pristine_git_object: 7a562e21c7e66c9db666ead83748b73adefe4278 src/openrouter/batch.py: id: 148f61e34d5b - last_write_checksum: sha1:daa2319c42b657241c75720446562eaaa7ce8283 - pristine_git_object: 5ce4fea74e9a9355a36aca360e7f1377799c7d7a + last_write_checksum: sha1:770b5760feb60cece2c7a5afbf5c20f34bfbb25d + pristine_git_object: e7a0b932c361d1b17d4ff200178f6e5b05df8906 src/openrouter/benchmarks.py: id: 178d2ad8d706 last_write_checksum: sha1:15b8a7ea05a7550032afb15981958aa73b756881 @@ -11664,8 +11696,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:70ec779b6aff1883ae355b9dff464b9f771f9680 - pristine_git_object: 16efb4fd06b3383d785755af55f793911d2eef45 + last_write_checksum: sha1:453ee1682acc4516d475fc97334aef8cceae2e7c + pristine_git_object: 35c701ac061bb16ce29446f4f972cc402e5e9d64 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -12336,8 +12368,8 @@ trackedFiles: pristine_git_object: 8650957337063ba3aef94341108448ec19bd2945 src/openrouter/components/batchobject.py: id: caf1ef2414a3 - last_write_checksum: sha1:9808e4e00e45768bca720e11b80f031938853f10 - pristine_git_object: 66d5e6d9048c745473b433f4fb254633cc6ac4d5 + last_write_checksum: sha1:7d72a640b1d4b592b455cacdea31f86cc856ad33 + pristine_git_object: 7987968f47d7d9713237f1a90231fd7c78a617c3 src/openrouter/components/batchpaymentrequiredresponse_error.py: id: 29d3620e8858 last_write_checksum: sha1:c797fbfd8a88561c101aca8a4d556352213b8096 @@ -12348,8 +12380,8 @@ trackedFiles: pristine_git_object: b2bbac635f94d6fe9f4eba2eded41b1990a9d5da src/openrouter/components/batchsubmitbody.py: id: 26e5100bce4e - last_write_checksum: sha1:79d5faf2a9409736410fdaf809f93f157b0765a9 - pristine_git_object: a2658ae96d5f95d4fa7cf4b31c33e07002689780 + last_write_checksum: sha1:7b56eb4484a8aabdcfb43bfad888db6a9d15f92a + pristine_git_object: 943fbb092773ad5e3b3dfe6297877e3cd7853133 src/openrouter/components/booleancapability.py: id: 6009fd660c03 last_write_checksum: sha1:2615f4f9eecdf753ece20adc9897553404c71cc1 @@ -21577,3 +21609,4 @@ 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()`: \n * `request.endpoint.enum(/v1/audio/speech)` **Added**\n * `response.results[].response.body.union(class (4))` **Added** (Breaking ⚠️)\n* `open_router.batch.get_batches()`: `response.results[].response.body.union(class (4))` **Added** (Breaking ⚠️)\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 84ce975ce..3bf89b026 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.163 + version: 1.3.164 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 76d1b323a..69303e296 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -6297,6 +6297,101 @@ components: - 'data' - 'model' type: 'object' + - additionalProperties: false + properties: + audio: + anyOf: + - additionalProperties: false + properties: + bits_per_sample: + enum: + - 16 + type: 'number' + channels: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + data: + description: 'Base64-encoded PCM16 audio in the format the sibling fields give.' + minLength: 1 + type: 'string' + format: + enum: + - 'pcm' + type: 'string' + sample_rate: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + required: + - 'format' + - 'sample_rate' + - 'channels' + - 'bits_per_sample' + - 'data' + type: 'object' + - additionalProperties: false + properties: + bits_per_sample: + enum: + - 16 + type: 'number' + byte_length: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + channels: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + format: + enum: + - 'pcm' + type: 'string' + sample_rate: + exclusiveMinimum: true + minimum: 0 + type: 'integer' + sha256: + pattern: '^[0-9a-f]{64}$' + type: 'string' + required: + - 'format' + - 'sample_rate' + - 'channels' + - 'bits_per_sample' + - 'byte_length' + - 'sha256' + type: 'object' + model: + type: 'string' + object: + enum: + - 'audio.speech' + type: 'string' + usage: + additionalProperties: false + properties: + completion_tokens: + minimum: 0 + type: 'integer' + prompt_tokens: + minimum: 0 + type: 'integer' + total_tokens: + minimum: 0 + type: 'integer' + required: + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' + type: 'object' + required: + - 'object' + - 'model' + - 'audio' + - 'usage' + type: 'object' request_id: type: - 'string' @@ -6711,6 +6806,7 @@ components: - '/v1/responses' - '/v1/messages' - '/v1/embeddings' + - '/v1/audio/speech' type: 'string' x-speakeasy-unknown-values: allow model: @@ -41090,7 +41186,7 @@ paths: results: '$.data' type: 'cursor' post: - description: 'Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' + description: 'Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).' operationId: 'createBatches' requestBody: content: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 81b63cc03..1e6b11a30 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:c45a17960a7ff6c3ad056153f9538a90fe7707a0bdddcb65ab51d47a5b31e49a - sourceBlobDigest: sha256:f107baa955199ff9f64a82d601120b938a6c7fb7a928e87f78dda5c19fefe13a + sourceRevisionDigest: sha256:bc44f0142393e2fcddd93b174e23993e9381679bc2d1e7a7d342d8a4bb7515c9 + sourceBlobDigest: sha256:100cf0bccc73a1774aae0b97327033104d08856cd30630a1264ebb0ac88bf863 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:c45a17960a7ff6c3ad056153f9538a90fe7707a0bdddcb65ab51d47a5b31e49a - sourceBlobDigest: sha256:f107baa955199ff9f64a82d601120b938a6c7fb7a928e87f78dda5c19fefe13a + sourceRevisionDigest: sha256:bc44f0142393e2fcddd93b174e23993e9381679bc2d1e7a7d342d8a4bb7515c9 + sourceBlobDigest: sha256:100cf0bccc73a1774aae0b97327033104d08856cd30630a1264ebb0ac88bf863 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:7dd85062207420c824bb8d964db1ebbf13600733f060662ca126534d81884d12 + codeSamplesRevisionDigest: sha256:19e05057ce93aa0a9c83f8508484a345be2ff3d4a6dca71942bbe600bb8a9409 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index a1ffd0c9b..4c20b483f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4399,4 +4399,14 @@ Based on: ### Generated - [python v1.3.163] . ### Releases -- [PyPI v1.3.163] https://pypi.org/project/openrouter/1.3.163 - . \ No newline at end of file +- [PyPI v1.3.163] https://pypi.org/project/openrouter/1.3.163 - . + +## 2026-11-11 22:49:57 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.164] . +### Releases +- [PyPI v1.3.164] https://pypi.org/project/openrouter/1.3.164 - . \ No newline at end of file diff --git a/docs/components/audio.mdx b/docs/components/audio.mdx new file mode 100644 index 000000000..1736fc3d8 --- /dev/null +++ b/docs/components/audio.mdx @@ -0,0 +1,18 @@ +--- +title: "Audio" +--- + +## Supported Types + +### `components.AudioPcm1` + +```python +value: components.AudioPcm1 = /* values here */ +``` + +### `components.AudioPcm2` + +```python +value: components.AudioPcm2 = /* values here */ +``` + diff --git a/docs/components/audiopcm1.mdx b/docs/components/audiopcm1.mdx new file mode 100644 index 000000000..5470626a5 --- /dev/null +++ b/docs/components/audiopcm1.mdx @@ -0,0 +1,13 @@ +--- +title: "AudioPcm1" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `bits_per_sample` | *float* | ✔️ | N/A | +| `channels` | *int* | ✔️ | N/A | +| `data` | *str* | ✔️ | Base64-encoded PCM16 audio in the format the sibling fields give. | +| `format_` | [components.BatchObjectFormat1](../components/batchobjectformat1.mdx) | ✔️ | N/A | +| `sample_rate` | *int* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/audiopcm2.mdx b/docs/components/audiopcm2.mdx new file mode 100644 index 000000000..5fdefb646 --- /dev/null +++ b/docs/components/audiopcm2.mdx @@ -0,0 +1,14 @@ +--- +title: "AudioPcm2" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `bits_per_sample` | *float* | ✔️ | N/A | +| `byte_length` | *int* | ✔️ | N/A | +| `channels` | *int* | ✔️ | N/A | +| `format_` | [components.BatchObjectFormat2](../components/batchobjectformat2.mdx) | ✔️ | N/A | +| `sample_rate` | *int* | ✔️ | N/A | +| `sha256` | *str* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/batchobjectformat1.mdx b/docs/components/batchobjectformat1.mdx new file mode 100644 index 000000000..33d785a91 --- /dev/null +++ b/docs/components/batchobjectformat1.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchObjectFormat1" +--- + +## Example Usage + +```python +from openrouter.components import BatchObjectFormat1 +value: BatchObjectFormat1 = "pcm" +``` + + +## Values + +- `"pcm"` diff --git a/docs/components/batchobjectformat2.mdx b/docs/components/batchobjectformat2.mdx new file mode 100644 index 000000000..f84e3bf1e --- /dev/null +++ b/docs/components/batchobjectformat2.mdx @@ -0,0 +1,15 @@ +--- +title: "BatchObjectFormat2" +--- + +## Example Usage + +```python +from openrouter.components import BatchObjectFormat2 +value: BatchObjectFormat2 = "pcm" +``` + + +## Values + +- `"pcm"` diff --git a/docs/components/body.mdx b/docs/components/body.mdx index 8871db442..bbbf166d9 100644 --- a/docs/components/body.mdx +++ b/docs/components/body.mdx @@ -28,3 +28,9 @@ value: components.BodyMessage = /* values here */ value: components.BodyList = /* values here */ ``` +### `components.BodyAudioSpeech` + +```python +value: components.BodyAudioSpeech = /* values here */ +``` + diff --git a/docs/components/bodyaudiospeech.mdx b/docs/components/bodyaudiospeech.mdx new file mode 100644 index 000000000..caa64aa90 --- /dev/null +++ b/docs/components/bodyaudiospeech.mdx @@ -0,0 +1,12 @@ +--- +title: "BodyAudioSpeech" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `audio` | [components.Audio](../components/audio.mdx) | ✔️ | N/A | +| `model` | *str* | ✔️ | N/A | +| `object` | [components.ObjectAudioSpeech](../components/objectaudiospeech.mdx) | ✔️ | N/A | +| `usage` | [components.BodyUsage4](../components/bodyusage4.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/bodyusage4.mdx b/docs/components/bodyusage4.mdx new file mode 100644 index 000000000..425d64aef --- /dev/null +++ b/docs/components/bodyusage4.mdx @@ -0,0 +1,11 @@ +--- +title: "BodyUsage4" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------- | ------------------- | ------------------- | ------------------- | +| `completion_tokens` | *int* | ✔️ | N/A | +| `prompt_tokens` | *int* | ✔️ | N/A | +| `total_tokens` | *int* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/endpoint.mdx b/docs/components/endpoint.mdx index 557833b9d..5a3fda8f8 100644 --- a/docs/components/endpoint.mdx +++ b/docs/components/endpoint.mdx @@ -20,3 +20,4 @@ This is an open enum. Unrecognized values will not fail type checks. - `"/v1/responses"` - `"/v1/messages"` - `"/v1/embeddings"` +- `"/v1/audio/speech"` diff --git a/docs/components/objectaudiospeech.mdx b/docs/components/objectaudiospeech.mdx new file mode 100644 index 000000000..c1b49f92c --- /dev/null +++ b/docs/components/objectaudiospeech.mdx @@ -0,0 +1,15 @@ +--- +title: "ObjectAudioSpeech" +--- + +## Example Usage + +```python +from openrouter.components import ObjectAudioSpeech +value: ObjectAudioSpeech = "audio.speech" +``` + + +## Values + +- `"audio.speech"` diff --git a/docs/sdks/batch/README.mdx b/docs/sdks/batch/README.mdx index a5c5dea3a..545e4c043 100644 --- a/docs/sdks/batch/README.mdx +++ b/docs/sdks/batch/README.mdx @@ -69,7 +69,7 @@ with OpenRouter( ## create_batches -Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). +Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). ### Example Usage: chatCompletions diff --git a/pyproject.toml b/pyproject.toml index f4c5f7665..32cd0d3b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.163" +version = "1.3.164" 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 4af1be0c5..be5ca2477 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.163" +__version__: str = "1.3.164" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.163 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.164 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/batch.py b/src/openrouter/batch.py index 5ce4fea74..e7a0b932c 100644 --- a/src/openrouter/batch.py +++ b/src/openrouter/batch.py @@ -378,7 +378,7 @@ def create_batches( ) -> components.BatchObject: r"""Create a batch - Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: \"validating\"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). + Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: \"validating\"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). :param endpoint: :param model: @@ -538,7 +538,7 @@ async def create_batches_async( ) -> components.BatchObject: r"""Create a batch - Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: \"validating\"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). + Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`, `/v1/audio/speech`). Returns `202` with `status: \"validating\"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart). :param endpoint: :param model: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 16efb4fd0..35c701ac0 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -860,6 +860,12 @@ AnnotationURLCitationTypedDict, AnnotationWebSearchCitation, AnnotationWebSearchCitationTypedDict, + Audio, + AudioPcm1, + AudioPcm1TypedDict, + AudioPcm2, + AudioPcm2TypedDict, + AudioTypedDict, BatchObject, BatchObjectCompletionTokensDetails, BatchObjectCompletionTokensDetailsTypedDict, @@ -873,6 +879,8 @@ BatchObjectEvent, BatchObjectFile, BatchObjectFileTypedDict, + BatchObjectFormat1, + BatchObjectFormat2, BatchObjectFunction, BatchObjectFunctionTypedDict, BatchObjectImageURL, @@ -899,6 +907,8 @@ BatchObjectUsage, BatchObjectUsageTypedDict, Body, + BodyAudioSpeech, + BodyAudioSpeechTypedDict, BodyChatCompletion, BodyChatCompletionTypedDict, BodyCompletionTokensDetails, @@ -922,6 +932,8 @@ BodyUsage2TypedDict, BodyUsage3, BodyUsage3TypedDict, + BodyUsage4, + BodyUsage4TypedDict, Choice, ChoiceRole, ChoiceTypeFunction, @@ -947,6 +959,7 @@ LogprobsTypedDict, Message, MessageTypedDict, + ObjectAudioSpeech, ObjectEmbedding, ReasoningDetail, ReasoningDetailTypedDict, @@ -5552,6 +5565,12 @@ "ArmorSafeguardResultStatusTypedDict", "ArmorSafeguardResultTypedDict", "ArmorTypedDict", + "Audio", + "AudioPcm1", + "AudioPcm1TypedDict", + "AudioPcm2", + "AudioPcm2TypedDict", + "AudioTypedDict", "AudioURL", "AudioURLTypedDict", "AuthMode", @@ -5645,6 +5664,8 @@ "BatchObjectEvent", "BatchObjectFile", "BatchObjectFileTypedDict", + "BatchObjectFormat1", + "BatchObjectFormat2", "BatchObjectFunction", "BatchObjectFunctionTypedDict", "BatchObjectImageURL", @@ -5694,6 +5715,8 @@ "BatchSubmitBodyTypedDict", "Billable", "Body", + "BodyAudioSpeech", + "BodyAudioSpeechTypedDict", "BodyChatCompletion", "BodyChatCompletionTypedDict", "BodyCompletionTokensDetails", @@ -5717,6 +5740,8 @@ "BodyUsage2TypedDict", "BodyUsage3", "BodyUsage3TypedDict", + "BodyUsage4", + "BodyUsage4TypedDict", "BooleanCapability", "BooleanCapabilityType", "BooleanCapabilityTypedDict", @@ -7340,6 +7365,7 @@ "ORAnthropicToolSearchResultParamTypedDict", "ORAnthropicToolSearchResultType", "ORAnthropicToolSearchResultTypedDict", + "ObjectAudioSpeech", "ObjectEmbedding", "ObservabilityArizeDestination", "ObservabilityArizeDestinationConfig", @@ -9375,6 +9401,12 @@ "AnnotationURLCitationTypedDict": ".batchobject", "AnnotationWebSearchCitation": ".batchobject", "AnnotationWebSearchCitationTypedDict": ".batchobject", + "Audio": ".batchobject", + "AudioPcm1": ".batchobject", + "AudioPcm1TypedDict": ".batchobject", + "AudioPcm2": ".batchobject", + "AudioPcm2TypedDict": ".batchobject", + "AudioTypedDict": ".batchobject", "BatchObject": ".batchobject", "BatchObjectCompletionTokensDetails": ".batchobject", "BatchObjectCompletionTokensDetailsTypedDict": ".batchobject", @@ -9388,6 +9420,8 @@ "BatchObjectEvent": ".batchobject", "BatchObjectFile": ".batchobject", "BatchObjectFileTypedDict": ".batchobject", + "BatchObjectFormat1": ".batchobject", + "BatchObjectFormat2": ".batchobject", "BatchObjectFunction": ".batchobject", "BatchObjectFunctionTypedDict": ".batchobject", "BatchObjectImageURL": ".batchobject", @@ -9414,6 +9448,8 @@ "BatchObjectUsage": ".batchobject", "BatchObjectUsageTypedDict": ".batchobject", "Body": ".batchobject", + "BodyAudioSpeech": ".batchobject", + "BodyAudioSpeechTypedDict": ".batchobject", "BodyChatCompletion": ".batchobject", "BodyChatCompletionTypedDict": ".batchobject", "BodyCompletionTokensDetails": ".batchobject", @@ -9437,6 +9473,8 @@ "BodyUsage2TypedDict": ".batchobject", "BodyUsage3": ".batchobject", "BodyUsage3TypedDict": ".batchobject", + "BodyUsage4": ".batchobject", + "BodyUsage4TypedDict": ".batchobject", "Choice": ".batchobject", "ChoiceRole": ".batchobject", "ChoiceTypeFunction": ".batchobject", @@ -9462,6 +9500,7 @@ "LogprobsTypedDict": ".batchobject", "Message": ".batchobject", "MessageTypedDict": ".batchobject", + "ObjectAudioSpeech": ".batchobject", "ObjectEmbedding": ".batchobject", "ReasoningDetail": ".batchobject", "ReasoningDetailTypedDict": ".batchobject", diff --git a/src/openrouter/components/batchobject.py b/src/openrouter/components/batchobject.py index 66d5e6d90..7987968f4 100644 --- a/src/openrouter/components/batchobject.py +++ b/src/openrouter/components/batchobject.py @@ -142,6 +142,99 @@ def serialize_model(self, handler): return m +BatchObjectFormat2 = Literal["pcm",] + + +class AudioPcm2TypedDict(TypedDict): + bits_per_sample: float + byte_length: int + channels: int + format_: BatchObjectFormat2 + sample_rate: int + sha256: str + + +class AudioPcm2(BaseModel): + bits_per_sample: float + + byte_length: int + + channels: int + + format_: Annotated[BatchObjectFormat2, pydantic.Field(alias="format")] + + sample_rate: int + + sha256: str + + +BatchObjectFormat1 = Literal["pcm",] + + +class AudioPcm1TypedDict(TypedDict): + bits_per_sample: float + channels: int + data: str + r"""Base64-encoded PCM16 audio in the format the sibling fields give.""" + format_: BatchObjectFormat1 + sample_rate: int + + +class AudioPcm1(BaseModel): + bits_per_sample: float + + channels: int + + data: str + r"""Base64-encoded PCM16 audio in the format the sibling fields give.""" + + format_: Annotated[BatchObjectFormat1, pydantic.Field(alias="format")] + + sample_rate: int + + +AudioTypedDict = TypeAliasType( + "AudioTypedDict", Union[AudioPcm1TypedDict, AudioPcm2TypedDict] +) + + +Audio = TypeAliasType("Audio", Union[AudioPcm1, AudioPcm2]) + + +ObjectAudioSpeech = Literal["audio.speech",] + + +class BodyUsage4TypedDict(TypedDict): + completion_tokens: int + prompt_tokens: int + total_tokens: int + + +class BodyUsage4(BaseModel): + completion_tokens: int + + prompt_tokens: int + + total_tokens: int + + +class BodyAudioSpeechTypedDict(TypedDict): + audio: AudioTypedDict + model: str + object: ObjectAudioSpeech + usage: BodyUsage4TypedDict + + +class BodyAudioSpeech(BaseModel): + audio: Audio + + model: str + + object: ObjectAudioSpeech + + usage: BodyUsage4 + + EmbeddingTypedDict = TypeAliasType("EmbeddingTypedDict", Union[List[float], str]) r"""Embedding vector as an array of floats or a base64 string""" @@ -1605,6 +1698,7 @@ def serialize_model(self, handler): BodyTypedDict = TypeAliasType( "BodyTypedDict", Union[ + BodyAudioSpeechTypedDict, BodyListTypedDict, BodyMessageTypedDict, BodyChatCompletionTypedDict, @@ -1614,7 +1708,10 @@ def serialize_model(self, handler): Body = TypeAliasType( - "Body", Union[BodyList, BodyMessage, BodyChatCompletion, OpenResponsesResult] + "Body", + Union[ + BodyAudioSpeech, BodyList, BodyMessage, BodyChatCompletion, OpenResponsesResult + ], ) @@ -2048,6 +2145,14 @@ def serialize_model(self, handler): return m +try: + AudioPcm2.model_rebuild() +except NameError: + pass +try: + AudioPcm1.model_rebuild() +except NameError: + pass try: ContentTopLogprob.model_rebuild() except NameError: diff --git a/src/openrouter/components/batchsubmitbody.py b/src/openrouter/components/batchsubmitbody.py index a2658ae96..943fbb092 100644 --- a/src/openrouter/components/batchsubmitbody.py +++ b/src/openrouter/components/batchsubmitbody.py @@ -27,6 +27,7 @@ "/v1/responses", "/v1/messages", "/v1/embeddings", + "/v1/audio/speech", ], UnrecognizedStr, ] diff --git a/uv.lock b/uv.lock index 19e648c17..54baaeafa 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.163" +version = "1.3.164" source = { editable = "." } dependencies = [ { name = "httpcore" },