From 8afa9e64235c605847f10de78dffb9091d66ed59 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 15 Sep 2026 21:53:44 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.tts.create_speech()`: `request.trace` **Added** * `open_router.stt.create_transcription()`: `request.trace` **Added** * `open_router.embeddings.generate()`: `request.trace` **Added** * `open_router.images.generate()`: `request.trace` **Added** * `open_router.rerank.rerank()`: `request.trace` **Added** * `open_router.video_generation.generate()`: `request.trace` **Added** --- .speakeasy/gen.lock | 126 +++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 12 ++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/imagegenerationrequest.mdx | 1 + docs/components/speechrequest.mdx | 21 +-- docs/components/sttrequest.mdx | 1 + docs/components/videogenerationrequest.mdx | 1 + .../createembeddingsrequestbody.mdx | 19 +-- docs/operations/creatererankrequestbody.mdx | 17 +-- docs/sdks/embeddings/README.mdx | 27 ++-- docs/sdks/images/README.mdx | 1 + docs/sdks/rerank/README.mdx | 25 ++-- docs/sdks/stt/README.mdx | 1 + docs/sdks/tts/README.mdx | 29 ++-- docs/sdks/videogeneration/README.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- .../components/imagegenerationrequest.py | 7 + src/openrouter/components/speechrequest.py | 7 + src/openrouter/components/sttrequest.py | 7 + .../components/videogenerationrequest.py | 7 + src/openrouter/embeddings.py | 10 ++ src/openrouter/images.py | 34 +++++ src/openrouter/operations/createembeddings.py | 8 +- src/openrouter/operations/creatererank.py | 12 +- src/openrouter/rerank.py | 10 ++ src/openrouter/stt.py | 10 ++ src/openrouter/tts.py | 10 ++ src/openrouter/video_generation.py | 10 ++ uv.lock | 2 +- 32 files changed, 304 insertions(+), 142 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 31a5404c..efb88929 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: 9d69845ad31ce7ba8ce7e7f486b06619 + docChecksum: 3718310285fcd17375c7d4ef9289b97f docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.1.145 - configChecksum: 1cb632567e10bac5f17433f4cf62533b + releaseVersion: 1.1.146 + configChecksum: 30eb2515921ba2d2752a2978b47a5aba repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: f89f4f8a-510b-47f7-bd2c-06f60c0d43fb - pristine_commit_hash: 87993f0dcce80694529a2c6ec7bce1192292d14a - pristine_tree_hash: d898af55f7ae457d5458c596381f4f8223c45c7a + generation_id: 9bebc4e3-1325-4085-9b3f-f4031b333232 + pristine_commit_hash: 0b6e7d8756a1f00facecf6eb7c2d9780d246d4b5 + pristine_tree_hash: f32caf7a6b6cfb5b084cbc4b3eabeab20704701c features: python: acceptHeaders: 3.0.0 @@ -2446,8 +2446,8 @@ trackedFiles: pristine_git_object: bccd158982dba4b4ed810b98b5f7d4a6c04afaa7 docs/components/imagegenerationrequest.mdx: id: b093cb0f5e81 - last_write_checksum: sha1:e66f2ed453490ba50a171826016338ba869875ce - pristine_git_object: 68f653b5fdd4a2a93d4c399658e10ae30c09bd71 + last_write_checksum: sha1:bbff7c0aad08b334d128127a63fd11a9afa26aa8 + pristine_git_object: 8e71b744588eef863389af7af3bc91e61607b32d docs/components/imagegenerationrequestaspectratio.mdx: id: bda89377f32d last_write_checksum: sha1:368ddc44134948e2e04c43dd886f7469d88b7d16 @@ -5098,8 +5098,8 @@ trackedFiles: pristine_git_object: 34f4f07fb3008df83646fa3d88ce04009274246a docs/components/speechrequest.mdx: id: 06e81b0433f6 - last_write_checksum: sha1:0ff4255b41bf4c3fdecfa3d92ef07d722c01b876 - pristine_git_object: a74e87f8fc263a9e4ac09cfe2394e3aec6de85b7 + last_write_checksum: sha1:237f6f7aaa34d60c390bb03549a9ab7cae7bb159 + pristine_git_object: e045a6b9c4ceb38eda9ec5a75f14f57feab9df9f docs/components/speechrequestprovider.mdx: id: 4f78ed0394c4 last_write_checksum: sha1:99d94c6b01dbd3e875c213584f97c7dca545a6a9 @@ -5230,8 +5230,8 @@ trackedFiles: pristine_git_object: 70a2660b7c0bc35aed96124e1faa3852b3117054 docs/components/sttrequest.mdx: id: 6a5e33cf6dbe - last_write_checksum: sha1:10dcd183a9b518a4b50705347229ffd778bc2cd7 - pristine_git_object: 39dadb91251c355a10f6760bbf25030e129983d9 + last_write_checksum: sha1:82563c6a835219ed1b177a2705f68ee7e6866ebc + pristine_git_object: 31157642267a250117f42fd2dc5d233d06b1c147 docs/components/sttrequestprovider.mdx: id: d8b1bac8e745 last_write_checksum: sha1:e15551eddbe4c1f7c4515fa556d4873075512eea @@ -5870,8 +5870,8 @@ trackedFiles: pristine_git_object: 0f7cc13e29aa234d72930b1a95cf56cdaf836d4d docs/components/videogenerationrequest.mdx: id: b92ddbd15ee4 - last_write_checksum: sha1:0c9d393833efada795c67123104bed25da2bef9f - pristine_git_object: 190ba46e25d112d35c8bace4f8a2e8666ce9e244 + last_write_checksum: sha1:19782d3f158f7e14d454389563b86f7505089b0d + pristine_git_object: 4174b152b8f3292831b6d006aaa00df3ccfc3f50 docs/components/videogenerationrequestaspectratio.mdx: id: c14859c0d8c3 last_write_checksum: sha1:4ad4aae702af1cd2ddee7b443c35c9b3df6824e8 @@ -6302,8 +6302,8 @@ trackedFiles: pristine_git_object: 6d20f0154de8502a6deb3686908bba8496747583 docs/operations/createembeddingsrequestbody.mdx: id: ce68e3b84ec3 - last_write_checksum: sha1:78942806d1371286f52486cd13b7881da11dc517 - pristine_git_object: a669d4e6b74d84f91888f9a8b354ad0b13c281a7 + last_write_checksum: sha1:46d8f3879597916bbbb0fae6ad6dd3719a7d8012 + pristine_git_object: c5798f80f68f85b704dbe3fc876034c7efc87393 docs/operations/createembeddingsresponse.mdx: id: 4db044e7c8a7 last_write_checksum: sha1:9b1ed48afb937e503da99a9d9f6c26ee036d84be @@ -6410,8 +6410,8 @@ trackedFiles: pristine_git_object: f0d351fc5e1348b126ff9bdb7ca184405ede80dd docs/operations/creatererankrequestbody.mdx: id: 70e89df7dc65 - last_write_checksum: sha1:71971408ea8bdd6f6f76ac4897ea6b75c92c34ac - pristine_git_object: e270760ce835b9e9cde174ba9c98284157336f15 + last_write_checksum: sha1:88707ad1b23b6eef8b4799781e5ff60fa83f22c9 + pristine_git_object: e347a238bb5ffd076a1ddb40fb22efd8059b1a2a docs/operations/creatererankresponse.mdx: id: 1cc3705ce113 last_write_checksum: sha1:9eabc300f420fc0b4177bc4527ff849a7f05366c @@ -7586,8 +7586,8 @@ trackedFiles: pristine_git_object: fe31c0f4f765b9f8f3cf79f6dd403e730589db80 docs/sdks/embeddings/README.mdx: id: cd71581df291 - last_write_checksum: sha1:a4a6e0bb62f5d71ff6c2803539a9d621d3a3473b - pristine_git_object: 61d507bb094a3a06e994c89b91b401f4c2cfffda + last_write_checksum: sha1:611b41e100ea6744d319525d5121ce70a40954f2 + pristine_git_object: 0641bd763e00931bf98da37029a91d42d2cf7694 docs/sdks/endpoints/README.mdx: id: 62dfac9f7b71 last_write_checksum: sha1:db7ed18401bcd4afa7382a9793c9ccafb5220497 @@ -7606,8 +7606,8 @@ trackedFiles: pristine_git_object: d419fd3ee53c199c96b5228f7b656fa8e732bd69 docs/sdks/images/README.mdx: id: 534a6c102c4f - last_write_checksum: sha1:bc62f91590ac816c58ad954f4a888a46aee71bb9 - pristine_git_object: 6ee346c73844495c95009346a1242ed6f37d58b5 + last_write_checksum: sha1:843b89729f498ea6ef6a420b760b140377ef4041 + pristine_git_object: 813c56711facc36a4db5e108533ef3dbc36a56c9 docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:e52eb8f94799aec2499f70e99ca46acedfe17ec9 @@ -7634,8 +7634,8 @@ trackedFiles: pristine_git_object: 7571e2581a73919541d9712f6c1f88f9c0d2b4c9 docs/sdks/rerank/README.mdx: id: 68cdfc7f7dca - last_write_checksum: sha1:c3c818d69858a83f9caa160e1ca9f8d641f89184 - pristine_git_object: cfabc30e3227960225c634e5dba3f7d5ade78040 + last_write_checksum: sha1:7621a6c7488aed96a898aa2270e17fcf920ebc70 + pristine_git_object: e1c012eb494aafb5b2849179ae25a3d826dfc7a8 docs/sdks/responses/README.mdx: id: abab319e080e last_write_checksum: sha1:786e6be086f66f9262e19d6bbf8e32d726bea076 @@ -7646,16 +7646,16 @@ trackedFiles: pristine_git_object: c7435646cf280b7b2fbb2805b2cde15b4c570896 docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 - last_write_checksum: sha1:e69bbf0b1a8a6febc530c09718aa5e5aa9cc8d8b - pristine_git_object: 17d24017d2ba3b285ad5b245a663ba121e74738d + last_write_checksum: sha1:4988b2477ce52a14ef48998f05c4efe07b42a57b + pristine_git_object: 4c94c89e2de2c21457849fe2f05efd7ecb2fa51a docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:83753721909b55afe9d7f1a629c3e97960b23c1b - pristine_git_object: ec16529cb177badbd1db41f12ecc085975326d0b + last_write_checksum: sha1:806d6eb13442ca7b416b8f5d10b93fd34f568ad9 + pristine_git_object: e8ee28344febb31afb0a54e10c5f55f38c57e09a docs/sdks/videogeneration/README.mdx: id: 9a8fa04c3872 - last_write_checksum: sha1:bdfa39262904b46b08b42cb58ea7d4a102cb7d42 - pristine_git_object: 9ba8081e723fdb44316102e1d211b773c670ebe8 + last_write_checksum: sha1:64bfa28791e6994f69627293d6ced5c27ce7efc5 + pristine_git_object: cfa0f9f666f332be2f9ee75a8c5d8aa1f31b69d6 docs/sdks/workspaces/README.mdx: id: 0c75d023ef6b last_write_checksum: sha1:25592df93519c9e742e7c2a3df49ea2337a47d64 @@ -7666,8 +7666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:b084b83f74ceeed171799f7b0219ae6ffb51002d - pristine_git_object: 64c95ecfffcef89f5863cb9066da4623173b9344 + last_write_checksum: sha1:727c10585708849681bd5584c42a5e1383b0467a + pristine_git_object: 6e5cbdbd891e75699ff772e002d3752ca14ed4ad scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -7694,8 +7694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:64fc5bf9ed18744450d88b6cdd31896419cad678 - pristine_git_object: 23a5fe0193fd5bec67ffcbd07784530553a65f57 + last_write_checksum: sha1:48f42791d2c9bf2f3c278da4c45401d966b4aa90 + pristine_git_object: 5c1a2ed9171dfeaa321b22cb18134c2605f81b02 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:1e0004d8d1d5d797e2b54cd1cabeb7f9489d08e9 @@ -8834,8 +8834,8 @@ trackedFiles: pristine_git_object: b5ff31ce7a095884cf4f6c1110eca88f8f7863ff src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 - last_write_checksum: sha1:960f0b468bc9e21f407c3d666002d4a2683cd2d4 - pristine_git_object: c768a0c5b03f398698abba73867387630f8ddfd2 + last_write_checksum: sha1:e0c9e7efaba490d7c867b3a119e6b00d7b30821c + pristine_git_object: 569864e2d2dc7c2b52c3559e64e8d3aad163523f src/openrouter/components/imagegenerationresponse.py: id: 53354cd0cbfc last_write_checksum: sha1:53f1cde7b8bfe4f9e786a76f6e57b0a1f76aced2 @@ -9902,8 +9902,8 @@ trackedFiles: pristine_git_object: e1703efe8ac18c7aea925375ddfa6ef74c31193b src/openrouter/components/speechrequest.py: id: 2a9400167112 - last_write_checksum: sha1:230ad91f68d2c5d5f8771f903d14b5cbae5e5bf2 - pristine_git_object: 7d85d8d07a5502df3b4d084e200b21a321e55110 + last_write_checksum: sha1:eedfa8c6f4813679ccc4b1bfa3cbf8a6bb728808 + pristine_git_object: 2425633d1186c5f8af43501561515ceb98ea9a73 src/openrouter/components/stopservertoolswhencondition.py: id: 2deeda4209ac last_write_checksum: sha1:581e0ee62776d42bf598b9f68b998faabfecd3ce @@ -9970,8 +9970,8 @@ trackedFiles: pristine_git_object: 76c4b466e22e57b34098b587e95cb358089dd87c src/openrouter/components/sttrequest.py: id: 5fb1d469e16e - last_write_checksum: sha1:35d70305d4cc96d9a108041f7b4ed811de90e11b - pristine_git_object: 175d4308fba8cfc2fb8d563ffb9a529a22209ba2 + last_write_checksum: sha1:34e8189eb5e47e0e398f0c44dd0693620368f8af + pristine_git_object: 7a2eaf2ae05e0150ae45d77b6a877caf3fb8bac7 src/openrouter/components/sttresponse.py: id: 2dc8eb8daaca last_write_checksum: sha1:36aff8c075a27f036d34f3970031a26aad99f804 @@ -10182,8 +10182,8 @@ trackedFiles: pristine_git_object: a0491cc8fd3bd9986146cb1176e27d5b9c9beb60 src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c - last_write_checksum: sha1:d6823eaf89e513db9a17c6da84b151ff125dbf01 - pristine_git_object: 98b5556f27c4e01ee12893e09c6ffc67bca032ad + last_write_checksum: sha1:b9f885284bf3b765668f6c447af18ab37ada131d + pristine_git_object: c8510303f7fc5de78254cb403f45cf4c1a8c9f20 src/openrouter/components/videogenerationresponse.py: id: 541f1321b072 last_write_checksum: sha1:18c3aa7845f63a9614286b1a27b6098eae1c4951 @@ -10310,8 +10310,8 @@ trackedFiles: pristine_git_object: 0532cef994643793368c4484b8af0d247be2692e src/openrouter/embeddings.py: id: 0374ace39067 - last_write_checksum: sha1:0455c3566bed8b60aac864d5508da724b1ebc372 - pristine_git_object: b17f06e58b2bccdf340529f1128fdadf687fdbd4 + last_write_checksum: sha1:808e00b496e92657cbcdbe06f15bfdbb3d17273d + pristine_git_object: 8aa54d28b88b89cc732daf0cd46bb36662b2271d src/openrouter/endpoints.py: id: 465bbf2b7939 last_write_checksum: sha1:a04548ad80c9b1cf8ae1f5dde2e24774865c1eb8 @@ -10422,8 +10422,8 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/openrouter/images.py: id: c4d7adf63ae0 - last_write_checksum: sha1:a49be8ca6e374b9808cfebfb348741a8b1c461e0 - pristine_git_object: b7abaae4a3b605f2fe374fc9189841f3268cf4ab + last_write_checksum: sha1:b40d56f343061e4e1d1311e6960d74c0519463d0 + pristine_git_object: 551d5c2b266c53455afe758c2bc134b71a08a872 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -10498,8 +10498,8 @@ trackedFiles: pristine_git_object: d96c756e911994eaf6ef695a059f7575d69ff63c src/openrouter/operations/createembeddings.py: id: fe1160a960e9 - last_write_checksum: sha1:a0b0b0755594b7a11b6662d9b8685fd3174d64e0 - pristine_git_object: a7fed8ead2d7dbf97fe0107a4f63318b7e610048 + last_write_checksum: sha1:43bba30d045cba7db10f614ddae6801e297c4435 + pristine_git_object: 6ffa8298d4a2c1d66f5bcc7862b03c574dc9bc8b src/openrouter/operations/createguardrail.py: id: 52ed4b2f5903 last_write_checksum: sha1:d4351fdd66f1fa2bedcfc9a974c7f4ff6c68a6bc @@ -10534,8 +10534,8 @@ trackedFiles: pristine_git_object: becc8c5f5af5402ce510eda9784ba2ff675d6a94 src/openrouter/operations/creatererank.py: id: 99b5d368a168 - last_write_checksum: sha1:88f560edad27e74df61d8f15b9ea399a2b03f0e6 - pristine_git_object: 5bc35def1808cd44b03229af253fe0a2dfe4de76 + last_write_checksum: sha1:60e297684501dd582c9eb070eb4575b139bb8ca0 + pristine_git_object: e29f5efdd2e370591f804ed31873edd3235a80dd src/openrouter/operations/createresponses.py: id: afb834172b62 last_write_checksum: sha1:3cfb72d6b7dc9c55dc3955b53b0a7326a11f4688 @@ -10886,8 +10886,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 src/openrouter/rerank.py: id: 8dbc1be8d76f - last_write_checksum: sha1:7602b3952192d00547de27bb8a95c5cac7233ba4 - pristine_git_object: dcf9614bea7a6c98365a4e4f64abb633fb9a4a86 + last_write_checksum: sha1:cdc57deaf3bdc0362e23973d78af8bfa233e8619 + pristine_git_object: ecbc65a815ca1c2b664c04d61857a7e6ea5ad498 src/openrouter/responses.py: id: f2108fb635e1 last_write_checksum: sha1:27af78b7cedb1691bb88a71271808d1e4685c2bb @@ -10906,12 +10906,12 @@ trackedFiles: pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 src/openrouter/stt.py: id: fc0c2f669423 - last_write_checksum: sha1:af66c655d8cbe6bf2d901a7402e57b78c1f15175 - pristine_git_object: 16a9e4f4d804ac992313929f477689b142386e99 + last_write_checksum: sha1:d3600ee8ba531bff703e279695b0c19a8ef64bcd + pristine_git_object: b8ffd2741a2113f80f9638bc7f8e4899025201eb src/openrouter/tts.py: id: 5055d4b95f1d - last_write_checksum: sha1:ed6336f669add8b0bd6d3e5106b80e91b16c3115 - pristine_git_object: 621ca762f03c0ecb3ef1ed735a76a575766c1f22 + last_write_checksum: sha1:74eb2b38ef34e4929ad826389862ecf8de3ecea1 + pristine_git_object: 1cccebe83f9804175f15fb1cc82b57712fda6b90 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -11002,8 +11002,8 @@ trackedFiles: pristine_git_object: dae01a44384ac3bc13ae07453a053bf6c898ebe3 src/openrouter/video_generation.py: id: d0a90c1b8efe - last_write_checksum: sha1:6d151291b66af2d811a6c16a197eae61e70205fe - pristine_git_object: fd34623795adec9ce8440bb8c79c72dc0d3a03b4 + last_write_checksum: sha1:6cb31627ba759c621ef3d3b0136155e955963b63 + pristine_git_object: 99a90a711fcf7f12e35a3da1fdeb0f18edd5b3da src/openrouter/workspaces.py: id: cd6c533b1802 last_write_checksum: sha1:68bf23158fc838c1ad63e871b5d2de6080a75931 @@ -12924,7 +12924,9 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.tts.create_speech()`: `request.user` **Added** - * `open_router.stt.create_transcription()`: `request.user` **Added** - * `open_router.rerank.rerank()`: `request.user` **Added** - * `open_router.video_generation.generate()`: `request.user` **Added** + * `open_router.tts.create_speech()`: `request.trace` **Added** + * `open_router.stt.create_transcription()`: `request.trace` **Added** + * `open_router.embeddings.generate()`: `request.trace` **Added** + * `open_router.images.generate()`: `request.trace` **Added** + * `open_router.rerank.rerank()`: `request.trace` **Added** + * `open_router.video_generation.generate()`: `request.trace` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c02b64a8..74a70c4e 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.1.145 + version: 1.1.146 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 5be3096c..dc676834 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -10967,6 +10967,8 @@ components: stream: description: 'If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.' type: 'boolean' + trace: + $ref: '#/components/schemas/TraceConfig' user: description: 'A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier.' example: 'end-user-abc123' @@ -24608,6 +24610,8 @@ components: example: 1 format: 'double' type: 'number' + trace: + $ref: '#/components/schemas/TraceConfig' user: description: 'A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.' example: 'user-1234' @@ -25114,6 +25118,8 @@ components: items: $ref: '#/components/schemas/STTTimestampGranularity' type: 'array' + trace: + $ref: '#/components/schemas/TraceConfig' user: description: 'A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.' example: 'user-1234' @@ -27264,6 +27270,8 @@ components: description: 'Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio.' example: '1280x720' type: 'string' + trace: + $ref: '#/components/schemas/TraceConfig' upscale_factor: description: 'Upscale factor for video upscaling models only. This parameter is not supported by video generation models.' example: 2 @@ -31763,6 +31771,8 @@ paths: allOf: - $ref: '#/components/schemas/ProviderPreferences' - description: 'Provider routing preferences for the request.' + trace: + $ref: '#/components/schemas/TraceConfig' user: description: 'A unique identifier for the end-user' example: 'user-1234' @@ -39542,6 +39552,8 @@ paths: example: 3 minimum: 1 type: 'integer' + trace: + $ref: '#/components/schemas/TraceConfig' user: description: 'A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.' example: 'user-1234' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 4693b339..b25c204f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:069cec53ab9596fb7f42db9e42d001f5580c6018209731f3f55deb9ec0887b88 - sourceBlobDigest: sha256:cca0810c33dcaf16224704699508aa2b0d506305b1b359ac0498b4541a1c5f6b + sourceRevisionDigest: sha256:5bbed2f5e84ee227717f0b2e40a3141db5f0971340b7bb62f227eeade4206ec3 + sourceBlobDigest: sha256:81772f971c3bc11aff0ca276a569ce2f1bd364f3ef0d05ab389ad6dbd615eff3 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:069cec53ab9596fb7f42db9e42d001f5580c6018209731f3f55deb9ec0887b88 - sourceBlobDigest: sha256:cca0810c33dcaf16224704699508aa2b0d506305b1b359ac0498b4541a1c5f6b + sourceRevisionDigest: sha256:5bbed2f5e84ee227717f0b2e40a3141db5f0971340b7bb62f227eeade4206ec3 + sourceBlobDigest: sha256:81772f971c3bc11aff0ca276a569ce2f1bd364f3ef0d05ab389ad6dbd615eff3 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:2f3f07d57613f56ce1515fe5cd4fb6203b8c36ec492e674ff87ccaebe42e2e1b + codeSamplesRevisionDigest: sha256:68eff8471f2da48a208bca86d77d4189a74961e3be3f2457cbd6b3163577b39b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 66230210..42edcfe5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2239,4 +2239,14 @@ Based on: ### Generated - [python v1.1.145] . ### Releases -- [PyPI v1.1.145] https://pypi.org/project/openrouter/1.1.145 - . \ No newline at end of file +- [PyPI v1.1.145] https://pypi.org/project/openrouter/1.1.145 - . + +## 2026-09-15 21:51:26 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.1.146] . +### Releases +- [PyPI v1.1.146] https://pypi.org/project/openrouter/1.1.146 - . \ No newline at end of file diff --git a/docs/components/imagegenerationrequest.mdx b/docs/components/imagegenerationrequest.mdx index 68f653b5..8e71b744 100644 --- a/docs/components/imagegenerationrequest.mdx +++ b/docs/components/imagegenerationrequest.mdx @@ -23,4 +23,5 @@ Image generation request input | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | | `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. | 2K | | `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. | end-user-abc123 | \ No newline at end of file diff --git a/docs/components/speechrequest.mdx b/docs/components/speechrequest.mdx index a74e87f8..e045a6b9 100644 --- a/docs/components/speechrequest.mdx +++ b/docs/components/speechrequest.mdx @@ -7,13 +7,14 @@ Text-to-speech request input ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | -| `input_references` | List[[components.SpeechInputReference](../components/speechinputreference.mdx)] | :heavy_minus_sign: | Reference content for stateless voice cloning: one `input_audio` part carrying the voice sample, optionally accompanied by one `text` part with its transcript. Only routed to endpoints that support voice cloning. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | -| `model` | *str* | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | -| `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | -| `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | -| `user` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | Voice identifier (provider-specific). | en_paul_neutral | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | +| `input_references` | List[[components.SpeechInputReference](../components/speechinputreference.mdx)] | :heavy_minus_sign: | Reference content for stateless voice cloning: one `input_audio` part carrying the voice sample, optionally accompanied by one `text` part with its transcript. Only routed to endpoints that support voice cloning. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | +| `model` | *str* | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | +| `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | +| `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | Voice identifier (provider-specific). | en_paul_neutral | \ No newline at end of file diff --git a/docs/components/sttrequest.mdx b/docs/components/sttrequest.mdx index 39dadb91..31157642 100644 --- a/docs/components/sttrequest.mdx +++ b/docs/components/sttrequest.mdx @@ -16,4 +16,5 @@ Speech-to-text request input. Accepts a JSON body with input_audio containing ba | `response_format` | [Optional[components.STTRequestResponseFormat]](../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | | `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | | `timestamp_granularities` | List[[components.STTTimestampGranularity](../components/stttimestampgranularity.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". | [
"segment"
] | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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 | \ No newline at end of file diff --git a/docs/components/videogenerationrequest.mdx b/docs/components/videogenerationrequest.mdx index 190ba46e..4174b152 100644 --- a/docs/components/videogenerationrequest.mdx +++ b/docs/components/videogenerationrequest.mdx @@ -19,5 +19,6 @@ title: "VideoGenerationRequest" | `resolution` | [Optional[components.VideoGenerationRequestResolution]](../components/videogenerationrequestresolution.mdx) | :heavy_minus_sign: | Resolution of the generated video | 720p | | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | | `size` | *Optional[str]* | :heavy_minus_sign: | Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio. | 1280x720 | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | :heavy_minus_sign: | 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"
} | | `upscale_factor` | *Optional[float]* | :heavy_minus_sign: | Upscale factor for video upscaling models only. This parameter is not supported by video generation models. | 2 | | `user` | *Optional[str]* | :heavy_minus_sign: | 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 | \ No newline at end of file diff --git a/docs/operations/createembeddingsrequestbody.mdx b/docs/operations/createembeddingsrequestbody.mdx index a669d4e6..c5798f80 100644 --- a/docs/operations/createembeddingsrequestbody.mdx +++ b/docs/operations/createembeddingsrequestbody.mdx @@ -7,12 +7,13 @@ Embeddings request input ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `dimensions` | *Optional[int]* | :heavy_minus_sign: | The number of dimensions for the output embeddings | 1536 | -| `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.mdx) | :heavy_minus_sign: | The format of the output embeddings | float | -| `input` | [operations.InputUnion](../operations/inputunion.mdx) | :heavy_check_mark: | Text, token, or multimodal input(s) to embed | The quick brown fox jumps over the lazy dog | -| `input_type` | *Optional[str]* | :heavy_minus_sign: | The type of input (e.g. search_query, search_document) | search_query | -| `model` | *str* | :heavy_check_mark: | The model to use for embeddings | openai/text-embedding-3-small | -| `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | -| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for the end-user | user-1234 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | The number of dimensions for the output embeddings | 1536 | +| `encoding_format` | [Optional[operations.EncodingFormat]](../operations/encodingformat.mdx) | :heavy_minus_sign: | The format of the output embeddings | float | +| `input` | [operations.InputUnion](../operations/inputunion.mdx) | :heavy_check_mark: | Text, token, or multimodal input(s) to embed | The quick brown fox jumps over the lazy dog | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | The type of input (e.g. search_query, search_document) | search_query | +| `model` | *str* | :heavy_check_mark: | The model to use for embeddings | openai/text-embedding-3-small | +| `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | A unique identifier for the end-user | user-1234 | \ No newline at end of file diff --git a/docs/operations/creatererankrequestbody.mdx b/docs/operations/creatererankrequestbody.mdx index e270760c..e347a238 100644 --- a/docs/operations/creatererankrequestbody.mdx +++ b/docs/operations/creatererankrequestbody.mdx @@ -7,11 +7,12 @@ Rerank request input ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | -| `documents` | List[[operations.Document](../operations/document.mdx)] | :heavy_check_mark: | The list of documents to rerank. Documents may be plain strings, or structured objects with `text` and/or `image` for multimodal models. | [
"Paris is the capital of France.",
"Berlin is the capital of Germany."
] | -| `model` | *str* | :heavy_check_mark: | The rerank model to use | cohere/rerank-v3.5 | -| `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | -| `query` | *str* | :heavy_check_mark: | The search query to rerank documents against | What is the capital of France? | -| `top_n` | *Optional[int]* | :heavy_minus_sign: | Number of most relevant documents to return | 3 | -| `user` | *Optional[str]* | :heavy_minus_sign: | 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 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `documents` | List[[operations.Document](../operations/document.mdx)] | :heavy_check_mark: | The list of documents to rerank. Documents may be plain strings, or structured objects with `text` and/or `image` for multimodal models. | [
"Paris is the capital of France.",
"Berlin is the capital of Germany."
] | +| `model` | *str* | :heavy_check_mark: | The rerank model to use | cohere/rerank-v3.5 | +| `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | +| `query` | *str* | :heavy_check_mark: | The search query to rerank documents against | What is the capital of France? | +| `top_n` | *Optional[int]* | :heavy_minus_sign: | Number of most relevant documents to return | 3 | +| `trace` | [Optional[components.TraceConfig]](../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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 | \ No newline at end of file diff --git a/docs/sdks/embeddings/README.mdx b/docs/sdks/embeddings/README.mdx index 61d507bb..0641bd76 100644 --- a/docs/sdks/embeddings/README.mdx +++ b/docs/sdks/embeddings/README.mdx @@ -39,19 +39,20 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `input` | [operations.InputUnion](../../operations/inputunion.mdx) | :heavy_check_mark: | Text, token, or multimodal input(s) to embed | The quick brown fox jumps over the lazy dog | -| `model` | *str* | :heavy_check_mark: | The model to use for embeddings | openai/text-embedding-3-small | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `dimensions` | *Optional[int]* | :heavy_minus_sign: | The number of dimensions for the output embeddings | 1536 | -| `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.mdx) | :heavy_minus_sign: | The format of the output embeddings | float | -| `input_type` | *Optional[str]* | :heavy_minus_sign: | The type of input (e.g. search_query, search_document) | search_query | -| `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | -| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for the end-user | user-1234 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | [operations.InputUnion](../../operations/inputunion.mdx) | :heavy_check_mark: | Text, token, or multimodal input(s) to embed | The quick brown fox jumps over the lazy dog | +| `model` | *str* | :heavy_check_mark: | The model to use for embeddings | openai/text-embedding-3-small | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `dimensions` | *Optional[int]* | :heavy_minus_sign: | The number of dimensions for the output embeddings | 1536 | +| `encoding_format` | [Optional[operations.EncodingFormat]](../../operations/encodingformat.mdx) | :heavy_minus_sign: | The format of the output embeddings | float | +| `input_type` | *Optional[str]* | :heavy_minus_sign: | The type of input (e.g. search_query, search_document) | search_query | +| `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | A unique identifier for the end-user | user-1234 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/images/README.mdx b/docs/sdks/images/README.mdx index 6ee346c7..813c5671 100644 --- a/docs/sdks/images/README.mdx +++ b/docs/sdks/images/README.mdx @@ -61,6 +61,7 @@ with OpenRouter( | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | | `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. | 2K | | `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. | end-user-abc123 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/docs/sdks/rerank/README.mdx b/docs/sdks/rerank/README.mdx index cfabc30e..e1c012eb 100644 --- a/docs/sdks/rerank/README.mdx +++ b/docs/sdks/rerank/README.mdx @@ -41,18 +41,19 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `documents` | List[[operations.Document](../../operations/document.mdx)] | :heavy_check_mark: | The list of documents to rerank. Documents may be plain strings, or structured objects with `text` and/or `image` for multimodal models. | [
"Paris is the capital of France.",
"Berlin is the capital of Germany."
] | -| `model` | *str* | :heavy_check_mark: | The rerank model to use | cohere/rerank-v3.5 | -| `query` | *str* | :heavy_check_mark: | The search query to rerank documents against | What is the capital of France? | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | -| `top_n` | *Optional[int]* | :heavy_minus_sign: | Number of most relevant documents to return | 3 | -| `user` | *Optional[str]* | :heavy_minus_sign: | 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 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `documents` | List[[operations.Document](../../operations/document.mdx)] | :heavy_check_mark: | The list of documents to rerank. Documents may be plain strings, or structured objects with `text` and/or `image` for multimodal models. | [
"Paris is the capital of France.",
"Berlin is the capital of Germany."
] | +| `model` | *str* | :heavy_check_mark: | The rerank model to use | cohere/rerank-v3.5 | +| `query` | *str* | :heavy_check_mark: | The search query to rerank documents against | What is the capital of France? | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | N/A | \{
"allow_fallbacks": true
} | +| `top_n` | *Optional[int]* | :heavy_minus_sign: | Number of most relevant documents to return | 3 | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/stt/README.mdx b/docs/sdks/stt/README.mdx index 17d24017..4c94c89e 100644 --- a/docs/sdks/stt/README.mdx +++ b/docs/sdks/stt/README.mdx @@ -54,6 +54,7 @@ with OpenRouter( | `response_format` | [Optional[components.STTRequestResponseFormat]](../../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | | `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | | `timestamp_granularities` | List[[components.STTTimestampGranularity](../../components/stttimestampgranularity.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". | [
"segment"
] | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index ec16529c..e8ee2834 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -38,20 +38,21 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | -| `model` | *str* | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | -| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `input_references` | List[[components.SpeechInputReference](../../components/speechinputreference.mdx)] | :heavy_minus_sign: | Reference content for stateless voice cloning: one `input_audio` part carrying the voice sample, optionally accompanied by one `text` part with its transcript. Only routed to endpoints that support voice cloning. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | -| `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | -| `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | -| `user` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | Voice identifier (provider-specific). | en_paul_neutral | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | +| `model` | *str* | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `input_references` | List[[components.SpeechInputReference](../../components/speechinputreference.mdx)] | :heavy_minus_sign: | Reference content for stateless voice cloning: one `input_audio` part carrying the voice sample, optionally accompanied by one `text` part with its transcript. Only routed to endpoints that support voice cloning. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | +| `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | +| `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | 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]* | :heavy_minus_sign: | Voice identifier (provider-specific). | en_paul_neutral | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/videogeneration/README.mdx b/docs/sdks/videogeneration/README.mdx index 9ba8081e..cfa0f9f6 100644 --- a/docs/sdks/videogeneration/README.mdx +++ b/docs/sdks/videogeneration/README.mdx @@ -59,6 +59,7 @@ with OpenRouter( | `resolution` | [Optional[components.VideoGenerationRequestResolution]](../../components/videogenerationrequestresolution.mdx) | :heavy_minus_sign: | Resolution of the generated video | 720p | | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | | `size` | *Optional[str]* | :heavy_minus_sign: | Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio. | 1280x720 | +| `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.mdx) | :heavy_minus_sign: | 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"
} | | `upscale_factor` | *Optional[float]* | :heavy_minus_sign: | Upscale factor for video upscaling models only. This parameter is not supported by video generation models. | 2 | | `user` | *Optional[str]* | :heavy_minus_sign: | 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 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/pyproject.toml b/pyproject.toml index 64c95ecf..6e5cbdbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.1.145" +version = "1.1.146" 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 23a5fe01..5c1a2ed9 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.1.145" +__version__: str = "1.1.146" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.1.145 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.1.146 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/imagegenerationrequest.py b/src/openrouter/components/imagegenerationrequest.py index c768a0c5..569864e2 100644 --- a/src/openrouter/components/imagegenerationrequest.py +++ b/src/openrouter/components/imagegenerationrequest.py @@ -6,6 +6,7 @@ ImageGenerationProviderPreferences, ImageGenerationProviderPreferencesTypedDict, ) +from .traceconfig import TraceConfig, TraceConfigTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import List, Literal, Optional, Union @@ -124,6 +125,8 @@ class ImageGenerationRequestTypedDict(TypedDict): r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400.""" stream: NotRequired[bool] r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.""" + 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] r"""A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier.""" @@ -173,6 +176,9 @@ class ImageGenerationRequest(BaseModel): stream: Optional[bool] = None r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.""" + 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.""" + user: Optional[str] = None r"""A stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier.""" @@ -192,6 +198,7 @@ def serialize_model(self, handler): "seed", "size", "stream", + "trace", "user", ] ) diff --git a/src/openrouter/components/speechrequest.py b/src/openrouter/components/speechrequest.py index 7d85d8d0..2425633d 100644 --- a/src/openrouter/components/speechrequest.py +++ b/src/openrouter/components/speechrequest.py @@ -3,6 +3,7 @@ from __future__ import annotations from .provideroptions import ProviderOptions, ProviderOptionsTypedDict from .speechinputreference import SpeechInputReference, SpeechInputReferenceTypedDict +from .traceconfig import TraceConfig, TraceConfigTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import List, Literal, Optional, Union @@ -64,6 +65,8 @@ class SpeechRequestTypedDict(TypedDict): r"""Audio output format""" speed: NotRequired[float] r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.""" + 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] r"""A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.""" voice: NotRequired[str] @@ -91,6 +94,9 @@ class SpeechRequest(BaseModel): speed: Optional[float] = None r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.""" + 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.""" + user: Optional[str] = None r"""A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.""" @@ -105,6 +111,7 @@ def serialize_model(self, handler): "provider", "response_format", "speed", + "trace", "user", "voice", ] diff --git a/src/openrouter/components/sttrequest.py b/src/openrouter/components/sttrequest.py index 175d4308..7a2eaf2a 100644 --- a/src/openrouter/components/sttrequest.py +++ b/src/openrouter/components/sttrequest.py @@ -4,6 +4,7 @@ from .provideroptions import ProviderOptions, ProviderOptionsTypedDict from .sttinputaudio import STTInputAudio, STTInputAudioTypedDict from .stttimestampgranularity import STTTimestampGranularity +from .traceconfig import TraceConfig, TraceConfigTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import List, Literal, Optional, Union @@ -67,6 +68,8 @@ class STTRequestTypedDict(TypedDict): r"""Sampling temperature for transcription""" timestamp_granularities: NotRequired[List[STTTimestampGranularity]] r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".""" + 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] r"""A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.""" @@ -95,6 +98,9 @@ class STTRequest(BaseModel): timestamp_granularities: Optional[List[STTTimestampGranularity]] = None r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".""" + 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.""" + user: Optional[str] = None r"""A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.""" @@ -107,6 +113,7 @@ def serialize_model(self, handler): "response_format", "temperature", "timestamp_granularities", + "trace", "user", ] ) diff --git a/src/openrouter/components/videogenerationrequest.py b/src/openrouter/components/videogenerationrequest.py index 98b5556f..c8510303 100644 --- a/src/openrouter/components/videogenerationrequest.py +++ b/src/openrouter/components/videogenerationrequest.py @@ -3,6 +3,7 @@ from __future__ import annotations from .frameimage import FrameImage, FrameImageTypedDict from .inputreference import InputReference, InputReferenceTypedDict +from .traceconfig import TraceConfig, TraceConfigTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr import pydantic from pydantic import model_serializer @@ -738,6 +739,8 @@ class VideoGenerationRequestTypedDict(TypedDict): r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers.""" size: NotRequired[str] r"""Exact pixel dimensions of the generated video in \"WIDTHxHEIGHT\" format (e.g. \"1280x720\"). Interchangeable with resolution + aspect_ratio.""" + 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.""" upscale_factor: NotRequired[float] r"""Upscale factor for video upscaling models only. This parameter is not supported by video generation models.""" user: NotRequired[str] @@ -783,6 +786,9 @@ class VideoGenerationRequest(BaseModel): size: Optional[str] = None r"""Exact pixel dimensions of the generated video in \"WIDTHxHEIGHT\" format (e.g. \"1280x720\"). Interchangeable with resolution + aspect_ratio.""" + 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.""" + upscale_factor: Optional[float] = None r"""Upscale factor for video upscaling models only. This parameter is not supported by video generation models.""" @@ -805,6 +811,7 @@ def serialize_model(self, handler): "resolution", "seed", "size", + "trace", "upscale_factor", "user", ] diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index b17f06e5..8aa54d28 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -35,6 +35,9 @@ def generate( components.ProviderPreferences, components.ProviderPreferencesTypedDict ] ] = UNSET, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -59,6 +62,7 @@ def generate( :param encoding_format: The format of the output embeddings :param input_type: The type of input (e.g. search_query, search_document) :param provider: + :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 for the end-user :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -89,6 +93,7 @@ def generate( provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) @@ -254,6 +259,9 @@ async def generate_async( components.ProviderPreferences, components.ProviderPreferencesTypedDict ] ] = UNSET, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -278,6 +286,7 @@ async def generate_async( :param encoding_format: The format of the output embeddings :param input_type: The type of input (e.g. search_query, search_document) :param provider: + :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 for the end-user :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -308,6 +317,7 @@ async def generate_async( provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) diff --git a/src/openrouter/images.py b/src/openrouter/images.py index b7abaae4..551d5c2b 100644 --- a/src/openrouter/images.py +++ b/src/openrouter/images.py @@ -43,6 +43,9 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: Union[Literal[False], None] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -74,6 +77,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -112,6 +116,9 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: Literal[True], + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -143,6 +150,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -181,6 +189,9 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: bool, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -215,6 +226,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -252,6 +264,9 @@ def generate( seed: Optional[int] = None, size: Optional[str] = None, stream: Optional[bool] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -286,6 +301,7 @@ def generate( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -325,6 +341,7 @@ def generate( seed=seed, size=size, stream=stream, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) @@ -532,6 +549,9 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: Union[Literal[False], None] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -563,6 +583,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -601,6 +622,9 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: Literal[True], + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -632,6 +656,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -670,6 +695,9 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: bool, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -704,6 +732,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -741,6 +770,9 @@ async def generate_async( seed: Optional[int] = None, size: Optional[str] = None, stream: Optional[bool] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -775,6 +807,7 @@ async def generate_async( :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. + :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 stable identifier for your end-users. Used to help detect and prevent abuse. Never sent to providers verbatim: for providers whose data policy requires user IDs, it is folded into a hashed, per-account upstream user identifier. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -814,6 +847,7 @@ async def generate_async( seed=seed, size=size, stream=stream, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index a7fed8ea..6ffa8298 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -7,6 +7,7 @@ contentpartinputvideo as components_contentpartinputvideo, costdetails as components_costdetails, providerpreferences as components_providerpreferences, + traceconfig as components_traceconfig, ) from openrouter.types import ( BaseModel, @@ -205,6 +206,8 @@ class CreateEmbeddingsRequestBodyTypedDict(TypedDict): provider: NotRequired[ Nullable[components_providerpreferences.ProviderPreferencesTypedDict] ] + trace: NotRequired[components_traceconfig.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] r"""A unique identifier for the end-user""" @@ -231,13 +234,16 @@ class CreateEmbeddingsRequestBody(BaseModel): UNSET ) + trace: Optional[components_traceconfig.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.""" + user: Optional[str] = None r"""A unique identifier for the end-user""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["dimensions", "encoding_format", "input_type", "provider", "user"] + ["dimensions", "encoding_format", "input_type", "provider", "trace", "user"] ) nullable_fields = set(["provider"]) serialized = handler(self) diff --git a/src/openrouter/operations/creatererank.py b/src/openrouter/operations/creatererank.py index 5bc35def..e29f5efd 100644 --- a/src/openrouter/operations/creatererank.py +++ b/src/openrouter/operations/creatererank.py @@ -1,7 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.components import providerpreferences as components_providerpreferences +from openrouter.components import ( + providerpreferences as components_providerpreferences, + traceconfig as components_traceconfig, +) from openrouter.types import ( BaseModel, Nullable, @@ -139,6 +142,8 @@ class CreateRerankRequestBodyTypedDict(TypedDict): ] top_n: NotRequired[int] r"""Number of most relevant documents to return""" + trace: NotRequired[components_traceconfig.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] r"""A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.""" @@ -162,12 +167,15 @@ class CreateRerankRequestBody(BaseModel): top_n: Optional[int] = None r"""Number of most relevant documents to return""" + trace: Optional[components_traceconfig.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.""" + user: Optional[str] = None r"""A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["provider", "top_n", "user"]) + optional_fields = set(["provider", "top_n", "trace", "user"]) nullable_fields = set(["provider"]) serialized = handler(self) m = {} diff --git a/src/openrouter/rerank.py b/src/openrouter/rerank.py index dcf9614b..ecbc65a8 100644 --- a/src/openrouter/rerank.py +++ b/src/openrouter/rerank.py @@ -35,6 +35,9 @@ def rerank( ] ] = UNSET, top_n: Optional[int] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -58,6 +61,7 @@ def rerank( :param provider: :param top_n: Number of most relevant documents to return + :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 retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -89,6 +93,7 @@ def rerank( ), query=query, top_n=top_n, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) @@ -250,6 +255,9 @@ async def rerank_async( ] ] = UNSET, top_n: Optional[int] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -273,6 +281,7 @@ async def rerank_async( :param provider: :param top_n: Number of most relevant documents to return + :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 retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -304,6 +313,7 @@ async def rerank_async( ), query=query, top_n=top_n, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) diff --git a/src/openrouter/stt.py b/src/openrouter/stt.py index 16a9e4f4..b8ffd274 100644 --- a/src/openrouter/stt.py +++ b/src/openrouter/stt.py @@ -29,6 +29,9 @@ def create_transcription( timestamp_granularities: Optional[ Iterable[components.STTTimestampGranularity] ] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -53,6 +56,7 @@ def create_transcription( :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param temperature: Sampling temperature for transcription :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\". + :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 retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -88,6 +92,7 @@ def create_transcription( timestamp_granularities, Optional[List[components.STTTimestampGranularity]], ), + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) @@ -239,6 +244,9 @@ async def create_transcription_async( timestamp_granularities: Optional[ Iterable[components.STTTimestampGranularity] ] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -263,6 +271,7 @@ async def create_transcription_async( :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param temperature: Sampling temperature for transcription :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\". + :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 retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -298,6 +307,7 @@ async def create_transcription_async( timestamp_granularities, Optional[List[components.STTTimestampGranularity]], ), + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, ), ) diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py index 621ca762..1cccebe8 100644 --- a/src/openrouter/tts.py +++ b/src/openrouter/tts.py @@ -35,6 +35,9 @@ def create_speech( ] = None, response_format: Optional[components.SpeechRequestResponseFormat] = "pcm", speed: Optional[float] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, voice: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -59,6 +62,7 @@ def create_speech( :param provider: Provider-specific passthrough configuration :param response_format: Audio output format :param speed: Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. + :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). :param retries: Override the default retry configuration for this method @@ -91,6 +95,7 @@ def create_speech( ), response_format=response_format, speed=speed, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, voice=voice, ), @@ -280,6 +285,9 @@ async def create_speech_async( ] = None, response_format: Optional[components.SpeechRequestResponseFormat] = "pcm", speed: Optional[float] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, user: Optional[str] = None, voice: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -304,6 +312,7 @@ async def create_speech_async( :param provider: Provider-specific passthrough configuration :param response_format: Audio output format :param speed: Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. + :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). :param retries: Override the default retry configuration for this method @@ -336,6 +345,7 @@ async def create_speech_async( ), response_format=response_format, speed=speed, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), user=user, voice=voice, ), diff --git a/src/openrouter/video_generation.py b/src/openrouter/video_generation.py index fd346237..99a90a71 100644 --- a/src/openrouter/video_generation.py +++ b/src/openrouter/video_generation.py @@ -47,6 +47,9 @@ def generate( resolution: Optional[components.VideoGenerationRequestResolution] = None, seed: Optional[int] = None, size: Optional[str] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, upscale_factor: Optional[float] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -78,6 +81,7 @@ def generate( :param resolution: Resolution of the generated video :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Exact pixel dimensions of the generated video in \"WIDTHxHEIGHT\" format (e.g. \"1280x720\"). Interchangeable with resolution + aspect_ratio. + :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 upscale_factor: Upscale factor for video upscaling models only. This parameter is not supported by video generation models. :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 retries: Override the default retry configuration for this method @@ -119,6 +123,7 @@ def generate( resolution=resolution, seed=seed, size=size, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), upscale_factor=upscale_factor, user=user, ), @@ -272,6 +277,9 @@ async def generate_async( resolution: Optional[components.VideoGenerationRequestResolution] = None, seed: Optional[int] = None, size: Optional[str] = None, + trace: Optional[ + Union[components.TraceConfig, components.TraceConfigTypedDict] + ] = None, upscale_factor: Optional[float] = None, user: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -303,6 +311,7 @@ async def generate_async( :param resolution: Resolution of the generated video :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. :param size: Exact pixel dimensions of the generated video in \"WIDTHxHEIGHT\" format (e.g. \"1280x720\"). Interchangeable with resolution + aspect_ratio. + :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 upscale_factor: Upscale factor for video upscaling models only. This parameter is not supported by video generation models. :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 retries: Override the default retry configuration for this method @@ -344,6 +353,7 @@ async def generate_async( resolution=resolution, seed=seed, size=size, + trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), upscale_factor=upscale_factor, user=user, ), diff --git a/uv.lock b/uv.lock index a824fb26..7193e9f3 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.1.145" +version = "1.1.146" source = { editable = "." } dependencies = [ { name = "httpcore" }, From a2b5b11ba4b1b3b72e1fc15499d1b9b9ac95ce50 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Tue, 15 Sep 2026 21:53:52 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow