From 0f63e08b0d9ce31d268a130327884b32e037f6d6 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 3 Dec 2026 21:26:22 +0000 Subject: [PATCH] =?UTF-8?q?##=20Python=20SDK=20Changes:=20*=20`open=5Frout?= =?UTF-8?q?er.batch.create=5Fbatches()`:=20=20`response.results[].response?= =?UTF-8?q?.body`=20**Changed**=20(Breaking=20=E2=9A=A0=EF=B8=8F)=20*=20`o?= =?UTF-8?q?pen=5Frouter.batch.get=5Fbatches()`:=20=20`response.results[].r?= =?UTF-8?q?esponse.body`=20**Changed**=20(Breaking=20=E2=9A=A0=EF=B8=8F)?= =?UTF-8?q?=20*=20`open=5Frouter.batch.cancel()`:=20=20`response.results[]?= =?UTF-8?q?.response.body`=20**Changed**=20(Breaking=20=E2=9A=A0=EF=B8=8F)?= =?UTF-8?q?=20*=20`open=5Frouter.batch.get=5Fresults()`:=20=20`response.da?= =?UTF-8?q?ta[].response.body`=20**Changed**=20(Breaking=20=E2=9A=A0?= =?UTF-8?q?=EF=B8=8F)=20*=20`open=5Frouter.tts.create=5Fspeech()`:=20=20?= =?UTF-8?q?=20*=20=20`request.input=5Freferences[].union(video=5Furl)`=20*?= =?UTF-8?q?*Added**=20*=20`open=5Frouter.tts.list=5Fmodels()`:=20=20`respo?= =?UTF-8?q?nse.data[].endpoints[].input=5Fmodalities[].union(video)`=20**A?= =?UTF-8?q?dded**=20*=20`open=5Frouter.tts.get=5Fmodel()`:=20=20`response.?= =?UTF-8?q?endpoints[].input=5Fmodalities[].union(video)`=20**Added**=20*?= =?UTF-8?q?=20`open=5Frouter.presets.create=5Fpresets=5Fmessages()`:=20=20?= =?UTF-8?q?=20*=20=20`request.messages[].content.union(Array<>)[]`=20**Cha?= =?UTF-8?q?nged**?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .speakeasy/gen.lock | 225 +++++++++++----- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 253 ++++++++++++++++-- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/anthropicsafeguardresult.mdx | 14 + .../anthropicsafeguardresultstatus.mdx | 10 + docs/components/anthropicservertoolusage.mdx | 10 - docs/components/anthropicservicetier.mdx | 21 -- docs/components/appliededit.mdx | 10 + .../batchimagegenerationmissingimage.mdx | 13 + .../batchimagegenerationresponse.mdx | 15 +- .../batchresultcontextmanagement.mdx | 9 + .../batchresultdeferredtoolsdetails.mdx | 12 + docs/components/batchresultusage2.mdx | 30 ++- docs/components/bodymessage.mdx | 30 ++- .../components/messagesmcptoolresultblock.mdx | 16 ++ .../messagesmcptoolresultblockcontent.mdx | 18 ++ .../messagesmcptoolresultblocktype.mdx | 15 ++ docs/components/messagesmcptooluseblock.mdx | 17 ++ .../messagesmcptooluseblocktype.mdx | 15 ++ .../messagesmessageparamcontentunion4.mdx | 12 + docs/components/messagesrequest.mdx | 2 +- ...x => messagesrequestcontextmanagement.mdx} | 2 +- .../components/oranthropicservertoolusage.mdx | 12 + docs/components/speechinputmodality.mdx | 8 +- .../speechinputmodalitysupportedinputs3.mdx | 12 + .../speechinputmodalitytypevideo.mdx | 15 ++ docs/components/speechinputmodalityvideo.mdx | 10 + docs/components/speechinputreference.mdx | 6 + docs/components/speechinputreferencevideo.mdx | 13 + .../speechinputreferencevideoinput.mdx | 12 + .../speechinputreferencevideotype.mdx | 15 ++ docs/components/speechrequest.mdx | 2 +- docs/sdks/presets/README.mdx | 2 +- docs/sdks/tts/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 133 +++++++-- .../components/anthropicsafeguardresult.py | 57 ++++ .../components/anthropicservertoolusage.py | 16 -- .../components/anthropicservicetier.py | 15 -- .../batchimagegenerationmissingimage.py | 24 ++ .../batchimagegenerationresponse.py | 11 +- src/openrouter/components/batchresult.py | 128 ++++++++- .../components/messagesmcptoolresultblock.py | 71 +++++ .../components/messagesmcptooluseblock.py | 59 ++++ .../components/messagesmessageparam.py | 14 +- src/openrouter/components/messagesrequest.py | 8 +- .../components/oranthropicservertoolusage.py | 40 +++ .../components/speechinputmodality.py | 35 ++- .../components/speechinputreference.py | 6 + .../components/speechinputreferencevideo.py | 30 +++ .../speechinputreferencevideoinput.py | 19 ++ src/openrouter/components/speechrequest.py | 4 +- src/openrouter/presets.py | 16 +- src/openrouter/tts.py | 4 +- uv.lock | 2 +- 58 files changed, 1332 insertions(+), 248 deletions(-) create mode 100644 docs/components/anthropicsafeguardresult.mdx create mode 100644 docs/components/anthropicsafeguardresultstatus.mdx delete mode 100644 docs/components/anthropicservertoolusage.mdx delete mode 100644 docs/components/anthropicservicetier.mdx create mode 100644 docs/components/appliededit.mdx create mode 100644 docs/components/batchimagegenerationmissingimage.mdx create mode 100644 docs/components/batchresultcontextmanagement.mdx create mode 100644 docs/components/batchresultdeferredtoolsdetails.mdx create mode 100644 docs/components/messagesmcptoolresultblock.mdx create mode 100644 docs/components/messagesmcptoolresultblockcontent.mdx create mode 100644 docs/components/messagesmcptoolresultblocktype.mdx create mode 100644 docs/components/messagesmcptooluseblock.mdx create mode 100644 docs/components/messagesmcptooluseblocktype.mdx rename docs/components/{contextmanagement.mdx => messagesrequestcontextmanagement.mdx} (93%) create mode 100644 docs/components/oranthropicservertoolusage.mdx create mode 100644 docs/components/speechinputmodalitysupportedinputs3.mdx create mode 100644 docs/components/speechinputmodalitytypevideo.mdx create mode 100644 docs/components/speechinputmodalityvideo.mdx create mode 100644 docs/components/speechinputreferencevideo.mdx create mode 100644 docs/components/speechinputreferencevideoinput.mdx create mode 100644 docs/components/speechinputreferencevideotype.mdx create mode 100644 src/openrouter/components/anthropicsafeguardresult.py delete mode 100644 src/openrouter/components/anthropicservertoolusage.py delete mode 100644 src/openrouter/components/anthropicservicetier.py create mode 100644 src/openrouter/components/batchimagegenerationmissingimage.py create mode 100644 src/openrouter/components/messagesmcptoolresultblock.py create mode 100644 src/openrouter/components/messagesmcptooluseblock.py create mode 100644 src/openrouter/components/oranthropicservertoolusage.py create mode 100644 src/openrouter/components/speechinputreferencevideo.py create mode 100644 src/openrouter/components/speechinputreferencevideoinput.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 26f955735..88923a8c0 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: a86fd69b34e5b92a3338d2e01b99781b + docChecksum: da3ef99dd6fb0701b7b3b4ec84d77525 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.239 - configChecksum: cfd9216068d53c3cc41cb940470e50c2 + releaseVersion: 1.3.240 + configChecksum: 4533f531616726421777636817f13109 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: f0ff829b-b8d7-4216-9086-e1e1ba8e7bdb - pristine_commit_hash: 0e76eb76c15444e0832f4eb6026b17443bf42865 - pristine_tree_hash: fef9e03d43316c6aa26f0a3ead37016a4ef00ddf + generation_id: d5fab7d1-c810-43a6-9f63-74fe3a57b674 + pristine_commit_hash: 617c5a2d83097a5c512d7f11afed0ca3397e9ef3 + pristine_tree_hash: a99176549e8fc9caa467a1630587ee90d4427087 features: python: acceptHeaders: 3.0.0 @@ -766,6 +766,14 @@ trackedFiles: id: 04d5a44fa933 last_write_checksum: sha1:cbc7f89487bf10941db9b89dee21af24dd77e2bc pristine_git_object: 4d8804860600af69d5984301701424e834f3ed7b + docs/components/anthropicsafeguardresult.mdx: + id: a75f1bda3182 + last_write_checksum: sha1:6de7f5c8f4d297cb5c98f24e85ae5aad3dcfe05a + pristine_git_object: 0b1e25ad69aae209916cbe2a217217650c9dc74b + docs/components/anthropicsafeguardresultstatus.mdx: + id: 1c683d8f6b73 + last_write_checksum: sha1:2310fe6f814aa83da6158a2809ae860030b39e5c + pristine_git_object: aadccae40b57b9c729585d5800f874928848894e docs/components/anthropicsearchresultblockparam.mdx: id: 5c62b24b2c58 last_write_checksum: sha1:3c95c2a83b9b47f12c7468886cf44b5569926ebb @@ -782,14 +790,6 @@ trackedFiles: id: 47317eda347c last_write_checksum: sha1:174906e9f926c5918f870bf46b4c557e1902466f pristine_git_object: 043523bd96ea7b806e72c0af5457b93bba34aeb7 - docs/components/anthropicservertoolusage.mdx: - id: f71da18a547b - last_write_checksum: sha1:d471daebc85bf9a0495749117bdee6fa78bd42c3 - pristine_git_object: b5c15b64c27a9f713cbf46c1b69309dd646628b4 - docs/components/anthropicservicetier.mdx: - id: a11c4a30fb6d - last_write_checksum: sha1:eaf18ce06737f19fc04c150fc48f2d7b20e67357 - pristine_git_object: 7cf6ee646c2b6a2cd313b2e06b481b9513df2977 docs/components/anthropicspeed.mdx: id: 1227dfabccec last_write_checksum: sha1:0ba0013465693c68ce5820446a42525416df92cc @@ -1154,6 +1154,10 @@ trackedFiles: id: aa5cb5867777 last_write_checksum: sha1:4cf8185961b17ac1c29f800372c0056e974a863f pristine_git_object: ead7b40fbf855ea9020fed42ecba8fd09ed823f6 + docs/components/appliededit.mdx: + id: 5d17b20c8125 + last_write_checksum: sha1:b8161da3079cc7a71d5b27b5f038b92eb53d610f + pristine_git_object: 1589a9f957c4f8281b305182dd97c2850f13388f docs/components/applypatchcallitem.mdx: id: 00fd75573009 last_write_checksum: sha1:ca9be76cce1b80225011cc550c2c61ca16944e66 @@ -1474,10 +1478,14 @@ trackedFiles: id: ecfe0c4de02d last_write_checksum: sha1:9b7f38cdcfb2b4897e311f54ad09f77f590f986c pristine_git_object: d7cd749451dea7b5545eae5f039e368cfc825d7d + docs/components/batchimagegenerationmissingimage.mdx: + id: 5b5b83659dbb + last_write_checksum: sha1:eba7a69827e49664e45237bb9e38411788c5a7a7 + pristine_git_object: 7f40f810bf8d5cc30b336e0d9e3df8fcabb9ff64 docs/components/batchimagegenerationresponse.mdx: id: 0dec69d57d65 - last_write_checksum: sha1:e88330dd820b527bb97b4eea181c15147bc0a9c3 - pristine_git_object: d3e3896eab193c37e9012cd70609bdc89e9b8f79 + last_write_checksum: sha1:20ba36622f36974ad39ddedd9d9b57204c84f78d + pristine_git_object: e53e5d91cdc878ee6df4beff3fffb879b118ef90 docs/components/batchinputreference.mdx: id: 5720c0dc0b92 last_write_checksum: sha1:5be09cf46a022cd7f3074189b096d486b271fac9 @@ -1634,6 +1642,10 @@ trackedFiles: id: e2c8050549e3 last_write_checksum: sha1:d4c153031e7cf56eed5ac54b58c8de97bb6823bb pristine_git_object: 544cc88dc189119a64a0ff773b887a829bdd2891 + docs/components/batchresultcontextmanagement.mdx: + id: 7350c80bd33b + last_write_checksum: sha1:5938d74d88388f0b820ab4faf53ae95522a74232 + pristine_git_object: 7cdf436d132aeb46aeede13d9613484ceca0bcff docs/components/batchresultdata.mdx: id: b7cd5600f6e1 last_write_checksum: sha1:623eee72c90fec49b7661698724c16a92dcbc56e @@ -1642,6 +1654,10 @@ trackedFiles: id: cfe506b7f161 last_write_checksum: sha1:34ee333a8bcd0c30760cacd92b648da90e08c13f pristine_git_object: c726d292890f51fe2b4fa9ae12331c1130e0b13d + docs/components/batchresultdeferredtoolsdetails.mdx: + id: cbc558c87113 + last_write_checksum: sha1:55d276af2ea4d8f9c538030449271c31f0ead7ff + pristine_git_object: 273012cd31233321d3dd2b16b6a8a92e24c774dc docs/components/batchresulterror.mdx: id: bee09c12de83 last_write_checksum: sha1:0d72dd7d796f805ea091a2912c1b7fd868deb84d @@ -1720,8 +1736,8 @@ trackedFiles: pristine_git_object: ccc4b1eae8aae13fb7351eaf1568303a83fd2783 docs/components/batchresultusage2.mdx: id: "723067701e04" - last_write_checksum: sha1:e68006266cc3b96fd85f5de0cd283969af61cebd - pristine_git_object: 4057d2ababd8198b31eb84fd14d3792b9e6e1aa3 + last_write_checksum: sha1:14616976812877f8d1f79d5d323f720f2dead523 + pristine_git_object: dae93587774b2c0ee41e04a1b4b40596d9863c25 docs/components/batchresultusage3.mdx: id: 51e07351c309 last_write_checksum: sha1:185cd18067041554074a344a3e8564e537c90aaa @@ -1760,8 +1776,8 @@ trackedFiles: pristine_git_object: 80b39332616b88f837caf1c98e33ad049ebb1be4 docs/components/bodymessage.mdx: id: 1b60240104a1 - last_write_checksum: sha1:f6e0cc9d9343140257a25585f004f9bb055f92b3 - pristine_git_object: 5b8a2b547a9cee04876970f9cfdd42bb2c0713ae + last_write_checksum: sha1:bb122857d91160a56e0b690dba67f151ba2074c3 + pristine_git_object: 536e3bd4f92c5dfd8b33f8417f3e891e15a24606 docs/components/booleancapability.mdx: id: 514674d4ad70 last_write_checksum: sha1:0b9bd6471f97a6fb319bec066b96eea6b0d10fb6 @@ -2850,10 +2866,6 @@ trackedFiles: id: 5134b610fa66 last_write_checksum: sha1:54b05cc44a4b00376866ae343eb7391610080619 pristine_git_object: fea81b2ffabc35c1025a1c8fd7d3261c039b3fc8 - docs/components/contextmanagement.mdx: - id: ba18678d8673 - last_write_checksum: sha1:fc87d3c7b6597feb8736e4a3051bce701ba11996 - pristine_git_object: 6504898796a71f35266b4f97b2bb684f302662da docs/components/contradiction.mdx: id: bb27f66efcae last_write_checksum: sha1:859e68e06bf8747d5ecab945584297a9a39745fb @@ -5522,6 +5534,26 @@ trackedFiles: id: d7e026fed5f2 last_write_checksum: sha1:c851b11eeadd14a6eb0c026a094b912ba51a7881 pristine_git_object: 02828d560efccc63aa2c0dc55522452769a82cdb + docs/components/messagesmcptoolresultblock.mdx: + id: 1edd968f4a30 + last_write_checksum: sha1:82d834c615157d9211508ecc6149f1fb2c627775 + pristine_git_object: 91f68222a8286a13180fc2a5aa4fd47339bf3912 + docs/components/messagesmcptoolresultblockcontent.mdx: + id: 2c680278217a + last_write_checksum: sha1:7afa09ff438f1676eb92b80cd9f5fbb9359c81e1 + pristine_git_object: d28e7a49ace51e4710233244aef63bebe66d41bc + docs/components/messagesmcptoolresultblocktype.mdx: + id: 3a5f26d28ba5 + last_write_checksum: sha1:b60b5eb4b2ec3fdc1c1b28ac88644c6b3aa52ed3 + pristine_git_object: 4fbb74e397232cf4aefeb0a3038f9f987bb93da6 + docs/components/messagesmcptooluseblock.mdx: + id: 0e17574fa897 + last_write_checksum: sha1:db82e37c52ef1722b2fcf3ff698c1ba509622e22 + pristine_git_object: ced687980316ef2f758f97236a23eb696cb00463 + docs/components/messagesmcptooluseblocktype.mdx: + id: 89acd481f0ee + last_write_checksum: sha1:6a0578cade912deba5ed7edfd68f3eb43f41e67c + pristine_git_object: cb74678cb58a54fa7ff6e54480e3abec03d96ba4 docs/components/messagesmessageparam.mdx: id: 816cdd6ac883 last_write_checksum: sha1:95c10d62626a1082e0e9c2f3307a6b39684c9b15 @@ -5540,8 +5572,8 @@ trackedFiles: pristine_git_object: aacfcabc1908dd56355bd5059c8d896a7f5266fd docs/components/messagesmessageparamcontentunion4.mdx: id: 0cbf68d37ca2 - last_write_checksum: sha1:d70091a9c9894274089dd1b6a43e26c0e3bba0b1 - pristine_git_object: c4023c5e558f785a7fee9e630bab21241d961cfc + last_write_checksum: sha1:0699243912ff1f3c07ed58cb4c70b5fe68320a5b + pristine_git_object: c10fe45f58c3e241dced1cffd3c2d05f700bc251 docs/components/messagesmessageparamcontentunion5.mdx: id: 103a9b1bc479 last_write_checksum: sha1:8082efc20a4cb6d09750ac74b4db5a4f224d7032 @@ -5604,8 +5636,12 @@ trackedFiles: pristine_git_object: cff8f3938a8bd5699d1111a6b1a926518d868da5 docs/components/messagesrequest.mdx: id: 762dd6b894c8 - last_write_checksum: sha1:88f1f9ae4b2478312564c52475c65edfead55278 - pristine_git_object: f5f01405b7bcd41678556b0048f19b93d0869d51 + last_write_checksum: sha1:224ab9c0d59730adb2de36a8fd5b0f4097c79cd6 + pristine_git_object: 70fb05bad7005214050f52ba366cdec2000e1b06 + docs/components/messagesrequestcontextmanagement.mdx: + id: 98e021145678 + last_write_checksum: sha1:67e9dd0436a43ba3f2891655807fae5133ed5f65 + pristine_git_object: 7e16469aaec4daf4af168fa528557b51f6a527f5 docs/components/messagesrequestinputschema.mdx: id: 2632c649261a last_write_checksum: sha1:034fdaba58afe6eca4eaf76722562181c63204a2 @@ -6770,6 +6806,10 @@ trackedFiles: id: 163ca32be097 last_write_checksum: sha1:54cbb4fdca84a000288b7413f3b41416e0a6260c pristine_git_object: 2468ce4998e2e2608d43d29e13c0fb8581bb2fe8 + docs/components/oranthropicservertoolusage.mdx: + id: 476dda20e2a6 + last_write_checksum: sha1:bb9ac211e65cddf0f3034241c622b1cc53c94c50 + pristine_git_object: bdb75f5c70cd706b377d91c3316ae690162b8a94 docs/components/oranthropicservertooluseblock.mdx: id: 83e7243ef12a last_write_checksum: sha1:fbd7764420e9f1efbc8971525cb60e14a37d44d4 @@ -8624,8 +8664,8 @@ trackedFiles: pristine_git_object: 5d2f88829becfc0307674fce87660e96744b7a2e docs/components/speechinputmodality.mdx: id: 74665b26b41d - last_write_checksum: sha1:fbd1f49f5f591486ee0b112f1829bd57eade2f61 - pristine_git_object: 73d08f72f390b4a8fbd9c8da60237c41a2522f24 + last_write_checksum: sha1:c2ffb3a2b363fdec40c36a8a3a5c81e9b7d2eb93 + pristine_git_object: 00aa5bea806fd6f364659761c90ba2d892e246d3 docs/components/speechinputmodalityaudio.mdx: id: 67f693a9a81e last_write_checksum: sha1:d51c21c9a10941aef4c1eee27e61658814be4e7d @@ -8642,6 +8682,10 @@ trackedFiles: id: acc111e79186 last_write_checksum: sha1:9a4eb1759b618b88f7531c84215e6a1edc2c8270 pristine_git_object: 79cc36d2d2449741618ff97eaf90f1867a6eb72b + docs/components/speechinputmodalitysupportedinputs3.mdx: + id: 6d3a586321bf + last_write_checksum: sha1:d2b7aed01d1a75f3901db7e4d9fe3a75da46d5aa + pristine_git_object: 60ae8dfdb9ba9c92fe446def171f0ebb4511666c docs/components/speechinputmodalitytext.mdx: id: bc020871a6bd last_write_checksum: sha1:f6663f63dee7bcc357c1453fd3b7986921195dce @@ -8658,10 +8702,18 @@ trackedFiles: id: 47c7ef08dc97 last_write_checksum: sha1:5ac975e782a6cfc85be9b3261d7bc593af72de8c pristine_git_object: 8c006e8a55b7fe67bc1f7d73cd6af002747ce36f + docs/components/speechinputmodalitytypevideo.mdx: + id: 040927ce4d71 + last_write_checksum: sha1:49a80efba726ae3f9f1d1f8d5115180857fa39bf + pristine_git_object: 5c8b67ed230b146d2b15199b9cdeb34cb6c69718 + docs/components/speechinputmodalityvideo.mdx: + id: 99ea114b6fa5 + last_write_checksum: sha1:40a448891f421152c44c815fc9161f78c6be7e04 + pristine_git_object: f2404cb0512baf06556e71fba9f0032db146911d docs/components/speechinputreference.mdx: id: eb5af16936c7 - last_write_checksum: sha1:ab545b03da2161ae1ad449714b6861cd55ae66df - pristine_git_object: 7303b4f78166679c086effde5fd5b6ab875d580d + last_write_checksum: sha1:b696e042b0ad5f55d76a12f10492ab763c34c5f4 + pristine_git_object: bf1a026c222d301ec0af471de873f56757bfb9d9 docs/components/speechinputreferenceaudio.mdx: id: be120390be39 last_write_checksum: sha1:b0da3143600eb97ee54381a59ebb8543e9116862 @@ -8694,6 +8746,18 @@ trackedFiles: id: 469b6fa8fe52 last_write_checksum: sha1:47783070359618513e2d6c3b963e507cf1320b70 pristine_git_object: 34f4f07fb3008df83646fa3d88ce04009274246a + docs/components/speechinputreferencevideo.mdx: + id: 62b98e023125 + last_write_checksum: sha1:ea573c5d7e096ad1e57f49678a8d0b369b28c88a + pristine_git_object: c1d68b1a481378c99f6194a438a44f5736fdbd92 + docs/components/speechinputreferencevideoinput.mdx: + id: e949ba183b5a + last_write_checksum: sha1:d13e41894939538d1a18142926aa1422d008bfd0 + pristine_git_object: 8f2b083dd31522266f5c6012a0b02144b5b629d6 + docs/components/speechinputreferencevideotype.mdx: + id: 566a59e202da + last_write_checksum: sha1:4085fd9374d0f69bda3c327d7abf30187d164508 + pristine_git_object: 217bb098c318faa94b9ba22d87146a3c8d30826e docs/components/speechmodelendpoint.mdx: id: b8c3e3b45e5c last_write_checksum: sha1:5282f90e9496c119040eb10205ee6ed252be1945 @@ -8732,8 +8796,8 @@ trackedFiles: pristine_git_object: 38be122fce694e660cd56d82182dd3d15098479d docs/components/speechrequest.mdx: id: 06e81b0433f6 - last_write_checksum: sha1:3318701c05a03d405b7488bf15ac6eae85be102c - pristine_git_object: 94c1dd82bdafa8a76b5c2d6ebb0be79e5187c7b5 + last_write_checksum: sha1:cc260ca2df52bda4375414e89f584f07e00cd26b + pristine_git_object: b790ed7575b3bbaa6449fc3ab5b49ba6601ae704 docs/components/speechrequestdatacollection.mdx: id: 6c5938568888 last_write_checksum: sha1:89a08b4c4de66c1ef7676792a38747e030ed6729 @@ -12532,8 +12596,8 @@ trackedFiles: pristine_git_object: 4762825df814e75d1f9c2c4067444270f4ec7b60 docs/sdks/presets/README.mdx: id: eeb505928d52 - last_write_checksum: sha1:ab5df86c3835d98f1152600d54841ac1ae45176c - pristine_git_object: 28c3e51a827054eb167e08eebd47ba6a3fd75f6b + last_write_checksum: sha1:16aa87cbf758012f1d4281d64e50dedb13858571 + pristine_git_object: 6253ef1cdfe532794e22f01475ef0d3f8c4b2f58 docs/sdks/privateendpoints/README.mdx: id: 54dee70b8cc7 last_write_checksum: sha1:bbcf4de4e5a73ebef78861dc2721a4e1ca965d2e @@ -12572,8 +12636,8 @@ trackedFiles: pristine_git_object: bcbe30fccceb97caa3a0e170038245dcc7f1e540 docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:4193af781eec14688c999d2d2328ab4b9064270a - pristine_git_object: 35394e656c4a66fcd643ee3c5a307571ca8d1c6a + last_write_checksum: sha1:f2252822abd85d585c44ff05bb768bfbeb8b64a4 + pristine_git_object: dcd1338038d52e7d49f309a67d02ead65c64c5d3 docs/sdks/vault/README.mdx: id: 3738c6722acd last_write_checksum: sha1:290b439ff730b9eabf4a6ef93737d1c61006b0fa @@ -12592,8 +12656,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:45b9c92ef94777a91063e910c9cd243e2dafdc41 - pristine_git_object: 4f38b8941490be7a688dd55ba498ca70c54942f8 + last_write_checksum: sha1:cbda1a63debfd6b18986ab731046184f24d6aeee + pristine_git_object: 5b190307c9e3ceaa6494cd57486013136ad207b7 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -12620,8 +12684,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:2adef3a3d650823f06638456d52317f0342cf735 - pristine_git_object: bea916fd64f9c5b4111114295739e434659357ab + last_write_checksum: sha1:20ad8201ea701bf76991447f9ee1adcf2e55d9be + pristine_git_object: 3e10020211fd4f18910da7acd0aaf3da351dd651 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -12668,8 +12732,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:ac349924212648f74fc5a503e8c8339876ba9e8b - pristine_git_object: 1ed0a646dab56572c7c3f300426c1d31122797bd + last_write_checksum: sha1:d0e4ce3143411726d62385d5d2234a9246de7c50 + pristine_git_object: bbdce2c6c9e16f85cd1f886970294a54fcf54e2a src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:08125e1d60df82793e11e8aed6e3c9fdb7512ebb @@ -13010,6 +13074,10 @@ trackedFiles: id: 9662137c5446 last_write_checksum: sha1:e82188bb7d0496e4c8b5861056e7c98e5c0d6a15 pristine_git_object: 92cd8415275b96ee89d41d5bebf5c0bc8b9ece90 + src/openrouter/components/anthropicsafeguardresult.py: + id: 691dd1e60673 + last_write_checksum: sha1:5c4e654780a0e9e3d91b1efb8e8ab5d2fb2fafc8 + pristine_git_object: 09c850d72977846b637ae43cc711c214be37423d src/openrouter/components/anthropicsearchresultblockparam.py: id: bccb7c6b3128 last_write_checksum: sha1:8d073fef507a39b53421384ff9a5914fd9438493 @@ -13018,14 +13086,6 @@ trackedFiles: id: 0c3e66bb361a last_write_checksum: sha1:4b1680892e5121cf6103d6e0a3a78b8f060adae5 pristine_git_object: 7eef1af2f06067165e8ec718e37cb32d9b8b31e4 - src/openrouter/components/anthropicservertoolusage.py: - id: 771a4b516d55 - last_write_checksum: sha1:a5408cc7c88f61be521b6485dcfb52135923623c - pristine_git_object: a49ba8b6bebfc236b31df995066b5ab10de0026f - src/openrouter/components/anthropicservicetier.py: - id: 4bbed66f0d16 - last_write_checksum: sha1:2be2c14ef06afc516c87aff18faef80480603194 - pristine_git_object: 12117ebb569e2bb56d2604cf1aac92aefd03ae50 src/openrouter/components/anthropicspeed.py: id: 7e39c29f3d89 last_write_checksum: sha1:19e37bf7ec082d89258f44674405811cc8a010ad @@ -13330,10 +13390,14 @@ trackedFiles: id: f596a7395b9a last_write_checksum: sha1:2177ce2bc8df7d8acab39136274291927556b39b pristine_git_object: 4791493c1ca478484b7e16a95344debb37c0253d + src/openrouter/components/batchimagegenerationmissingimage.py: + id: f84d066a0134 + last_write_checksum: sha1:055ed846abb80cfb093898b4c57ef588c5616268 + pristine_git_object: c15b4edda9350e030b75586af1aacda6753915ed src/openrouter/components/batchimagegenerationresponse.py: id: 29fdb428112a - last_write_checksum: sha1:8334ac7d3e04e820bc56a8b9daaffd01b0193ca3 - pristine_git_object: 09c559ba3042b0e19706d0f3d2490bb94d1a0801 + last_write_checksum: sha1:9b03214825d02f3fcaac250e97b2ff348062fc46 + pristine_git_object: 9cf0a50f3cd1dbba8c9a17202b07f272aef9cb18 src/openrouter/components/batchinputreference.py: id: 95f4d52590ef last_write_checksum: sha1:f0a971cd8e47bab2190e7a5abe235f443b6faf0b @@ -13368,8 +13432,8 @@ trackedFiles: pristine_git_object: b2bbac635f94d6fe9f4eba2eded41b1990a9d5da src/openrouter/components/batchresult.py: id: 8a496db31329 - last_write_checksum: sha1:27b8a8d313a493a3dd7f8239bf06c592fe6db423 - pristine_git_object: c108a9cf7e0b9feef49fa30d7ca8fb8500b14f3d + last_write_checksum: sha1:446a1e8e0795e8b5cbb00086dc183b7798db6f98 + pristine_git_object: 710a655db75fcab22c45d49c1a5464ed7557a30c src/openrouter/components/batchresultspageresponse.py: id: 9a03420787ed last_write_checksum: sha1:580bf4a6ff3f1df739c880358abc0d6172b5fd9e @@ -14958,18 +15022,26 @@ trackedFiles: id: 53ba6717a4cc last_write_checksum: sha1:e1e75026fb625426f7cd1702cd3136dcf3ccaf79 pristine_git_object: 9026664fa77c678a7a5f2b317b511ad93445cff7 + src/openrouter/components/messagesmcptoolresultblock.py: + id: db985ca01041 + last_write_checksum: sha1:b96c197cd0ee87b67d408572f3ed2602a0561ea1 + pristine_git_object: 33103747952f39ed8506e79b15f13ce6829c894e + src/openrouter/components/messagesmcptooluseblock.py: + id: 29f2cbe76fc2 + last_write_checksum: sha1:ff1f0f4ee4959824a483d7f8bd8821ab13b7230e + pristine_git_object: c9e416348e8750a9d2666180ad1bffab40f498bd src/openrouter/components/messagesmessageparam.py: id: ed8bbab6720d - last_write_checksum: sha1:6023ca9469b2be39a6024d99e9135fc77946b563 - pristine_git_object: 9f2d198f61a6b2ef91bd912549cc22397f92212c + last_write_checksum: sha1:55462a44772bd7ed45a292c4568901a4157ae477 + pristine_git_object: 91cb880d5002f39284309798e59eb60df35b1fdd src/openrouter/components/messagesoutputconfig.py: id: 54d1e297f740 last_write_checksum: sha1:478d9f534254d60225ac89bd21ddc49d18329297 pristine_git_object: 7e69d1f775baece5f94b03d35bcd884d5e6f519d src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:545003d77b5db115985e8d39e6fdacf99ae2bc84 - pristine_git_object: e1cb9dc4a88f46e0c6c79523c6031507a28e2857 + last_write_checksum: sha1:c63a87578f54f39fc8898078926a924368342714 + pristine_git_object: b2bd751792d482665a3bf632c827362606c6cdba src/openrouter/components/messagessearchmodelsservertool.py: id: 53d755edb120 last_write_checksum: sha1:389786fc22ba4bb47b0a086b7aa321f2f04fe943 @@ -15350,6 +15422,10 @@ trackedFiles: id: 7cef7b95c04b last_write_checksum: sha1:e23d7a65a5d6ffad575a972e38ae908b5d5ba510 pristine_git_object: b6b1da176fb843e66e3ed5c1113b47583fccc966 + src/openrouter/components/oranthropicservertoolusage.py: + id: eddd75dceaab + last_write_checksum: sha1:194a647ef1c6ad82c0cc2f8118401a1427083785 + pristine_git_object: 4995dd9066a357465494651ea60cdce036939767 src/openrouter/components/oranthropicservertooluseblock.py: id: b9532f37df9c last_write_checksum: sha1:011d07a562b9de16788abfd4eb3860e43c4e17be @@ -16140,12 +16216,12 @@ trackedFiles: pristine_git_object: cc45b6da88350cd9ab4b9c6456b5dd81c0b4c8e9 src/openrouter/components/speechinputmodality.py: id: d475c5a1288b - last_write_checksum: sha1:698931d0b3f90b08c91413c5e89dd634e7f1f4a1 - pristine_git_object: 8046ca68a1b8184e0f9c6b8634cf313e0199ad8d + last_write_checksum: sha1:53410a032e6e412c23abe7f5d1be61e8470625cb + pristine_git_object: 2b8402c3566dc9826fa0dcd17af4d23625db3162 src/openrouter/components/speechinputreference.py: id: 8e2b63f83354 - last_write_checksum: sha1:b2ebc68fae64644f8bfca9b555ca7d2a7b46c9e1 - pristine_git_object: 0881593ad73af3e97f5d3a6a2aeb6cfe5ffe687e + last_write_checksum: sha1:ca75ac4bf88336c0a6c00d0d9fce34fd4b34af87 + pristine_git_object: 059612864f802d8230816e8c713285cb92f9b6bf src/openrouter/components/speechinputreferenceaudio.py: id: 72d940d3f6a2 last_write_checksum: sha1:efd262edae0cb4b4b5052680ffc798f6fd5833d8 @@ -16166,6 +16242,14 @@ trackedFiles: id: d9cd9e42ac40 last_write_checksum: sha1:3acdadbccb53ffe81cf7221c5f13ef031436adb7 pristine_git_object: 4633e5d7658c500aa903ce8caa8ef86cc97b78eb + src/openrouter/components/speechinputreferencevideo.py: + id: 8f9dad33c87b + last_write_checksum: sha1:ae5090d88f4a0f7af4c1abdd1b350fb85a92e233 + pristine_git_object: 5f045bb6f885f7041c2baa5dbd4a26d0f45002c3 + src/openrouter/components/speechinputreferencevideoinput.py: + id: 1bb987c0328e + last_write_checksum: sha1:07bcdcf0170efc4b3f3b1968df04456e7d7256df + pristine_git_object: d018d8321a2940391a21a958caf4f5f7da3db41a src/openrouter/components/speechmodelendpoint.py: id: cdf152283ac0 last_write_checksum: sha1:5d1962f7fb2afc314002734dd3fbb7bcc2307fe7 @@ -16192,8 +16276,8 @@ trackedFiles: pristine_git_object: 69c0355e7d575e6b7c52183d3cd5696611e4e8bf src/openrouter/components/speechrequest.py: id: 2a9400167112 - last_write_checksum: sha1:0239848690cabcee8600c4f35acd3da2f0aa3dae - pristine_git_object: ca55f7a057606a4ed8aa84eb9ca91852fc9a1156 + last_write_checksum: sha1:061ab23a6ac8233a6cb0031fceafd28862c04b3f + pristine_git_object: 5246bf6da0a5906a4a88bcdeab7c220aaa89e884 src/openrouter/components/speechsupportedparameters.py: id: 618f33cc9229 last_write_checksum: sha1:6f3fe1b11d56407227306a93fb6d232066158913 @@ -17708,8 +17792,8 @@ trackedFiles: pristine_git_object: 228602282f43dd94fb7703bb47b45a570c1aa8d2 src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:8004285306daf7d986bcaeb9fa1037de509d6091 - pristine_git_object: 936058d4adcb7ce049c186bd93a938d7891e1b33 + last_write_checksum: sha1:c3584e18637f3de3c97d6e41efdb95bb12030e6f + pristine_git_object: 23788b8ac491be96d499f9592464b38bc2bbf525 src/openrouter/private_endpoints.py: id: fdbce8846ed0 last_write_checksum: sha1:0ad55d4b0bef25a353596e08c70b8e4127f31be2 @@ -17760,8 +17844,8 @@ trackedFiles: pristine_git_object: 701fa8597ff85f41a60736ade55fcb32f9ec7125 src/openrouter/tts.py: id: 5055d4b95f1d - last_write_checksum: sha1:28bc4742c2525631d1faceed945bd9a84e44be0a - pristine_git_object: 5474834977880d605b7f9d408d9558059fadafb1 + last_write_checksum: sha1:a199e7b11cda1346acf9809160644c4ec80ab463 + pristine_git_object: 8ab79410ac82a6547979d53b6005a83852fa3f13 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -23311,3 +23395,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.batch.create_batches()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.batch.get_batches()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.batch.cancel()`: `response.results[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.batch.get_results()`: `response.data[].response.body` **Changed** (Breaking ⚠️)\n* `open_router.tts.create_speech()`: \n * `request.input_references[].union(video_url)` **Added**\n* `open_router.tts.list_models()`: `response.data[].endpoints[].input_modalities[].union(video)` **Added**\n* `open_router.tts.get_model()`: `response.endpoints[].input_modalities[].union(video)` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.messages[].content.union(Array<>)[]` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 13d050546..951b437cd 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.239 + version: 1.3.240 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 4abe7950a..9ff044ee0 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -5409,6 +5409,21 @@ components: required: - 'url' type: 'object' + BatchImageGenerationMissingImage: + description: 'An image the provider returned that OpenRouter could not store. It is not billed.' + properties: + index: + description: 'Position of the image among the images returned for this request, from 0' + example: 1 + type: 'integer' + message: + description: 'Why the image is missing' + example: 'The provider returned this image without readable image data.' + type: 'string' + required: + - 'index' + - 'message' + type: 'object' BatchImageGenerationResponse: description: 'Image generation result of a batch request: image links and when they expire' properties: @@ -5428,6 +5443,11 @@ components: description: 'Generation ID of this request. Look up its cost and details with `GET /api/v1/generation?id=`.' example: 'gen-batch-1748372400-3f1c9b2e7a5d4c8e0b61' type: 'string' + missing_images: + description: 'Images the provider returned without usable image data. Present only when some images of the request are missing; `data` lists the rest.' + items: + $ref: '#/components/schemas/BatchImageGenerationMissingImage' + type: 'array' usage: $ref: '#/components/schemas/ImageGenerationUsage' required: @@ -6568,6 +6588,23 @@ components: items: $ref: '#/components/schemas/ORAnthropicContentBlock' type: 'array' + context_management: + properties: + applied_edits: + items: + additionalProperties: {} + properties: + type: + type: 'string' + required: + - 'type' + type: 'object' + type: 'array' + required: + - 'applied_edits' + type: + - 'object' + - 'null' id: type: 'string' input_transformations: @@ -6578,10 +6615,20 @@ components: - 'null' model: type: 'string' + openrouter_metadata: + $ref: '#/components/schemas/OpenRouterMetadata' + provider: + type: 'string' role: enum: - 'assistant' type: 'string' + safeguard_results: + items: + $ref: '#/components/schemas/AnthropicSafeguardResult' + type: + - 'array' + - 'null' stop_details: $ref: '#/components/schemas/AnthropicRefusalStopDetails' stop_reason: @@ -6595,26 +6642,81 @@ components: - 'message' type: 'string' usage: - allOf: - - $ref: '#/components/schemas/AnthropicUsage' - - properties: - iterations: - items: - $ref: '#/components/schemas/AnthropicUsageIteration' - type: 'array' - speed: - $ref: '#/components/schemas/AnthropicSpeed' + properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' + cache_creation_input_tokens: + type: + - 'integer' + - 'null' + cache_read_input_tokens: + type: + - 'integer' + - 'null' + cost: + format: 'double' + type: + - 'number' + - 'null' + cost_details: + $ref: '#/components/schemas/CostDetails' + deferred_tools_details: + properties: + completion_tokens: + description: 'Completion tokens summed over every upstream call' + type: 'integer' + prompt_tokens: + description: 'Prompt tokens summed over every upstream call' + type: 'integer' + total_tokens: + description: 'Sum of the above two fields' + type: 'integer' + turns: + description: 'Upstream model calls the run made' + exclusiveMinimum: true + minimum: 0 + type: 'integer' + required: + - 'turns' + - 'prompt_tokens' + - 'completion_tokens' + - 'total_tokens' type: 'object' - example: - cache_creation: null - cache_creation_input_tokens: null - cache_read_input_tokens: null - inference_geo: null - input_tokens: 100 - output_tokens: 50 - output_tokens_details: null - server_tool_use: null - service_tier: 'standard' + inference_geo: + type: + - 'string' + - 'null' + input_tokens: + type: 'integer' + is_byok: + type: 'boolean' + iterations: + items: + $ref: '#/components/schemas/AnthropicUsageIteration' + type: 'array' + output_tokens: + type: 'integer' + output_tokens_details: + $ref: '#/components/schemas/AnthropicOutputTokensDetails' + server_tool_use: + $ref: '#/components/schemas/ORAnthropicServerToolUsage' + service_tier: + type: + - 'string' + - 'null' + speed: + $ref: '#/components/schemas/AnthropicSpeed' + required: + - 'input_tokens' + - 'output_tokens' + - 'output_tokens_details' + - 'cache_creation_input_tokens' + - 'cache_read_input_tokens' + - 'cache_creation' + - 'inference_geo' + - 'server_tool_use' + - 'service_tier' + type: 'object' required: - 'id' - 'type' @@ -21243,6 +21345,63 @@ components: required: - 'model' type: 'object' + MessagesMcpToolResultBlock: + description: 'MCP tool result block paired with a prior `mcp_tool_use` block for replay.' + example: + content: 'Sunny, 21C' + is_error: false + tool_use_id: 'mcptoolu_01abc' + type: 'mcp_tool_result' + properties: + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + content: + anyOf: + - type: 'string' + - items: + $ref: '#/components/schemas/AnthropicTextBlockParam' + type: 'array' + is_error: + type: 'boolean' + tool_use_id: + type: 'string' + type: + enum: + - 'mcp_tool_result' + type: 'string' + required: + - 'type' + - 'tool_use_id' + type: 'object' + MessagesMcpToolUseBlock: + description: 'MCP tool call emitted by an upstream Anthropic assistant turn for replay.' + example: + id: 'mcptoolu_01abc' + input: + city: 'Paris' + name: 'get_forecast' + server_name: 'weather' + type: 'mcp_tool_use' + properties: + cache_control: + $ref: '#/components/schemas/AnthropicCacheControlDirective' + id: + type: 'string' + input: {} + name: + type: 'string' + server_name: + type: 'string' + type: + enum: + - 'mcp_tool_use' + type: 'string' + required: + - 'type' + - 'id' + - 'name' + - 'server_name' + type: 'object' MessagesMessageParam: description: 'Anthropic message with OpenRouter extensions' example: @@ -21419,6 +21578,8 @@ components: - $ref: '#/components/schemas/MessagesBashToolResultBlock' - $ref: '#/components/schemas/ORAnthropicToolSearchResultParam' - $ref: '#/components/schemas/MessagesToolSearchToolResultBlock' + - $ref: '#/components/schemas/MessagesMcpToolUseBlock' + - $ref: '#/components/schemas/MessagesMcpToolResultBlock' type: 'array' output_config: $ref: '#/components/schemas/AnthropicMessageOutputConfig' @@ -36370,7 +36531,7 @@ components: description: 'Text to synthesize, or a list of turns for multi-speaker input. Each turn has its own text, voice, and instructions. Multi-speaker input is supported by Gemini TTS models, by Fish Audio models other than S1, and by Speechify dialogue models.' example: 'Hello world' SpeechInputModality: - description: 'An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design.' + description: 'An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design; `video` is a reference video the generated audio is made for.' example: type: 'text' oneOf: @@ -36430,6 +36591,23 @@ components: - 'type' - 'supported_inputs' type: 'object' + - properties: + supported_inputs: + description: '`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint''s video rate.' + properties: + references: + $ref: '#/components/schemas/SpeechReferenceCount' + required: + - 'references' + type: 'object' + type: + enum: + - 'video' + type: 'string' + required: + - 'type' + - 'supported_inputs' + type: 'object' SpeechInputReference: description: 'Reference content part for stateless voice cloning or voice design' discriminator: @@ -36437,6 +36615,7 @@ components: image_url: '#/components/schemas/SpeechInputReferenceImage' input_audio: '#/components/schemas/SpeechInputReferenceAudio' text: '#/components/schemas/SpeechInputReferenceText' + video_url: '#/components/schemas/SpeechInputReferenceVideo' propertyName: 'type' example: input_audio: @@ -36446,6 +36625,7 @@ components: - $ref: '#/components/schemas/SpeechInputReferenceAudio' - $ref: '#/components/schemas/SpeechInputReferenceText' - $ref: '#/components/schemas/SpeechInputReferenceImage' + - $ref: '#/components/schemas/SpeechInputReferenceVideo' SpeechInputReferenceAudio: description: 'Reference audio input for stateless voice cloning. Up to three parts per request; the Nth audio part is addressable from `input` as `@AudioN` on providers that support multiple references.' example: @@ -36535,6 +36715,37 @@ components: - 'type' - 'text' type: 'object' + SpeechInputReferenceVideo: + description: 'Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate.' + example: + type: 'video_url' + video_url: + url: 'https://example.com/clip.mp4' + properties: + type: + enum: + - 'video_url' + type: 'string' + video_url: + $ref: '#/components/schemas/SpeechInputReferenceVideoInput' + required: + - 'type' + - 'video_url' + type: 'object' + SpeechInputReferenceVideoInput: + description: 'Reference video input object' + example: + url: 'https://example.com/clip.mp4' + properties: + url: + description: 'Public http(s) URL of the reference video. The provider downloads it; OpenRouter does not fetch it, and data URIs are rejected.' + example: 'https://example.com/clip.mp4' + maxLength: 2048 + minLength: 1 + type: 'string' + required: + - 'url' + type: 'object' SpeechModelEndpoint: description: 'One endpoint serving a speech model, with the inputs and parameters it accepts.' example: @@ -36813,7 +37024,7 @@ components: input: $ref: '#/components/schemas/SpeechInput' input_references: - description: 'Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. An empty array is treated as no reference.' + description: 'Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference.' example: - input_audio: data: 'data:audio/wav;base64,UklGRuQXDABXQVZF...' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index fb494bacc..13c811da6 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b449397bef66a2911564d32127ebfede6410da7f267d64d8ed2a7d1feccab8ee - sourceBlobDigest: sha256:8c442f998f818acea292dc01714f5505c983225285d5a70079dd3d6159383c87 + sourceRevisionDigest: sha256:502093455748746ced1b5a75d7f2679fb7a63d58a0d640187714f81a76ea8d8c + sourceBlobDigest: sha256:64142d11f18120cbc817c7e3922fecb9f547447c2672f6e52b05e959912382ae tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b449397bef66a2911564d32127ebfede6410da7f267d64d8ed2a7d1feccab8ee - sourceBlobDigest: sha256:8c442f998f818acea292dc01714f5505c983225285d5a70079dd3d6159383c87 + sourceRevisionDigest: sha256:502093455748746ced1b5a75d7f2679fb7a63d58a0d640187714f81a76ea8d8c + sourceBlobDigest: sha256:64142d11f18120cbc817c7e3922fecb9f547447c2672f6e52b05e959912382ae codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:e37dcb5a8fc4cd7a863a8da8ec0b4bd2c033ec6ac95bd2042535448b313932f4 + codeSamplesRevisionDigest: sha256:655ccaabfdf517078bc953cd3ac42038a7f8f90834a8e754dd664bc89ecc7059 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 671ef70b5..50306e5e5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -5159,4 +5159,14 @@ Based on: ### Generated - [python v1.3.239] . ### Releases -- [PyPI v1.3.239] https://pypi.org/project/openrouter/1.3.239 - . \ No newline at end of file +- [PyPI v1.3.239] https://pypi.org/project/openrouter/1.3.239 - . + +## 2026-12-03 21:24:19 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.240] . +### Releases +- [PyPI v1.3.240] https://pypi.org/project/openrouter/1.3.240 - . \ No newline at end of file diff --git a/docs/components/anthropicsafeguardresult.mdx b/docs/components/anthropicsafeguardresult.mdx new file mode 100644 index 000000000..0b1e25ad6 --- /dev/null +++ b/docs/components/anthropicsafeguardresult.mdx @@ -0,0 +1,14 @@ +--- +title: "AnthropicSafeguardResult" +--- + +The outcome of a server-side safeguard, keyed by tool-use id where applicable + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `status` | [components.AnthropicSafeguardResultStatus](../components/anthropicsafeguardresultstatus.mdx) | ✔️ | N/A | | +| `type` | *str* | ✔️ | N/A | | +| `__pydantic_extra__` | Dict[str, *Any*] | ➖ | N/A | \{
"status": \{
"tool_uses": \{
"toolu_01ABC": \{
"outcome": "not_flagged",
"type": "evaluated"
}
},
"type": "available"
},
"type": "dangerous_tool_use"
} | \ No newline at end of file diff --git a/docs/components/anthropicsafeguardresultstatus.mdx b/docs/components/anthropicsafeguardresultstatus.mdx new file mode 100644 index 000000000..aadccae40 --- /dev/null +++ b/docs/components/anthropicsafeguardresultstatus.mdx @@ -0,0 +1,10 @@ +--- +title: "AnthropicSafeguardResultStatus" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `type` | *str* | ✔️ | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/anthropicservertoolusage.mdx b/docs/components/anthropicservertoolusage.mdx deleted file mode 100644 index b5c15b64c..000000000 --- a/docs/components/anthropicservertoolusage.mdx +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "AnthropicServerToolUsage" ---- - -## Fields - -| Field | Type | Required | Description | -| --------------------- | --------------------- | --------------------- | --------------------- | -| `web_fetch_requests` | *int* | ✔️ | N/A | -| `web_search_requests` | *int* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/anthropicservicetier.mdx b/docs/components/anthropicservicetier.mdx deleted file mode 100644 index 7cf6ee646..000000000 --- a/docs/components/anthropicservicetier.mdx +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "AnthropicServiceTier" ---- - -## Example Usage - -```python -from openrouter.components import AnthropicServiceTier - -# Open enum: unrecognized values are captured as UnrecognizedStr -value: AnthropicServiceTier = "standard" -``` - - -## Values - -This is an open enum. Unrecognized values will not fail type checks. - -- `"standard"` -- `"priority"` -- `"batch"` diff --git a/docs/components/appliededit.mdx b/docs/components/appliededit.mdx new file mode 100644 index 000000000..1589a9f95 --- /dev/null +++ b/docs/components/appliededit.mdx @@ -0,0 +1,10 @@ +--- +title: "AppliedEdit" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `type` | *str* | ✔️ | N/A | +| `__pydantic_extra__` | Dict[str, *Any*] | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/batchimagegenerationmissingimage.mdx b/docs/components/batchimagegenerationmissingimage.mdx new file mode 100644 index 000000000..7f40f810b --- /dev/null +++ b/docs/components/batchimagegenerationmissingimage.mdx @@ -0,0 +1,13 @@ +--- +title: "BatchImageGenerationMissingImage" +--- + +An image the provider returned that OpenRouter could not store. It is not billed. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `index` | *int* | ✔️ | Position of the image among the images returned for this request, from 0 | 1 | +| `message` | *str* | ✔️ | Why the image is missing | The provider returned this image without readable image data. | \ No newline at end of file diff --git a/docs/components/batchimagegenerationresponse.mdx b/docs/components/batchimagegenerationresponse.mdx index d3e3896ea..e53e5d91c 100644 --- a/docs/components/batchimagegenerationresponse.mdx +++ b/docs/components/batchimagegenerationresponse.mdx @@ -7,10 +7,11 @@ Image generation result of a batch request: image links and when they expire ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `created` | *int* | ✔️ | Unix timestamp (seconds) when the image was generated | 1748372400 | -| `data` | List[[components.BatchImageGenerationImage](../components/batchimagegenerationimage.mdx)] | ✔️ | N/A | | -| `expires_at` | *int* | ✔️ | Unix timestamp (seconds) when the image URLs in `data` stop working. Download the images before then. | 1748458800 | -| `id` | *Optional[str]* | ➖ | Generation ID of this request. Look up its cost and details with `GET /api/v1/generation?id=`. | gen-batch-1748372400-3f1c9b2e7a5d4c8e0b61 | -| `usage` | [Optional[components.ImageGenerationUsage]](../components/imagegenerationusage.mdx) | ➖ | Token and cost usage for the image generation request, when available | \{
"completion_tokens": 4175,
"cost": 0.04,
"prompt_tokens": 0,
"total_tokens": 4175
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `created` | *int* | ✔️ | Unix timestamp (seconds) when the image was generated | 1748372400 | +| `data` | List[[components.BatchImageGenerationImage](../components/batchimagegenerationimage.mdx)] | ✔️ | N/A | | +| `expires_at` | *int* | ✔️ | Unix timestamp (seconds) when the image URLs in `data` stop working. Download the images before then. | 1748458800 | +| `id` | *Optional[str]* | ➖ | Generation ID of this request. Look up its cost and details with `GET /api/v1/generation?id=`. | gen-batch-1748372400-3f1c9b2e7a5d4c8e0b61 | +| `missing_images` | List[[components.BatchImageGenerationMissingImage](../components/batchimagegenerationmissingimage.mdx)] | ➖ | Images the provider returned without usable image data. Present only when some images of the request are missing; `data` lists the rest. | | +| `usage` | [Optional[components.ImageGenerationUsage]](../components/imagegenerationusage.mdx) | ➖ | Token and cost usage for the image generation request, when available | \{
"completion_tokens": 4175,
"cost": 0.04,
"prompt_tokens": 0,
"total_tokens": 4175
} | \ No newline at end of file diff --git a/docs/components/batchresultcontextmanagement.mdx b/docs/components/batchresultcontextmanagement.mdx new file mode 100644 index 000000000..7cdf436d1 --- /dev/null +++ b/docs/components/batchresultcontextmanagement.mdx @@ -0,0 +1,9 @@ +--- +title: "BatchResultContextManagement" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `applied_edits` | List[[components.AppliedEdit](../components/appliededit.mdx)] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/batchresultdeferredtoolsdetails.mdx b/docs/components/batchresultdeferredtoolsdetails.mdx new file mode 100644 index 000000000..273012cd3 --- /dev/null +++ b/docs/components/batchresultdeferredtoolsdetails.mdx @@ -0,0 +1,12 @@ +--- +title: "BatchResultDeferredToolsDetails" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| `completion_tokens` | *int* | ✔️ | Completion tokens summed over every upstream call | +| `prompt_tokens` | *int* | ✔️ | Prompt tokens summed over every upstream call | +| `total_tokens` | *int* | ✔️ | Sum of the above two fields | +| `turns` | *int* | ✔️ | Upstream model calls the run made | \ No newline at end of file diff --git a/docs/components/batchresultusage2.mdx b/docs/components/batchresultusage2.mdx index 4057d2aba..dae935877 100644 --- a/docs/components/batchresultusage2.mdx +++ b/docs/components/batchresultusage2.mdx @@ -4,16 +4,20 @@ title: "BatchResultUsage2" ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `cache_creation` | [Nullable[components.AnthropicCacheCreation]](../components/anthropiccachecreation.mdx) | ✔️ | N/A | \{
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 100
} | -| `cache_creation_input_tokens` | *Nullable[int]* | ✔️ | N/A | | -| `cache_read_input_tokens` | *Nullable[int]* | ✔️ | N/A | | -| `inference_geo` | *Nullable[str]* | ✔️ | N/A | | -| `input_tokens` | *int* | ✔️ | N/A | | -| `output_tokens` | *int* | ✔️ | N/A | | -| `output_tokens_details` | [Nullable[components.AnthropicOutputTokensDetails]](../components/anthropicoutputtokensdetails.mdx) | ✔️ | N/A | \{
"thinking_tokens": 0
} | -| `server_tool_use` | [Nullable[components.AnthropicServerToolUsage]](../components/anthropicservertoolusage.mdx) | ✔️ | N/A | \{
"web_fetch_requests": 0,
"web_search_requests": 1
} | -| `service_tier` | [Nullable[components.AnthropicServiceTier]](../components/anthropicservicetier.mdx) | ✔️ | N/A | standard | -| `iterations` | List[[components.AnthropicUsageIteration](../components/anthropicusageiteration.mdx)] | ➖ | N/A | | -| `speed` | [OptionalNullable[components.AnthropicSpeed]](../components/anthropicspeed.mdx) | ➖ | N/A | standard | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `cache_creation` | [Nullable[components.AnthropicCacheCreation]](../components/anthropiccachecreation.mdx) | ✔️ | N/A | \{
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 100
} | +| `cache_creation_input_tokens` | *Nullable[int]* | ✔️ | N/A | | +| `cache_read_input_tokens` | *Nullable[int]* | ✔️ | N/A | | +| `cost` | *OptionalNullable[float]* | ➖ | N/A | | +| `cost_details` | [OptionalNullable[components.CostDetails]](../components/costdetails.mdx) | ➖ | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} | +| `deferred_tools_details` | [Optional[components.BatchResultDeferredToolsDetails]](../components/batchresultdeferredtoolsdetails.mdx) | ➖ | N/A | | +| `inference_geo` | *Nullable[str]* | ✔️ | N/A | | +| `input_tokens` | *int* | ✔️ | N/A | | +| `is_byok` | *Optional[bool]* | ➖ | N/A | | +| `iterations` | List[[components.AnthropicUsageIteration](../components/anthropicusageiteration.mdx)] | ➖ | N/A | | +| `output_tokens` | *int* | ✔️ | N/A | | +| `output_tokens_details` | [Nullable[components.AnthropicOutputTokensDetails]](../components/anthropicoutputtokensdetails.mdx) | ✔️ | N/A | \{
"thinking_tokens": 0
} | +| `server_tool_use` | [Nullable[components.ORAnthropicServerToolUsage]](../components/oranthropicservertoolusage.mdx) | ✔️ | N/A | \{
"tool_calls_executed": 1,
"tool_calls_requested": 1,
"web_fetch_requests": 0,
"web_search_requests": 0
} | +| `service_tier` | *Nullable[str]* | ✔️ | N/A | | +| `speed` | [OptionalNullable[components.AnthropicSpeed]](../components/anthropicspeed.mdx) | ➖ | N/A | standard | \ No newline at end of file diff --git a/docs/components/bodymessage.mdx b/docs/components/bodymessage.mdx index 5b8a2b547..536e3bd4f 100644 --- a/docs/components/bodymessage.mdx +++ b/docs/components/bodymessage.mdx @@ -4,16 +4,20 @@ title: "BodyMessage" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `container` | [Nullable[components.AnthropicContainer]](../components/anthropiccontainer.mdx) | ✔️ | N/A | \{
"expires_at": "2026-04-08T00:00:00Z",
"id": "ctr_01abc",
"skills": null
} | -| `content` | List[[components.ORAnthropicContentBlock](../components/oranthropiccontentblock.mdx)] | ✔️ | N/A | | -| `id` | *str* | ✔️ | N/A | | -| `input_transformations` | List[[components.AnthropicInputTransformation](../components/anthropicinputtransformation.mdx)] | ➖ | N/A | | -| `model` | *str* | ✔️ | N/A | | -| `role` | [components.BatchResultRole](../components/batchresultrole.mdx) | ✔️ | N/A | | -| `stop_details` | [Nullable[components.AnthropicRefusalStopDetails]](../components/anthropicrefusalstopdetails.mdx) | ✔️ | Structured information about a refusal | \{
"category": "cyber",
"explanation": "The request was refused due to policy.",
"type": "refusal"
} | -| `stop_reason` | [Nullable[components.ORAnthropicStopReason]](../components/oranthropicstopreason.mdx) | ✔️ | N/A | end_turn | -| `stop_sequence` | *Nullable[str]* | ✔️ | N/A | | -| `type` | [components.BatchResultTypeMessage](../components/batchresulttypemessage.mdx) | ✔️ | N/A | | -| `usage` | [components.BatchResultUsage2](../components/batchresultusage2.mdx) | ✔️ | N/A | \{
"cache_creation": null,
"cache_creation_input_tokens": null,
"cache_read_input_tokens": null,
"inference_geo": null,
"input_tokens": 100,
"output_tokens": 50,
"output_tokens_details": null,
"server_tool_use": null,
"service_tier": "standard"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `container` | [Nullable[components.AnthropicContainer]](../components/anthropiccontainer.mdx) | ✔️ | N/A | \{
"expires_at": "2026-04-08T00:00:00Z",
"id": "ctr_01abc",
"skills": null
} | +| `content` | List[[components.ORAnthropicContentBlock](../components/oranthropiccontentblock.mdx)] | ✔️ | N/A | | +| `context_management` | [OptionalNullable[components.BatchResultContextManagement]](../components/batchresultcontextmanagement.mdx) | ➖ | N/A | | +| `id` | *str* | ✔️ | N/A | | +| `input_transformations` | List[[components.AnthropicInputTransformation](../components/anthropicinputtransformation.mdx)] | ➖ | N/A | | +| `model` | *str* | ✔️ | N/A | | +| `openrouter_metadata` | [Optional[components.OpenRouterMetadata]](../components/openroutermetadata.mdx) | ➖ | N/A | \{
"attempt": 1,
"endpoints": \{
"available": [
\{
"model": "openai/gpt-4o",
"provider": "OpenAI",
"selected": true
}
],
"total": 1
},
"generation_time": 2016,
"is_byok": false,
"region": "iad",
"requested": "openai/gpt-4o",
"strategy": "direct",
"summary": "available=1, selected=OpenAI"
} | +| `provider` | *Optional[str]* | ➖ | N/A | | +| `role` | [components.BatchResultRole](../components/batchresultrole.mdx) | ✔️ | N/A | | +| `safeguard_results` | List[[components.AnthropicSafeguardResult](../components/anthropicsafeguardresult.mdx)] | ➖ | N/A | | +| `stop_details` | [Nullable[components.AnthropicRefusalStopDetails]](../components/anthropicrefusalstopdetails.mdx) | ✔️ | Structured information about a refusal | \{
"category": "cyber",
"explanation": "The request was refused due to policy.",
"type": "refusal"
} | +| `stop_reason` | [Nullable[components.ORAnthropicStopReason]](../components/oranthropicstopreason.mdx) | ✔️ | N/A | end_turn | +| `stop_sequence` | *Nullable[str]* | ✔️ | N/A | | +| `type` | [components.BatchResultTypeMessage](../components/batchresulttypemessage.mdx) | ✔️ | N/A | | +| `usage` | [components.BatchResultUsage2](../components/batchresultusage2.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/messagesmcptoolresultblock.mdx b/docs/components/messagesmcptoolresultblock.mdx new file mode 100644 index 000000000..91f68222a --- /dev/null +++ b/docs/components/messagesmcptoolresultblock.mdx @@ -0,0 +1,16 @@ +--- +title: "MessagesMcpToolResultBlock" +--- + +MCP tool result block paired with a prior `mcp_tool_use` block for replay. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `content` | [Optional[components.MessagesMcpToolResultBlockContent]](../components/messagesmcptoolresultblockcontent.mdx) | ➖ | N/A | | +| `is_error` | *Optional[bool]* | ➖ | N/A | | +| `tool_use_id` | *str* | ✔️ | N/A | | +| `type` | [components.MessagesMcpToolResultBlockType](../components/messagesmcptoolresultblocktype.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/messagesmcptoolresultblockcontent.mdx b/docs/components/messagesmcptoolresultblockcontent.mdx new file mode 100644 index 000000000..d28e7a49a --- /dev/null +++ b/docs/components/messagesmcptoolresultblockcontent.mdx @@ -0,0 +1,18 @@ +--- +title: "MessagesMcpToolResultBlockContent" +--- + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[components.AnthropicTextBlockParam]` + +```python +value: List[components.AnthropicTextBlockParam] = /* values here */ +``` + diff --git a/docs/components/messagesmcptoolresultblocktype.mdx b/docs/components/messagesmcptoolresultblocktype.mdx new file mode 100644 index 000000000..4fbb74e39 --- /dev/null +++ b/docs/components/messagesmcptoolresultblocktype.mdx @@ -0,0 +1,15 @@ +--- +title: "MessagesMcpToolResultBlockType" +--- + +## Example Usage + +```python +from openrouter.components import MessagesMcpToolResultBlockType +value: MessagesMcpToolResultBlockType = "mcp_tool_result" +``` + + +## Values + +- `"mcp_tool_result"` diff --git a/docs/components/messagesmcptooluseblock.mdx b/docs/components/messagesmcptooluseblock.mdx new file mode 100644 index 000000000..ced687980 --- /dev/null +++ b/docs/components/messagesmcptooluseblock.mdx @@ -0,0 +1,17 @@ +--- +title: "MessagesMcpToolUseBlock" +--- + +MCP tool call emitted by an upstream Anthropic assistant turn for replay. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `id` | *str* | ✔️ | N/A | | +| `input` | *Optional[Any]* | ➖ | N/A | | +| `name` | *str* | ✔️ | N/A | | +| `server_name` | *str* | ✔️ | N/A | | +| `type` | [components.MessagesMcpToolUseBlockType](../components/messagesmcptooluseblocktype.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/messagesmcptooluseblocktype.mdx b/docs/components/messagesmcptooluseblocktype.mdx new file mode 100644 index 000000000..cb74678cb --- /dev/null +++ b/docs/components/messagesmcptooluseblocktype.mdx @@ -0,0 +1,15 @@ +--- +title: "MessagesMcpToolUseBlockType" +--- + +## Example Usage + +```python +from openrouter.components import MessagesMcpToolUseBlockType +value: MessagesMcpToolUseBlockType = "mcp_tool_use" +``` + + +## Values + +- `"mcp_tool_use"` diff --git a/docs/components/messagesmessageparamcontentunion4.mdx b/docs/components/messagesmessageparamcontentunion4.mdx index c4023c5e5..c10fe45f5 100644 --- a/docs/components/messagesmessageparamcontentunion4.mdx +++ b/docs/components/messagesmessageparamcontentunion4.mdx @@ -112,3 +112,15 @@ value: components.ORAnthropicToolSearchResultParam = /* values here */ value: components.MessagesToolSearchToolResultBlock = /* values here */ ``` +### `components.MessagesMcpToolUseBlock` + +```python +value: components.MessagesMcpToolUseBlock = /* values here */ +``` + +### `components.MessagesMcpToolResultBlock` + +```python +value: components.MessagesMcpToolResultBlock = /* values here */ +``` + diff --git a/docs/components/messagesrequest.mdx b/docs/components/messagesrequest.mdx index f5f01405b..70fb05bad 100644 --- a/docs/components/messagesrequest.mdx +++ b/docs/components/messagesrequest.mdx @@ -10,7 +10,7 @@ Request schema for Anthropic Messages API endpoint | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | -| `context_management` | [OptionalNullable[components.ContextManagement]](../components/contextmanagement.mdx) | ➖ | N/A | | +| `context_management` | [OptionalNullable[components.MessagesRequestContextManagement]](../components/messagesrequestcontextmanagement.mdx) | ➖ | N/A | | | `deferred_tools` | [Optional[components.DeferredToolsControl]](../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `fallbacks` | List[[components.MessagesFallbackParam](../components/messagesfallbackparam.mdx)] | ➖ | Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. | [
\{
"model": "claude-opus-4-8"
}
] | | `max_tokens` | *Optional[int]* | ➖ | N/A | | diff --git a/docs/components/contextmanagement.mdx b/docs/components/messagesrequestcontextmanagement.mdx similarity index 93% rename from docs/components/contextmanagement.mdx rename to docs/components/messagesrequestcontextmanagement.mdx index 650489879..7e16469aa 100644 --- a/docs/components/contextmanagement.mdx +++ b/docs/components/messagesrequestcontextmanagement.mdx @@ -1,5 +1,5 @@ --- -title: "ContextManagement" +title: "MessagesRequestContextManagement" --- ## Fields diff --git a/docs/components/oranthropicservertoolusage.mdx b/docs/components/oranthropicservertoolusage.mdx new file mode 100644 index 000000000..bdb75f5c7 --- /dev/null +++ b/docs/components/oranthropicservertoolusage.mdx @@ -0,0 +1,12 @@ +--- +title: "ORAnthropicServerToolUsage" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------- | ---------------------- | ---------------------- | ---------------------- | +| `tool_calls_executed` | *Optional[int]* | ➖ | N/A | +| `tool_calls_requested` | *Optional[int]* | ➖ | N/A | +| `web_fetch_requests` | *int* | ✔️ | N/A | +| `web_search_requests` | *int* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechinputmodality.mdx b/docs/components/speechinputmodality.mdx index 73d08f72f..00aa5bea8 100644 --- a/docs/components/speechinputmodality.mdx +++ b/docs/components/speechinputmodality.mdx @@ -2,7 +2,7 @@ title: "SpeechInputModality" --- -An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design. +An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design; `video` is a reference video the generated audio is made for. ## Supported Types @@ -25,3 +25,9 @@ value: components.SpeechInputModalityAudio = /* values here */ value: components.SpeechInputModalityImage = /* values here */ ``` +### `components.SpeechInputModalityVideo` + +```python +value: components.SpeechInputModalityVideo = /* values here */ +``` + diff --git a/docs/components/speechinputmodalitysupportedinputs3.mdx b/docs/components/speechinputmodalitysupportedinputs3.mdx new file mode 100644 index 000000000..60ae8dfdb --- /dev/null +++ b/docs/components/speechinputmodalitysupportedinputs3.mdx @@ -0,0 +1,12 @@ +--- +title: "SpeechInputModalitySupportedInputs3" +--- + +`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `references` | [components.SpeechReferenceCount](../components/speechreferencecount.mdx) | ✔️ | N/A | \{
"max": 1,
"min": 1,
"type": "integer"
} | \ No newline at end of file diff --git a/docs/components/speechinputmodalitytypevideo.mdx b/docs/components/speechinputmodalitytypevideo.mdx new file mode 100644 index 000000000..5c8b67ed2 --- /dev/null +++ b/docs/components/speechinputmodalitytypevideo.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechInputModalityTypeVideo" +--- + +## Example Usage + +```python +from openrouter.components import SpeechInputModalityTypeVideo +value: SpeechInputModalityTypeVideo = "video" +``` + + +## Values + +- `"video"` diff --git a/docs/components/speechinputmodalityvideo.mdx b/docs/components/speechinputmodalityvideo.mdx new file mode 100644 index 000000000..f2404cb05 --- /dev/null +++ b/docs/components/speechinputmodalityvideo.mdx @@ -0,0 +1,10 @@ +--- +title: "SpeechInputModalityVideo" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `supported_inputs` | [components.SpeechInputModalitySupportedInputs3](../components/speechinputmodalitysupportedinputs3.mdx) | ✔️ | `references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate. | +| `type` | [components.SpeechInputModalityTypeVideo](../components/speechinputmodalitytypevideo.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechinputreference.mdx b/docs/components/speechinputreference.mdx index 7303b4f78..bf1a026c2 100644 --- a/docs/components/speechinputreference.mdx +++ b/docs/components/speechinputreference.mdx @@ -25,3 +25,9 @@ value: components.SpeechInputReferenceAudio = /* values here */ value: components.SpeechInputReferenceText = /* values here */ ``` +### `components.SpeechInputReferenceVideo` + +```python +value: components.SpeechInputReferenceVideo = /* values here */ +``` + diff --git a/docs/components/speechinputreferencevideo.mdx b/docs/components/speechinputreferencevideo.mdx new file mode 100644 index 000000000..c1d68b1a4 --- /dev/null +++ b/docs/components/speechinputreferencevideo.mdx @@ -0,0 +1,13 @@ +--- +title: "SpeechInputReferenceVideo" +--- + +Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `type` | [components.SpeechInputReferenceVideoType](../components/speechinputreferencevideotype.mdx) | ✔️ | N/A | | +| `video_url` | [components.SpeechInputReferenceVideoInput](../components/speechinputreferencevideoinput.mdx) | ✔️ | Reference video input object | \{
"url": "https://example.com/clip.mp4"
} | \ No newline at end of file diff --git a/docs/components/speechinputreferencevideoinput.mdx b/docs/components/speechinputreferencevideoinput.mdx new file mode 100644 index 000000000..8f2b083dd --- /dev/null +++ b/docs/components/speechinputreferencevideoinput.mdx @@ -0,0 +1,12 @@ +--- +title: "SpeechInputReferenceVideoInput" +--- + +Reference video input object + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `url` | *str* | ✔️ | Public http(s) URL of the reference video. The provider downloads it; OpenRouter does not fetch it, and data URIs are rejected. | https://example.com/clip.mp4 | \ No newline at end of file diff --git a/docs/components/speechinputreferencevideotype.mdx b/docs/components/speechinputreferencevideotype.mdx new file mode 100644 index 000000000..217bb098c --- /dev/null +++ b/docs/components/speechinputreferencevideotype.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechInputReferenceVideoType" +--- + +## Example Usage + +```python +from openrouter.components import SpeechInputReferenceVideoType +value: SpeechInputReferenceVideoType = "video_url" +``` + + +## Values + +- `"video_url"` diff --git a/docs/components/speechrequest.mdx b/docs/components/speechrequest.mdx index 94c1dd82b..b790ed757 100644 --- a/docs/components/speechrequest.mdx +++ b/docs/components/speechrequest.mdx @@ -10,7 +10,7 @@ Text-to-speech request input | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `input` | [components.SpeechInput](../components/speechinput.mdx) | ✔️ | Text to synthesize, or a list of turns for multi-speaker input. Each turn has its own text, voice, and instructions. Multi-speaker input is supported by Gemini TTS models, by Fish Audio models other than S1, and by Speechify dialogue models. | Hello world | -| `input_references` | List[[components.SpeechInputReference](../components/speechinputreference.mdx)] | ➖ | Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. An empty array is treated as no reference. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | +| `input_references` | List[[components.SpeechInputReference](../components/speechinputreference.mdx)] | ➖ | Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | | `instructions` | *Optional[str]* | ➖ | Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. | Speak in a warm and friendly tone. | | `model` | *str* | ✔️ | TTS model identifier | mistralai/voxtral-mini-tts-2603 | | `output_delivery` | [Optional[components.OutputDelivery]](../components/outputdelivery.mdx) | ➖ | `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. | stream | diff --git a/docs/sdks/presets/README.mdx b/docs/sdks/presets/README.mdx index 28c3e51a8..6253ef1cd 100644 --- a/docs/sdks/presets/README.mdx +++ b/docs/sdks/presets/README.mdx @@ -323,7 +323,7 @@ with OpenRouter( | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `workspace_id` | *Optional[str]* | ➖ | Workspace to act in. Also accepted as a `workspace_id` field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | -| `context_management` | [OptionalNullable[components.ContextManagement]](../../components/contextmanagement.mdx) | ➖ | N/A | | +| `context_management` | [OptionalNullable[components.MessagesRequestContextManagement]](../../components/messagesrequestcontextmanagement.mdx) | ➖ | N/A | | | `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `fallbacks` | List[[components.MessagesFallbackParam](../../components/messagesfallbackparam.mdx)] | ➖ | Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. | [
\{
"model": "claude-opus-4-8"
}
] | | `max_tokens` | *Optional[int]* | ➖ | N/A | | diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index 35394e656..dcd133803 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -47,7 +47,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `input_references` | List[[components.SpeechInputReference](../../components/speechinputreference.mdx)] | ➖ | Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. An empty array is treated as no reference. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | +| `input_references` | List[[components.SpeechInputReference](../../components/speechinputreference.mdx)] | ➖ | Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference. | [
\{
"input_audio": \{
"data": "data:audio/wav;base64,UklGRuQXDABXQVZF..."
},
"type": "input_audio"
},
\{
"text": "I used to rule the world.",
"type": "text"
}
] | | `instructions` | *Optional[str]* | ➖ | Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. | Speak in a warm and friendly tone. | | `output_delivery` | [Optional[components.OutputDelivery]](../../components/outputdelivery.mdx) | ➖ | `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. | stream | | `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | ➖ | Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options | | diff --git a/pyproject.toml b/pyproject.toml index 4f38b8941..5b190307c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.239" +version = "1.3.240" 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 bea916fd6..3e1002021 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.239" +__version__: str = "1.3.240" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.239 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.240 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 1ed0a646d..bbdce2c6c 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -413,6 +413,12 @@ AnthropicRefusalStopDetailsTypedDict, ) from .anthropicsafeguard import AnthropicSafeguard, AnthropicSafeguardTypedDict + from .anthropicsafeguardresult import ( + AnthropicSafeguardResult, + AnthropicSafeguardResultStatus, + AnthropicSafeguardResultStatusTypedDict, + AnthropicSafeguardResultTypedDict, + ) from .anthropicsearchresultblockparam import ( AnthropicSearchResultBlockParam, AnthropicSearchResultBlockParamCitations, @@ -421,11 +427,6 @@ AnthropicSearchResultBlockParamTypedDict, ) from .anthropicservertoolerrorcode import AnthropicServerToolErrorCode - from .anthropicservertoolusage import ( - AnthropicServerToolUsage, - AnthropicServerToolUsageTypedDict, - ) - from .anthropicservicetier import AnthropicServiceTier from .anthropicspeed import AnthropicSpeed from .anthropicsystemclearat import AnthropicSystemClearAt from .anthropictextblock import ( @@ -826,6 +827,10 @@ BatchImageGenerationImage, BatchImageGenerationImageTypedDict, ) + from .batchimagegenerationmissingimage import ( + BatchImageGenerationMissingImage, + BatchImageGenerationMissingImageTypedDict, + ) from .batchimagegenerationresponse import ( BatchImageGenerationResponse, BatchImageGenerationResponseTypedDict, @@ -903,6 +908,8 @@ BatchProviderPreferencesTypedDict, ) from .batchresult import ( + AppliedEdit, + AppliedEditTypedDict, Audio, AudioPcm1, AudioPcm1TypedDict, @@ -914,10 +921,14 @@ BatchResultCompletionTokensDetailsTypedDict, BatchResultContent, BatchResultContentTypedDict, + BatchResultContextManagement, + BatchResultContextManagementTypedDict, BatchResultData, BatchResultDataTypedDict, BatchResultDebug, BatchResultDebugTypedDict, + BatchResultDeferredToolsDetails, + BatchResultDeferredToolsDetailsTypedDict, BatchResultError, BatchResultErrorTypedDict, BatchResultEvent, @@ -3062,6 +3073,18 @@ MessagesFallbackParam, MessagesFallbackParamTypedDict, ) + from .messagesmcptoolresultblock import ( + MessagesMcpToolResultBlock, + MessagesMcpToolResultBlockContent, + MessagesMcpToolResultBlockContentTypedDict, + MessagesMcpToolResultBlockType, + MessagesMcpToolResultBlockTypedDict, + ) + from .messagesmcptooluseblock import ( + MessagesMcpToolUseBlock, + MessagesMcpToolUseBlockType, + MessagesMcpToolUseBlockTypedDict, + ) from .messagesmessageparam import ( ContentCompaction, ContentCompactionTypedDict, @@ -3119,8 +3142,6 @@ from .messagesrequest import ( ClearToolInputs, ClearToolInputsTypedDict, - ContextManagement, - ContextManagementTypedDict, Edit, EditClearThinking20251015, EditClearThinking20251015TypedDict, @@ -3137,6 +3158,8 @@ KeepType, KeepTypedDict, MessagesRequest, + MessagesRequestContextManagement, + MessagesRequestContextManagementTypedDict, MessagesRequestInputSchema, MessagesRequestInputSchemaTypedDict, MessagesRequestMetadata, @@ -3879,6 +3902,10 @@ ORAnthropicNullableCallerTypedDict, UnknownORAnthropicNullableCaller, ) + from .oranthropicservertoolusage import ( + ORAnthropicServerToolUsage, + ORAnthropicServerToolUsageTypedDict, + ) from .oranthropicservertooluseblock import ( ORAnthropicServerToolUseBlock, ORAnthropicServerToolUseBlockType, @@ -4829,12 +4856,17 @@ SpeechInputModalitySupportedInputs1TypedDict, SpeechInputModalitySupportedInputs2, SpeechInputModalitySupportedInputs2TypedDict, + SpeechInputModalitySupportedInputs3, + SpeechInputModalitySupportedInputs3TypedDict, SpeechInputModalityText, SpeechInputModalityTextTypedDict, SpeechInputModalityTypeAudio, SpeechInputModalityTypeImage, SpeechInputModalityTypeText, + SpeechInputModalityTypeVideo, SpeechInputModalityTypedDict, + SpeechInputModalityVideo, + SpeechInputModalityVideoTypedDict, Turns, UnknownSpeechInputModality, ) @@ -4865,6 +4897,15 @@ SpeechInputReferenceTextType, SpeechInputReferenceTextTypedDict, ) + from .speechinputreferencevideo import ( + SpeechInputReferenceVideo, + SpeechInputReferenceVideoType, + SpeechInputReferenceVideoTypedDict, + ) + from .speechinputreferencevideoinput import ( + SpeechInputReferenceVideoInput, + SpeechInputReferenceVideoInputTypedDict, + ) from .speechmodelendpoint import SpeechModelEndpoint, SpeechModelEndpointTypedDict from .speechmodelresponse import SpeechModelResponse, SpeechModelResponseTypedDict from .speechmodelslistresponse import ( @@ -5787,6 +5828,10 @@ "AnthropicRefusalStopDetailsType", "AnthropicRefusalStopDetailsTypedDict", "AnthropicSafeguard", + "AnthropicSafeguardResult", + "AnthropicSafeguardResultStatus", + "AnthropicSafeguardResultStatusTypedDict", + "AnthropicSafeguardResultTypedDict", "AnthropicSafeguardTypedDict", "AnthropicSearchResultBlockParam", "AnthropicSearchResultBlockParamCitations", @@ -5794,9 +5839,6 @@ "AnthropicSearchResultBlockParamType", "AnthropicSearchResultBlockParamTypedDict", "AnthropicServerToolErrorCode", - "AnthropicServerToolUsage", - "AnthropicServerToolUsageTypedDict", - "AnthropicServiceTier", "AnthropicSpeed", "AnthropicSystemClearAt", "AnthropicTextBlock", @@ -5937,6 +5979,8 @@ "AppRankingsResponseTypedDict", "AppScope", "AppTypedDict", + "AppliedEdit", + "AppliedEditTypedDict", "ApplyPatchCallItem", "ApplyPatchCallItemType", "ApplyPatchCallItemTypedDict", @@ -6061,6 +6105,8 @@ "BatchErrorResponseErrorTypedDict", "BatchImageGenerationImage", "BatchImageGenerationImageTypedDict", + "BatchImageGenerationMissingImage", + "BatchImageGenerationMissingImageTypedDict", "BatchImageGenerationResponse", "BatchImageGenerationResponseTypedDict", "BatchInputReference", @@ -6129,10 +6175,14 @@ "BatchResultCompletionTokensDetailsTypedDict", "BatchResultContent", "BatchResultContentTypedDict", + "BatchResultContextManagement", + "BatchResultContextManagementTypedDict", "BatchResultData", "BatchResultDataTypedDict", "BatchResultDebug", "BatchResultDebugTypedDict", + "BatchResultDeferredToolsDetails", + "BatchResultDeferredToolsDetailsTypedDict", "BatchResultError", "BatchResultErrorTypedDict", "BatchResultEvent", @@ -6624,8 +6674,6 @@ "ContextCompressionPlugin", "ContextCompressionPluginID", "ContextCompressionPluginTypedDict", - "ContextManagement", - "ContextManagementTypedDict", "Contradiction", "ContradictionTypedDict", "CostDetails", @@ -7711,6 +7759,14 @@ "MessagesBashToolResultBlockTypedDict", "MessagesFallbackParam", "MessagesFallbackParamTypedDict", + "MessagesMcpToolResultBlock", + "MessagesMcpToolResultBlockContent", + "MessagesMcpToolResultBlockContentTypedDict", + "MessagesMcpToolResultBlockType", + "MessagesMcpToolResultBlockTypedDict", + "MessagesMcpToolUseBlock", + "MessagesMcpToolUseBlockType", + "MessagesMcpToolUseBlockTypedDict", "MessagesMessageParam", "MessagesMessageParamContentUnion1", "MessagesMessageParamContentUnion1TypedDict", @@ -7740,6 +7796,8 @@ "MessagesOutputConfigTypeJSONSchema", "MessagesOutputConfigTypedDict", "MessagesRequest", + "MessagesRequestContextManagement", + "MessagesRequestContextManagementTypedDict", "MessagesRequestInputSchema", "MessagesRequestInputSchemaTypedDict", "MessagesRequestMetadata", @@ -7985,6 +8043,8 @@ "ORAnthropicContentBlockTypedDict", "ORAnthropicNullableCaller", "ORAnthropicNullableCallerTypedDict", + "ORAnthropicServerToolUsage", + "ORAnthropicServerToolUsageTypedDict", "ORAnthropicServerToolUseBlock", "ORAnthropicServerToolUseBlockType", "ORAnthropicServerToolUseBlockTypedDict", @@ -8954,12 +9014,17 @@ "SpeechInputModalitySupportedInputs1TypedDict", "SpeechInputModalitySupportedInputs2", "SpeechInputModalitySupportedInputs2TypedDict", + "SpeechInputModalitySupportedInputs3", + "SpeechInputModalitySupportedInputs3TypedDict", "SpeechInputModalityText", "SpeechInputModalityTextTypedDict", "SpeechInputModalityTypeAudio", "SpeechInputModalityTypeImage", "SpeechInputModalityTypeText", + "SpeechInputModalityTypeVideo", "SpeechInputModalityTypedDict", + "SpeechInputModalityVideo", + "SpeechInputModalityVideoTypedDict", "SpeechInputReference", "SpeechInputReferenceAudio", "SpeechInputReferenceAudioInput", @@ -8975,6 +9040,11 @@ "SpeechInputReferenceTextType", "SpeechInputReferenceTextTypedDict", "SpeechInputReferenceTypedDict", + "SpeechInputReferenceVideo", + "SpeechInputReferenceVideoInput", + "SpeechInputReferenceVideoInputTypedDict", + "SpeechInputReferenceVideoType", + "SpeechInputReferenceVideoTypedDict", "SpeechInputTypedDict", "SpeechModelEndpoint", "SpeechModelEndpointTypedDict", @@ -9840,15 +9910,16 @@ "AnthropicRefusalStopDetailsTypedDict": ".anthropicrefusalstopdetails", "AnthropicSafeguard": ".anthropicsafeguard", "AnthropicSafeguardTypedDict": ".anthropicsafeguard", + "AnthropicSafeguardResult": ".anthropicsafeguardresult", + "AnthropicSafeguardResultStatus": ".anthropicsafeguardresult", + "AnthropicSafeguardResultStatusTypedDict": ".anthropicsafeguardresult", + "AnthropicSafeguardResultTypedDict": ".anthropicsafeguardresult", "AnthropicSearchResultBlockParam": ".anthropicsearchresultblockparam", "AnthropicSearchResultBlockParamCitations": ".anthropicsearchresultblockparam", "AnthropicSearchResultBlockParamCitationsTypedDict": ".anthropicsearchresultblockparam", "AnthropicSearchResultBlockParamType": ".anthropicsearchresultblockparam", "AnthropicSearchResultBlockParamTypedDict": ".anthropicsearchresultblockparam", "AnthropicServerToolErrorCode": ".anthropicservertoolerrorcode", - "AnthropicServerToolUsage": ".anthropicservertoolusage", - "AnthropicServerToolUsageTypedDict": ".anthropicservertoolusage", - "AnthropicServiceTier": ".anthropicservicetier", "AnthropicSpeed": ".anthropicspeed", "AnthropicSystemClearAt": ".anthropicsystemclearat", "AnthropicTextBlock": ".anthropictextblock", @@ -10128,6 +10199,8 @@ "BatchErrorResponseErrorTypedDict": ".batcherrorresponse", "BatchImageGenerationImage": ".batchimagegenerationimage", "BatchImageGenerationImageTypedDict": ".batchimagegenerationimage", + "BatchImageGenerationMissingImage": ".batchimagegenerationmissingimage", + "BatchImageGenerationMissingImageTypedDict": ".batchimagegenerationmissingimage", "BatchImageGenerationResponse": ".batchimagegenerationresponse", "BatchImageGenerationResponseTypedDict": ".batchimagegenerationresponse", "BatchInputReference": ".batchinputreference", @@ -10191,6 +10264,8 @@ "BatchProviderPreferencesOnly": ".batchproviderpreferences", "BatchProviderPreferencesOnlyTypedDict": ".batchproviderpreferences", "BatchProviderPreferencesTypedDict": ".batchproviderpreferences", + "AppliedEdit": ".batchresult", + "AppliedEditTypedDict": ".batchresult", "Audio": ".batchresult", "AudioPcm1": ".batchresult", "AudioPcm1TypedDict": ".batchresult", @@ -10202,10 +10277,14 @@ "BatchResultCompletionTokensDetailsTypedDict": ".batchresult", "BatchResultContent": ".batchresult", "BatchResultContentTypedDict": ".batchresult", + "BatchResultContextManagement": ".batchresult", + "BatchResultContextManagementTypedDict": ".batchresult", "BatchResultData": ".batchresult", "BatchResultDataTypedDict": ".batchresult", "BatchResultDebug": ".batchresult", "BatchResultDebugTypedDict": ".batchresult", + "BatchResultDeferredToolsDetails": ".batchresult", + "BatchResultDeferredToolsDetailsTypedDict": ".batchresult", "BatchResultError": ".batchresult", "BatchResultErrorTypedDict": ".batchresult", "BatchResultEvent": ".batchresult", @@ -11740,6 +11819,14 @@ "MessagesBashToolResultBlockTypedDict": ".messagesbashtoolresultblock", "MessagesFallbackParam": ".messagesfallbackparam", "MessagesFallbackParamTypedDict": ".messagesfallbackparam", + "MessagesMcpToolResultBlock": ".messagesmcptoolresultblock", + "MessagesMcpToolResultBlockContent": ".messagesmcptoolresultblock", + "MessagesMcpToolResultBlockContentTypedDict": ".messagesmcptoolresultblock", + "MessagesMcpToolResultBlockType": ".messagesmcptoolresultblock", + "MessagesMcpToolResultBlockTypedDict": ".messagesmcptoolresultblock", + "MessagesMcpToolUseBlock": ".messagesmcptooluseblock", + "MessagesMcpToolUseBlockType": ".messagesmcptooluseblock", + "MessagesMcpToolUseBlockTypedDict": ".messagesmcptooluseblock", "ContentCompaction": ".messagesmessageparam", "ContentCompactionTypedDict": ".messagesmessageparam", "ContentRedactedThinking": ".messagesmessageparam", @@ -11792,8 +11879,6 @@ "TypeTokens": ".messagesoutputconfig", "ClearToolInputs": ".messagesrequest", "ClearToolInputsTypedDict": ".messagesrequest", - "ContextManagement": ".messagesrequest", - "ContextManagementTypedDict": ".messagesrequest", "Edit": ".messagesrequest", "EditClearThinking20251015": ".messagesrequest", "EditClearThinking20251015TypedDict": ".messagesrequest", @@ -11810,6 +11895,8 @@ "KeepType": ".messagesrequest", "KeepTypedDict": ".messagesrequest", "MessagesRequest": ".messagesrequest", + "MessagesRequestContextManagement": ".messagesrequest", + "MessagesRequestContextManagementTypedDict": ".messagesrequest", "MessagesRequestInputSchema": ".messagesrequest", "MessagesRequestInputSchemaTypedDict": ".messagesrequest", "MessagesRequestMetadata": ".messagesrequest", @@ -12411,6 +12498,8 @@ "ORAnthropicNullableCaller": ".oranthropicnullablecaller", "ORAnthropicNullableCallerTypedDict": ".oranthropicnullablecaller", "UnknownORAnthropicNullableCaller": ".oranthropicnullablecaller", + "ORAnthropicServerToolUsage": ".oranthropicservertoolusage", + "ORAnthropicServerToolUsageTypedDict": ".oranthropicservertoolusage", "ORAnthropicServerToolUseBlock": ".oranthropicservertooluseblock", "ORAnthropicServerToolUseBlockType": ".oranthropicservertooluseblock", "ORAnthropicServerToolUseBlockTypedDict": ".oranthropicservertooluseblock", @@ -13109,12 +13198,17 @@ "SpeechInputModalitySupportedInputs1TypedDict": ".speechinputmodality", "SpeechInputModalitySupportedInputs2": ".speechinputmodality", "SpeechInputModalitySupportedInputs2TypedDict": ".speechinputmodality", + "SpeechInputModalitySupportedInputs3": ".speechinputmodality", + "SpeechInputModalitySupportedInputs3TypedDict": ".speechinputmodality", "SpeechInputModalityText": ".speechinputmodality", "SpeechInputModalityTextTypedDict": ".speechinputmodality", "SpeechInputModalityTypeAudio": ".speechinputmodality", "SpeechInputModalityTypeImage": ".speechinputmodality", "SpeechInputModalityTypeText": ".speechinputmodality", + "SpeechInputModalityTypeVideo": ".speechinputmodality", "SpeechInputModalityTypedDict": ".speechinputmodality", + "SpeechInputModalityVideo": ".speechinputmodality", + "SpeechInputModalityVideoTypedDict": ".speechinputmodality", "Turns": ".speechinputmodality", "UnknownSpeechInputModality": ".speechinputmodality", "SpeechInputReference": ".speechinputreference", @@ -13132,6 +13226,11 @@ "SpeechInputReferenceText": ".speechinputreferencetext", "SpeechInputReferenceTextType": ".speechinputreferencetext", "SpeechInputReferenceTextTypedDict": ".speechinputreferencetext", + "SpeechInputReferenceVideo": ".speechinputreferencevideo", + "SpeechInputReferenceVideoType": ".speechinputreferencevideo", + "SpeechInputReferenceVideoTypedDict": ".speechinputreferencevideo", + "SpeechInputReferenceVideoInput": ".speechinputreferencevideoinput", + "SpeechInputReferenceVideoInputTypedDict": ".speechinputreferencevideoinput", "SpeechModelEndpoint": ".speechmodelendpoint", "SpeechModelEndpointTypedDict": ".speechmodelendpoint", "SpeechModelResponse": ".speechmodelresponse", diff --git a/src/openrouter/components/anthropicsafeguardresult.py b/src/openrouter/components/anthropicsafeguardresult.py new file mode 100644 index 000000000..09c850d72 --- /dev/null +++ b/src/openrouter/components/anthropicsafeguardresult.py @@ -0,0 +1,57 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +import pydantic +from pydantic import ConfigDict +from typing import Any, Dict +from typing_extensions import TypedDict + + +class AnthropicSafeguardResultStatusTypedDict(TypedDict): + type: str + + +class AnthropicSafeguardResultStatus(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + type: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +class AnthropicSafeguardResultTypedDict(TypedDict): + r"""The outcome of a server-side safeguard, keyed by tool-use id where applicable""" + + status: AnthropicSafeguardResultStatusTypedDict + type: str + + +class AnthropicSafeguardResult(BaseModel): + r"""The outcome of a server-side safeguard, keyed by tool-use id where applicable""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + status: AnthropicSafeguardResultStatus + + type: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] diff --git a/src/openrouter/components/anthropicservertoolusage.py b/src/openrouter/components/anthropicservertoolusage.py deleted file mode 100644 index a49ba8b6b..000000000 --- a/src/openrouter/components/anthropicservertoolusage.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import BaseModel -from typing_extensions import TypedDict - - -class AnthropicServerToolUsageTypedDict(TypedDict): - web_fetch_requests: int - web_search_requests: int - - -class AnthropicServerToolUsage(BaseModel): - web_fetch_requests: int - - web_search_requests: int diff --git a/src/openrouter/components/anthropicservicetier.py b/src/openrouter/components/anthropicservicetier.py deleted file mode 100644 index 12117ebb5..000000000 --- a/src/openrouter/components/anthropicservicetier.py +++ /dev/null @@ -1,15 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import UnrecognizedStr -from typing import Literal, Union - - -AnthropicServiceTier = Union[ - Literal[ - "standard", - "priority", - "batch", - ], - UnrecognizedStr, -] diff --git a/src/openrouter/components/batchimagegenerationmissingimage.py b/src/openrouter/components/batchimagegenerationmissingimage.py new file mode 100644 index 000000000..c15b4edda --- /dev/null +++ b/src/openrouter/components/batchimagegenerationmissingimage.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class BatchImageGenerationMissingImageTypedDict(TypedDict): + r"""An image the provider returned that OpenRouter could not store. It is not billed.""" + + index: int + r"""Position of the image among the images returned for this request, from 0""" + message: str + r"""Why the image is missing""" + + +class BatchImageGenerationMissingImage(BaseModel): + r"""An image the provider returned that OpenRouter could not store. It is not billed.""" + + index: int + r"""Position of the image among the images returned for this request, from 0""" + + message: str + r"""Why the image is missing""" diff --git a/src/openrouter/components/batchimagegenerationresponse.py b/src/openrouter/components/batchimagegenerationresponse.py index 09c559ba3..9cf0a50f3 100644 --- a/src/openrouter/components/batchimagegenerationresponse.py +++ b/src/openrouter/components/batchimagegenerationresponse.py @@ -5,6 +5,10 @@ BatchImageGenerationImage, BatchImageGenerationImageTypedDict, ) +from .batchimagegenerationmissingimage import ( + BatchImageGenerationMissingImage, + BatchImageGenerationMissingImageTypedDict, +) from .imagegenerationusage import ImageGenerationUsage, ImageGenerationUsageTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer @@ -22,6 +26,8 @@ class BatchImageGenerationResponseTypedDict(TypedDict): r"""Unix timestamp (seconds) when the image URLs in `data` stop working. Download the images before then.""" id: NotRequired[str] r"""Generation ID of this request. Look up its cost and details with `GET /api/v1/generation?id=`.""" + missing_images: NotRequired[List[BatchImageGenerationMissingImageTypedDict]] + r"""Images the provider returned without usable image data. Present only when some images of the request are missing; `data` lists the rest.""" usage: NotRequired[ImageGenerationUsageTypedDict] r"""Token and cost usage for the image generation request, when available""" @@ -40,12 +46,15 @@ class BatchImageGenerationResponse(BaseModel): id: Optional[str] = None r"""Generation ID of this request. Look up its cost and details with `GET /api/v1/generation?id=`.""" + missing_images: Optional[List[BatchImageGenerationMissingImage]] = None + r"""Images the provider returned without usable image data. Present only when some images of the request are missing; `data` lists the rest.""" + usage: Optional[ImageGenerationUsage] = None r"""Token and cost usage for the image generation request, when available""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["id", "usage"]) + optional_fields = set(["id", "missing_images", "usage"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/batchresult.py b/src/openrouter/components/batchresult.py index c108a9cf7..710a655db 100644 --- a/src/openrouter/components/batchresult.py +++ b/src/openrouter/components/batchresult.py @@ -19,11 +19,10 @@ AnthropicRefusalStopDetails, AnthropicRefusalStopDetailsTypedDict, ) -from .anthropicservertoolusage import ( - AnthropicServerToolUsage, - AnthropicServerToolUsageTypedDict, +from .anthropicsafeguardresult import ( + AnthropicSafeguardResult, + AnthropicSafeguardResultTypedDict, ) -from .anthropicservicetier import AnthropicServiceTier from .anthropicspeed import AnthropicSpeed from .anthropicusageiteration import ( AnthropicUsageIteration, @@ -44,6 +43,10 @@ ORAnthropicContentBlock, ORAnthropicContentBlockTypedDict, ) +from .oranthropicservertoolusage import ( + ORAnthropicServerToolUsage, + ORAnthropicServerToolUsageTypedDict, +) from .oranthropicstopreason import ORAnthropicStopReason from .reasoningdetailencrypted import ( ReasoningDetailEncrypted, @@ -441,12 +444,66 @@ def serialize_model(self, handler): return m +class AppliedEditTypedDict(TypedDict): + type: str + + +class AppliedEdit(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) + + type: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +class BatchResultContextManagementTypedDict(TypedDict): + applied_edits: List[AppliedEditTypedDict] + + +class BatchResultContextManagement(BaseModel): + applied_edits: List[AppliedEdit] + + BatchResultRole = Literal["assistant",] BatchResultTypeMessage = Literal["message",] +class BatchResultDeferredToolsDetailsTypedDict(TypedDict): + completion_tokens: int + r"""Completion tokens summed over every upstream call""" + prompt_tokens: int + r"""Prompt tokens summed over every upstream call""" + total_tokens: int + r"""Sum of the above two fields""" + turns: int + r"""Upstream model calls the run made""" + + +class BatchResultDeferredToolsDetails(BaseModel): + completion_tokens: int + r"""Completion tokens summed over every upstream call""" + + prompt_tokens: int + r"""Prompt tokens summed over every upstream call""" + + total_tokens: int + r"""Sum of the above two fields""" + + turns: int + r"""Upstream model calls the run made""" + + class BatchResultUsage2TypedDict(TypedDict): cache_creation: Nullable[AnthropicCacheCreationTypedDict] cache_creation_input_tokens: Nullable[int] @@ -455,8 +512,13 @@ class BatchResultUsage2TypedDict(TypedDict): input_tokens: int output_tokens: int output_tokens_details: Nullable[AnthropicOutputTokensDetailsTypedDict] - server_tool_use: Nullable[AnthropicServerToolUsageTypedDict] - service_tier: Nullable[AnthropicServiceTier] + server_tool_use: Nullable[ORAnthropicServerToolUsageTypedDict] + service_tier: Nullable[str] + cost: NotRequired[Nullable[float]] + cost_details: NotRequired[Nullable[CostDetailsTypedDict]] + r"""Breakdown of upstream inference costs""" + deferred_tools_details: NotRequired[BatchResultDeferredToolsDetailsTypedDict] + is_byok: NotRequired[bool] iterations: NotRequired[List[AnthropicUsageIterationTypedDict]] speed: NotRequired[Nullable[AnthropicSpeed]] @@ -476,9 +538,18 @@ class BatchResultUsage2(BaseModel): output_tokens_details: Nullable[AnthropicOutputTokensDetails] - server_tool_use: Nullable[AnthropicServerToolUsage] + server_tool_use: Nullable[ORAnthropicServerToolUsage] + + service_tier: Nullable[str] + + cost: OptionalNullable[float] = UNSET + + cost_details: OptionalNullable[CostDetails] = UNSET + r"""Breakdown of upstream inference costs""" + + deferred_tools_details: Optional[BatchResultDeferredToolsDetails] = None - service_tier: Nullable[AnthropicServiceTier] + is_byok: Optional[bool] = None iterations: Optional[List[AnthropicUsageIteration]] = None @@ -486,12 +557,23 @@ class BatchResultUsage2(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["iterations", "speed"]) + optional_fields = set( + [ + "cost", + "cost_details", + "deferred_tools_details", + "is_byok", + "iterations", + "speed", + ] + ) nullable_fields = set( [ "cache_creation", "cache_creation_input_tokens", "cache_read_input_tokens", + "cost", + "cost_details", "inference_geo", "output_tokens_details", "server_tool_use", @@ -533,9 +615,13 @@ class BodyMessageTypedDict(TypedDict): stop_sequence: Nullable[str] type: BatchResultTypeMessage usage: BatchResultUsage2TypedDict + context_management: NotRequired[Nullable[BatchResultContextManagementTypedDict]] input_transformations: NotRequired[ Nullable[List[AnthropicInputTransformationTypedDict]] ] + openrouter_metadata: NotRequired[OpenRouterMetadataTypedDict] + provider: NotRequired[str] + safeguard_results: NotRequired[Nullable[List[AnthropicSafeguardResultTypedDict]]] class BodyMessage(BaseModel): @@ -560,15 +646,33 @@ class BodyMessage(BaseModel): usage: BatchResultUsage2 + context_management: OptionalNullable[BatchResultContextManagement] = UNSET + input_transformations: OptionalNullable[List[AnthropicInputTransformation]] = UNSET + openrouter_metadata: Optional[OpenRouterMetadata] = None + + provider: Optional[str] = None + + safeguard_results: OptionalNullable[List[AnthropicSafeguardResult]] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["input_transformations"]) + optional_fields = set( + [ + "context_management", + "input_transformations", + "openrouter_metadata", + "provider", + "safeguard_results", + ] + ) nullable_fields = set( [ "container", + "context_management", "input_transformations", + "safeguard_results", "stop_details", "stop_reason", "stop_sequence", @@ -1419,8 +1523,8 @@ def serialize_model(self, handler): BodyAudioSpeechTypedDict, BodyListTypedDict, BatchImageGenerationResponseTypedDict, - BodyMessageTypedDict, BodyChatCompletionTypedDict, + BodyMessageTypedDict, OpenResponsesResultTypedDict, ], ) @@ -1432,8 +1536,8 @@ def serialize_model(self, handler): BodyAudioSpeech, BodyList, BatchImageGenerationResponse, - BodyMessage, BodyChatCompletion, + BodyMessage, OpenResponsesResult, ], ) diff --git a/src/openrouter/components/messagesmcptoolresultblock.py b/src/openrouter/components/messagesmcptoolresultblock.py new file mode 100644 index 000000000..331037479 --- /dev/null +++ b/src/openrouter/components/messagesmcptoolresultblock.py @@ -0,0 +1,71 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .anthropiccachecontroldirective import ( + AnthropicCacheControlDirective, + AnthropicCacheControlDirectiveTypedDict, +) +from .anthropictextblockparam import ( + AnthropicTextBlockParam, + AnthropicTextBlockParamTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +MessagesMcpToolResultBlockContentTypedDict = TypeAliasType( + "MessagesMcpToolResultBlockContentTypedDict", + Union[str, List[AnthropicTextBlockParamTypedDict]], +) + + +MessagesMcpToolResultBlockContent = TypeAliasType( + "MessagesMcpToolResultBlockContent", Union[str, List[AnthropicTextBlockParam]] +) + + +MessagesMcpToolResultBlockType = Literal["mcp_tool_result",] + + +class MessagesMcpToolResultBlockTypedDict(TypedDict): + r"""MCP tool result block paired with a prior `mcp_tool_use` block for replay.""" + + tool_use_id: str + type: MessagesMcpToolResultBlockType + cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" + content: NotRequired[MessagesMcpToolResultBlockContentTypedDict] + is_error: NotRequired[bool] + + +class MessagesMcpToolResultBlock(BaseModel): + r"""MCP tool result block paired with a prior `mcp_tool_use` block for replay.""" + + tool_use_id: str + + type: MessagesMcpToolResultBlockType + + cache_control: Optional[AnthropicCacheControlDirective] = None + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" + + content: Optional[MessagesMcpToolResultBlockContent] = None + + is_error: Optional[bool] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["cache_control", "content", "is_error"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/messagesmcptooluseblock.py b/src/openrouter/components/messagesmcptooluseblock.py new file mode 100644 index 000000000..c9e416348 --- /dev/null +++ b/src/openrouter/components/messagesmcptooluseblock.py @@ -0,0 +1,59 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .anthropiccachecontroldirective import ( + AnthropicCacheControlDirective, + AnthropicCacheControlDirectiveTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Any, Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +MessagesMcpToolUseBlockType = Literal["mcp_tool_use",] + + +class MessagesMcpToolUseBlockTypedDict(TypedDict): + r"""MCP tool call emitted by an upstream Anthropic assistant turn for replay.""" + + id: str + name: str + server_name: str + type: MessagesMcpToolUseBlockType + cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" + input: NotRequired[Any] + + +class MessagesMcpToolUseBlock(BaseModel): + r"""MCP tool call emitted by an upstream Anthropic assistant turn for replay.""" + + id: str + + name: str + + server_name: str + + type: MessagesMcpToolUseBlockType + + cache_control: Optional[AnthropicCacheControlDirective] = None + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" + + input: Optional[Any] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["cache_control", "input"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/messagesmessageparam.py b/src/openrouter/components/messagesmessageparam.py index 9f2d198f6..91cb880d5 100644 --- a/src/openrouter/components/messagesmessageparam.py +++ b/src/openrouter/components/messagesmessageparam.py @@ -38,6 +38,14 @@ MessagesBashToolResultBlock, MessagesBashToolResultBlockTypedDict, ) +from .messagesmcptoolresultblock import ( + MessagesMcpToolResultBlock, + MessagesMcpToolResultBlockTypedDict, +) +from .messagesmcptooluseblock import ( + MessagesMcpToolUseBlock, + MessagesMcpToolUseBlockTypedDict, +) from .messagesshelltoolresultblock import ( MessagesShellToolResultBlock, MessagesShellToolResultBlockTypedDict, @@ -415,17 +423,19 @@ def serialize_model(self, handler): MessagesToolRemovalBlockTypedDict, MessagesToolAdditionBlockTypedDict, ContentThinkingTypedDict, + ContentCompactionTypedDict, ContentWebSearchToolResultTypedDict, AnthropicTextBlockParamTypedDict, - ContentCompactionTypedDict, MessagesToolSearchToolResultBlockTypedDict, ContentServerToolUseTypedDict, ContentToolResultTypedDict, ContentToolUseTypedDict, MessagesShellToolResultBlockTypedDict, MessagesBashToolResultBlockTypedDict, + MessagesMcpToolResultBlockTypedDict, AnthropicSearchResultBlockParamTypedDict, AnthropicDocumentBlockParamTypedDict, + MessagesMcpToolUseBlockTypedDict, ], ) @@ -452,6 +462,8 @@ def serialize_model(self, handler): ORAnthropicToolSearchResultParam, Tag("openrouter_tool_search_result") ], Annotated[MessagesToolSearchToolResultBlock, Tag("tool_search_tool_result")], + Annotated[MessagesMcpToolUseBlock, Tag("mcp_tool_use")], + Annotated[MessagesMcpToolResultBlock, Tag("mcp_tool_result")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index e1cb9dc4a..b2bd75179 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -317,11 +317,11 @@ def serialize_model(self, handler): ] -class ContextManagementTypedDict(TypedDict): +class MessagesRequestContextManagementTypedDict(TypedDict): edits: NotRequired[List[EditTypedDict]] -class ContextManagement(BaseModel): +class MessagesRequestContextManagement(BaseModel): edits: Optional[List[Edit]] = None @model_serializer(mode="wrap") @@ -1153,7 +1153,7 @@ class MessagesRequestTypedDict(TypedDict): model: str cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" - context_management: NotRequired[Nullable[ContextManagementTypedDict]] + context_management: NotRequired[Nullable[MessagesRequestContextManagementTypedDict]] deferred_tools: NotRequired[DeferredToolsControlTypedDict] r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]] @@ -1199,7 +1199,7 @@ class MessagesRequest(BaseModel): cache_control: Optional[AnthropicCacheControlDirective] = None r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" - context_management: OptionalNullable[ContextManagement] = UNSET + context_management: OptionalNullable[MessagesRequestContextManagement] = UNSET deferred_tools: Optional[DeferredToolsControl] = None r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" diff --git a/src/openrouter/components/oranthropicservertoolusage.py b/src/openrouter/components/oranthropicservertoolusage.py new file mode 100644 index 000000000..4995dd906 --- /dev/null +++ b/src/openrouter/components/oranthropicservertoolusage.py @@ -0,0 +1,40 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class ORAnthropicServerToolUsageTypedDict(TypedDict): + web_fetch_requests: int + web_search_requests: int + tool_calls_executed: NotRequired[int] + tool_calls_requested: NotRequired[int] + + +class ORAnthropicServerToolUsage(BaseModel): + web_fetch_requests: int + + web_search_requests: int + + tool_calls_executed: Optional[int] = None + + tool_calls_requested: Optional[int] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_calls_executed", "tool_calls_requested"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/speechinputmodality.py b/src/openrouter/components/speechinputmodality.py index 8046ca68a..2b8402c35 100644 --- a/src/openrouter/components/speechinputmodality.py +++ b/src/openrouter/components/speechinputmodality.py @@ -11,6 +11,34 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +class SpeechInputModalitySupportedInputs3TypedDict(TypedDict): + r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + + references: SpeechReferenceCountTypedDict + + +class SpeechInputModalitySupportedInputs3(BaseModel): + r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + + references: SpeechReferenceCount + + +SpeechInputModalityTypeVideo = Literal["video",] + + +class SpeechInputModalityVideoTypedDict(TypedDict): + supported_inputs: SpeechInputModalitySupportedInputs3TypedDict + r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + type: SpeechInputModalityTypeVideo + + +class SpeechInputModalityVideo(BaseModel): + supported_inputs: SpeechInputModalitySupportedInputs3 + r"""`references` is how many `video_url` parts a request may send. A video reference is the only part of its request and bills at the endpoint's video rate.""" + + type: SpeechInputModalityTypeVideo + + AudioEnum = Union[ Literal[ "required", @@ -144,9 +172,10 @@ def serialize_model(self, handler): SpeechInputModalityTextTypedDict, SpeechInputModalityAudioTypedDict, SpeechInputModalityImageTypedDict, + SpeechInputModalityVideoTypedDict, ], ) -r"""An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design.""" +r"""An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design; `video` is a reference video the generated audio is made for.""" class UnknownSpeechInputModality(BaseModel): @@ -163,6 +192,7 @@ class UnknownSpeechInputModality(BaseModel): "text": SpeechInputModalityText, "audio": SpeechInputModalityAudio, "image": SpeechInputModalityImage, + "video": SpeechInputModalityVideo, } @@ -171,6 +201,7 @@ class UnknownSpeechInputModality(BaseModel): SpeechInputModalityText, SpeechInputModalityAudio, SpeechInputModalityImage, + SpeechInputModalityVideo, UnknownSpeechInputModality, ], BeforeValidator( @@ -183,4 +214,4 @@ class UnknownSpeechInputModality(BaseModel): ) ), ] -r"""An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design.""" +r"""An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design; `video` is a reference video the generated audio is made for.""" diff --git a/src/openrouter/components/speechinputreference.py b/src/openrouter/components/speechinputreference.py index 0881593ad..059612864 100644 --- a/src/openrouter/components/speechinputreference.py +++ b/src/openrouter/components/speechinputreference.py @@ -13,6 +13,10 @@ SpeechInputReferenceText, SpeechInputReferenceTextTypedDict, ) +from .speechinputreferencevideo import ( + SpeechInputReferenceVideo, + SpeechInputReferenceVideoTypedDict, +) from openrouter.utils import get_discriminator from pydantic import Discriminator, Tag from typing import Union @@ -25,6 +29,7 @@ SpeechInputReferenceAudioTypedDict, SpeechInputReferenceTextTypedDict, SpeechInputReferenceImageTypedDict, + SpeechInputReferenceVideoTypedDict, ], ) r"""Reference content part for stateless voice cloning or voice design""" @@ -35,6 +40,7 @@ Annotated[SpeechInputReferenceImage, Tag("image_url")], Annotated[SpeechInputReferenceAudio, Tag("input_audio")], Annotated[SpeechInputReferenceText, Tag("text")], + Annotated[SpeechInputReferenceVideo, Tag("video_url")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] diff --git a/src/openrouter/components/speechinputreferencevideo.py b/src/openrouter/components/speechinputreferencevideo.py new file mode 100644 index 000000000..5f045bb6f --- /dev/null +++ b/src/openrouter/components/speechinputreferencevideo.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .speechinputreferencevideoinput import ( + SpeechInputReferenceVideoInput, + SpeechInputReferenceVideoInputTypedDict, +) +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +SpeechInputReferenceVideoType = Literal["video_url",] + + +class SpeechInputReferenceVideoTypedDict(TypedDict): + r"""Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate.""" + + type: SpeechInputReferenceVideoType + video_url: SpeechInputReferenceVideoInputTypedDict + r"""Reference video input object""" + + +class SpeechInputReferenceVideo(BaseModel): + r"""Reference video the generated audio is made for (sound and voice matched to the footage, same length as the clip). Must be the only part in `input_references`. Only routed to endpoints that support video references, which bill at their video rate.""" + + type: SpeechInputReferenceVideoType + + video_url: SpeechInputReferenceVideoInput + r"""Reference video input object""" diff --git a/src/openrouter/components/speechinputreferencevideoinput.py b/src/openrouter/components/speechinputreferencevideoinput.py new file mode 100644 index 000000000..d018d8321 --- /dev/null +++ b/src/openrouter/components/speechinputreferencevideoinput.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class SpeechInputReferenceVideoInputTypedDict(TypedDict): + r"""Reference video input object""" + + url: str + r"""Public http(s) URL of the reference video. The provider downloads it; OpenRouter does not fetch it, and data URIs are rejected.""" + + +class SpeechInputReferenceVideoInput(BaseModel): + r"""Reference video input object""" + + url: str + r"""Public http(s) URL of the reference video. The provider downloads it; OpenRouter does not fetch it, and data URIs are rejected.""" diff --git a/src/openrouter/components/speechrequest.py b/src/openrouter/components/speechrequest.py index ca55f7a05..5246bf6da 100644 --- a/src/openrouter/components/speechrequest.py +++ b/src/openrouter/components/speechrequest.py @@ -192,7 +192,7 @@ class SpeechRequestTypedDict(TypedDict): model: str r"""TTS model identifier""" input_references: NotRequired[List[SpeechInputReferenceTypedDict]] - r"""Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. An empty array is treated as no reference.""" + r"""Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference.""" instructions: NotRequired[str] r"""Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers.""" output_delivery: NotRequired[OutputDelivery] @@ -225,7 +225,7 @@ class SpeechRequest(BaseModel): r"""TTS model identifier""" input_references: Optional[List[SpeechInputReference]] = None - r"""Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. An empty array is treated as no reference.""" + r"""Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference.""" instructions: Optional[str] = None r"""Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers.""" diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index 936058d4a..23788b8ac 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -1764,7 +1764,10 @@ def create_presets_messages( ] ] = None, context_management: OptionalNullable[ - Union[components.ContextManagement, components.ContextManagementTypedDict] + Union[ + components.MessagesRequestContextManagement, + components.MessagesRequestContextManagementTypedDict, + ] ] = UNSET, deferred_tools: Optional[ Union[ @@ -1914,7 +1917,8 @@ def create_presets_messages( cache_control, Optional[components.AnthropicCacheControlDirective] ), context_management=utils.get_pydantic_model( - context_management, OptionalNullable[components.ContextManagement] + context_management, + OptionalNullable[components.MessagesRequestContextManagement], ), deferred_tools=utils.get_pydantic_model( deferred_tools, Optional[components.DeferredToolsControl] @@ -2099,7 +2103,10 @@ async def create_presets_messages_async( ] ] = None, context_management: OptionalNullable[ - Union[components.ContextManagement, components.ContextManagementTypedDict] + Union[ + components.MessagesRequestContextManagement, + components.MessagesRequestContextManagementTypedDict, + ] ] = UNSET, deferred_tools: Optional[ Union[ @@ -2249,7 +2256,8 @@ async def create_presets_messages_async( cache_control, Optional[components.AnthropicCacheControlDirective] ), context_management=utils.get_pydantic_model( - context_management, OptionalNullable[components.ContextManagement] + context_management, + OptionalNullable[components.MessagesRequestContextManagement], ), deferred_tools=utils.get_pydantic_model( deferred_tools, Optional[components.DeferredToolsControl] diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py index 547483497..8ab79410a 100644 --- a/src/openrouter/tts.py +++ b/src/openrouter/tts.py @@ -64,7 +64,7 @@ def create_speech( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param input_references: Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. An empty array is treated as no reference. + :param input_references: Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference. :param instructions: Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. :param output_delivery: `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. :param provider: Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options @@ -339,7 +339,7 @@ async def create_speech_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param input_references: Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. An empty array is treated as no reference. + :param input_references: Reference content for stateless voice cloning or voice design. Audio mode: one to three `input_audio` parts, each optionally paired with a `text` part carrying its transcript (a single clip accepts its transcript before or after it; with multiple clips each transcript immediately follows its clip), plus at most one `image_url` part as a scene image on providers that condition the cloned voice on its setting; only routed to endpoints that support voice cloning (and multiple references or image references when those parts are sent). Image mode: exactly one `image_url` part; only routed to endpoints that support image references. Video mode: exactly one `video_url` part with a public http(s) URL and no other parts; only routed to endpoints that support video references. An empty array is treated as no reference. :param instructions: Delivery instructions for the whole request, such as tone, pacing, or emotion. Supported by OpenAI gpt-4o-mini-tts, Gemini TTS, and Fish Audio models. Ignored by other providers. :param output_delivery: `stream` (default) streams the audio bytes directly in the response body (or returns inline base64 JSON when `timestamp_granularities` is nonempty). `url` stores the generated audio in OpenRouter storage and returns a JSON response with a signed download `url`, `expires_at`, and `media_type` (plus `words` and/or `characters` when `timestamp_granularities` is nonempty). The URL is a bearer link: anyone holding it can download the audio until it expires, up to 24 hours after the audio was stored (use `expires_at`); the stored copy is deleted by the storage lifecycle within the following day. When a URL cannot be issued (zero-data-retention via account settings, guardrails, `provider.zdr`, or a ZDR endpoint; no workspace; or storage failure), untimed requests fall back to streaming raw audio bytes (except on a storage failure for responses larger than 10 MiB, which returns an error), and timed requests fall back to inline base64 JSON (`{audio, media_type, words?, characters?}`) with no `url`. :param provider: Provider configuration: provider routing preferences (`order`, `only`, `ignore`, `allow_fallbacks`), data policy routing preferences (`zdr`, `data_collection`) and provider-specific passthrough options diff --git a/uv.lock b/uv.lock index 5d52a9ce2..39816d8da 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.239" +version = "1.3.240" source = { editable = "." } dependencies = [ { name = "httpcore" },