From 33901fd5fe9cfac815bbd55241d429342c96ffea Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 19 Nov 2026 15:14:47 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.tts.list_models()`: **Added** * `open_router.tts.get_model()`: **Added** --- .speakeasy/gen.lock | 248 ++++++- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 630 ++++++++++++++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/audioenum.mdx | 22 + docs/components/references.mdx | 17 + docs/components/speechenumparameter.mdx | 10 + docs/components/speechenumparametertype.mdx | 15 + docs/components/speechinputmodality.mdx | 27 + docs/components/speechinputmodalityaudio.mdx | 10 + docs/components/speechinputmodalityimage.mdx | 10 + docs/components/speechinputmodalitytext.mdx | 13 + .../speechinputmodalitytypeimage.mdx | 15 + .../speechinputmodalitytypetext.mdx | 15 + docs/components/speechmodelendpoint.mdx | 15 + docs/components/speechmodelresponse.mdx | 18 + docs/components/speechmodelslistresponse.mdx | 12 + docs/components/speechoutputmodality.mdx | 10 + docs/components/speechoutputmodalitytype.mdx | 15 + docs/components/speechrangeparameter.mdx | 14 + docs/components/speechrangeparametertype.mdx | 15 + docs/components/speechreferencecount.mdx | 11 + docs/components/speechreferencecounttype.mdx | 15 + docs/components/speechsupportedparameters.mdx | 12 + docs/components/speechunknownparameter.mdx | 9 + .../components/speechunknownparametertype.mdx | 15 + docs/components/speechvoiceparameter.mdx | 14 + docs/components/speechvoiceparametertype.mdx | 20 + docs/components/supportedinputs1.mdx | 12 + docs/components/supportedinputs2.mdx | 10 + docs/components/turns.mdx | 22 + docs/components/typeaudio.mdx | 15 + docs/operations/getspeechmodelglobals.mdx | 11 + docs/operations/getspeechmodelrequest.mdx | 13 + docs/operations/listspeechmodelsglobals.mdx | 11 + docs/operations/listspeechmodelsrequest.mdx | 11 + docs/sdks/tts/README.mdx | 95 +++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 151 +++++ .../components/speechenumparameter.py | 20 + .../components/speechinputmodality.py | 186 ++++++ .../components/speechmodelendpoint.py | 33 + .../components/speechmodelresponse.py | 45 ++ .../components/speechmodelslistresponse.py | 19 + .../components/speechoutputmodality.py | 24 + .../components/speechrangeparameter.py | 27 + .../components/speechreferencecount.py | 40 ++ .../components/speechsupportedparameters.py | 51 ++ .../components/speechunknownparameter.py | 17 + .../components/speechvoiceparameter.py | 56 ++ src/openrouter/operations/__init__.py | 28 + src/openrouter/operations/getspeechmodel.py | 151 +++++ src/openrouter/operations/listspeechmodels.py | 137 ++++ src/openrouter/tts.py | 514 ++++++++++++++ uv.lock | 2 +- 57 files changed, 2927 insertions(+), 31 deletions(-) create mode 100644 docs/components/audioenum.mdx create mode 100644 docs/components/references.mdx create mode 100644 docs/components/speechenumparameter.mdx create mode 100644 docs/components/speechenumparametertype.mdx create mode 100644 docs/components/speechinputmodality.mdx create mode 100644 docs/components/speechinputmodalityaudio.mdx create mode 100644 docs/components/speechinputmodalityimage.mdx create mode 100644 docs/components/speechinputmodalitytext.mdx create mode 100644 docs/components/speechinputmodalitytypeimage.mdx create mode 100644 docs/components/speechinputmodalitytypetext.mdx create mode 100644 docs/components/speechmodelendpoint.mdx create mode 100644 docs/components/speechmodelresponse.mdx create mode 100644 docs/components/speechmodelslistresponse.mdx create mode 100644 docs/components/speechoutputmodality.mdx create mode 100644 docs/components/speechoutputmodalitytype.mdx create mode 100644 docs/components/speechrangeparameter.mdx create mode 100644 docs/components/speechrangeparametertype.mdx create mode 100644 docs/components/speechreferencecount.mdx create mode 100644 docs/components/speechreferencecounttype.mdx create mode 100644 docs/components/speechsupportedparameters.mdx create mode 100644 docs/components/speechunknownparameter.mdx create mode 100644 docs/components/speechunknownparametertype.mdx create mode 100644 docs/components/speechvoiceparameter.mdx create mode 100644 docs/components/speechvoiceparametertype.mdx create mode 100644 docs/components/supportedinputs1.mdx create mode 100644 docs/components/supportedinputs2.mdx create mode 100644 docs/components/turns.mdx create mode 100644 docs/components/typeaudio.mdx create mode 100644 docs/operations/getspeechmodelglobals.mdx create mode 100644 docs/operations/getspeechmodelrequest.mdx create mode 100644 docs/operations/listspeechmodelsglobals.mdx create mode 100644 docs/operations/listspeechmodelsrequest.mdx create mode 100644 src/openrouter/components/speechenumparameter.py create mode 100644 src/openrouter/components/speechinputmodality.py create mode 100644 src/openrouter/components/speechmodelendpoint.py create mode 100644 src/openrouter/components/speechmodelresponse.py create mode 100644 src/openrouter/components/speechmodelslistresponse.py create mode 100644 src/openrouter/components/speechoutputmodality.py create mode 100644 src/openrouter/components/speechrangeparameter.py create mode 100644 src/openrouter/components/speechreferencecount.py create mode 100644 src/openrouter/components/speechsupportedparameters.py create mode 100644 src/openrouter/components/speechunknownparameter.py create mode 100644 src/openrouter/components/speechvoiceparameter.py create mode 100644 src/openrouter/operations/getspeechmodel.py create mode 100644 src/openrouter/operations/listspeechmodels.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 0a4a1644f..9e5808794 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: 5928953dfb1f69885a3505a285a82551 + docChecksum: 41d402151c64afa63371e5c2ef3d573b docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.194 - configChecksum: b43dffaedfc8522b9da28d1e82a8f7c3 + releaseVersion: 1.3.195 + configChecksum: 90d218c3bfee2162397b761f542cb95e repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 2d1e3ed5-8d10-4fc5-9f5b-89ac64d3d571 - pristine_commit_hash: 02244129e7485babfd19411babf519c5db84cc25 - pristine_tree_hash: 43bd2ee7a17b41c2b5571cb7efceeb2a7b0d5862 + generation_id: 009b948e-a799-4e4e-bcb6-76a1b73451be + pristine_commit_hash: d1a5a3d7060477c1cabd81e7cc8780ea64e2319d + pristine_tree_hash: 82465578defaab6ded2569774b8a9b849f7602bd features: python: acceptHeaders: 3.0.0 @@ -1346,6 +1346,10 @@ trackedFiles: id: 95fff54d2a97 last_write_checksum: sha1:b31d52d6031e10053c6382f766d6e3a18f6f78d7 pristine_git_object: 1736fc3d8cf14e38ff3938d3dd452ff2d89eaf29 + docs/components/audioenum.mdx: + id: c19d90f992a5 + last_write_checksum: sha1:17a6b1628b5645e6a8bd5eba0344572fbe0bef03 + pristine_git_object: 0bde2a43c5a7940888df46dac9ba5ab3669185a6 docs/components/audiopcm1.mdx: id: 0d9e561d3657 last_write_checksum: sha1:512956fbe16e68404df957e4893c51212680706b @@ -7678,6 +7682,10 @@ trackedFiles: id: 889d0f7c9bbf last_write_checksum: sha1:1091eddb7370abadf0cb898eb82439ea67932b82 pristine_git_object: 9724b529b0c42063dd25638672fbe19249b4520a + docs/components/references.mdx: + id: 8bd109185ec7 + last_write_checksum: sha1:f78eaf242fff1501118a6dfa03588f805e9a7862 + pristine_git_object: 02f51497f93aea4df991eca3a914ebac218496a8 docs/components/refusal.mdx: id: a8fdf8720280 last_write_checksum: sha1:442c53119ab4c56872599d58b7298d8a7ad5e5f3 @@ -8102,10 +8110,42 @@ trackedFiles: id: 77262fe83449 last_write_checksum: sha1:9f290862f832b501a96456226ff1f18431f74c50 pristine_git_object: 5d617cac37f7b364f4dd0640246e97c34351d824 + docs/components/speechenumparameter.mdx: + id: 71e037f30305 + last_write_checksum: sha1:91762d697678879c0c55162ec1090faba5003a2a + pristine_git_object: ee8c8a63655e2c42da359a2597d494396d2b2c4d + docs/components/speechenumparametertype.mdx: + id: 032be9391ba1 + last_write_checksum: sha1:d7f2962bdc52ccf85ffdbb17fe1d4e02a57798e3 + pristine_git_object: edbaa3cf98b346a5f1c3693a464f623f1428e04a docs/components/speechinput.mdx: id: 663248d32888 last_write_checksum: sha1:801f7658532bb7ffebc7ea38e142eb1c9302d77b pristine_git_object: 5d2f88829becfc0307674fce87660e96744b7a2e + docs/components/speechinputmodality.mdx: + id: 74665b26b41d + last_write_checksum: sha1:fbd1f49f5f591486ee0b112f1829bd57eade2f61 + pristine_git_object: 73d08f72f390b4a8fbd9c8da60237c41a2522f24 + docs/components/speechinputmodalityaudio.mdx: + id: 67f693a9a81e + last_write_checksum: sha1:619df9ac1621c3529b4ab334363ad4fe3c2f89f5 + pristine_git_object: c5d5181628e63cc83a3b58a290ff7a72030fedb8 + docs/components/speechinputmodalityimage.mdx: + id: 3b669f1d4e68 + last_write_checksum: sha1:9fd33249b3c9e4f1bd1440925fde2a38fc54c941 + pristine_git_object: 1e5957cbdaf78c17946e97436561a126fe35ad8f + docs/components/speechinputmodalitytext.mdx: + id: bc020871a6bd + last_write_checksum: sha1:f6663f63dee7bcc357c1453fd3b7986921195dce + pristine_git_object: 6c63a5e463dc2a29e007a5a828028f620510554e + docs/components/speechinputmodalitytypeimage.mdx: + id: 8bac859c79e5 + last_write_checksum: sha1:ddd77d0ec56c3f7d5467eead7256900c74488c86 + pristine_git_object: 6aa1bd5d942bfe890f26805d19fb2b745db8e0c1 + docs/components/speechinputmodalitytypetext.mdx: + id: 47c7ef08dc97 + last_write_checksum: sha1:5ac975e782a6cfc85be9b3261d7bc593af72de8c + pristine_git_object: 8c006e8a55b7fe67bc1f7d73cd6af002747ce36f docs/components/speechinputreference.mdx: id: eb5af16936c7 last_write_checksum: sha1:ab545b03da2161ae1ad449714b6861cd55ae66df @@ -8142,6 +8182,42 @@ trackedFiles: id: 469b6fa8fe52 last_write_checksum: sha1:47783070359618513e2d6c3b963e507cf1320b70 pristine_git_object: 34f4f07fb3008df83646fa3d88ce04009274246a + docs/components/speechmodelendpoint.mdx: + id: b8c3e3b45e5c + last_write_checksum: sha1:5282f90e9496c119040eb10205ee6ed252be1945 + pristine_git_object: 7bbe4ebda74113532de172ad89d48f8e211d5f2c + docs/components/speechmodelresponse.mdx: + id: c0afc6a018ec + last_write_checksum: sha1:409cec1889e289e6c2cba19fb113770ded881a71 + pristine_git_object: 7812507d0ed0c6efc27baed86c28de94743596a3 + docs/components/speechmodelslistresponse.mdx: + id: e555fc233009 + last_write_checksum: sha1:80403a19f6c809511249b9f6e068db5a154732cd + pristine_git_object: f1efb6365d56d846e102d1b665590f58a6899211 + docs/components/speechoutputmodality.mdx: + id: a3a222faacda + last_write_checksum: sha1:911465c8337674c171ca63ddb45289a60e560cd0 + pristine_git_object: e4cd60f7e5bfee0ce852d4c7c2bebb1b61e7e9cc + docs/components/speechoutputmodalitytype.mdx: + id: bc216dcb8091 + last_write_checksum: sha1:201cce4f72878e6efd47edf139626c1e02eab816 + pristine_git_object: 18a2ac290e361478cfa086f9af4ddcc35a0514a9 + docs/components/speechrangeparameter.mdx: + id: 83dca48302c9 + last_write_checksum: sha1:16048d8ab06442c78eadc8094e06bfb0d5f530c4 + pristine_git_object: 80dcae8311910562ef4de224356f307267212199 + docs/components/speechrangeparametertype.mdx: + id: 705d6c6f7442 + last_write_checksum: sha1:087bc5fa81d9975a5eef610d489bc5fda52b54e6 + pristine_git_object: 584aac82fe2cb2431d61b28c88148849d9455bb8 + docs/components/speechreferencecount.mdx: + id: f9ea252d5fa5 + last_write_checksum: sha1:4925796f7013f6600dd5b6cec155da65561ff5e5 + pristine_git_object: 9db0dfbf85b0cc1c5c32eca0f33d543e8ffa88d8 + docs/components/speechreferencecounttype.mdx: + id: 4d51d01cf822 + last_write_checksum: sha1:ba61e49ccb7316ac1047d49e5cb052ffcf6e463a + pristine_git_object: 38be122fce694e660cd56d82182dd3d15098479d docs/components/speechrequest.mdx: id: 06e81b0433f6 last_write_checksum: sha1:474e3a8e5258c76ba6a915d86da615951fc5d572 @@ -8170,10 +8246,30 @@ trackedFiles: id: bd09f77a4a90 last_write_checksum: sha1:1b87242f33c6d22a08dd085d0ef41335ec2e9b0c pristine_git_object: 9af8a5aa6a7c26f353f552d369b87debb045b7cd + docs/components/speechsupportedparameters.mdx: + id: e40d7c8fb1e4 + last_write_checksum: sha1:4d1613b404212e0367e88c6166140da61acb2364 + pristine_git_object: cb48009012c716967e1132856e59f54f95bb07c5 docs/components/speechturn.mdx: id: ca90a4443e6e last_write_checksum: sha1:68b0e3750740ff2ff4a34a5dd0a0f5a191e514f1 pristine_git_object: a725c6a19408d3429d08e3e24922be43905a9c13 + docs/components/speechunknownparameter.mdx: + id: a1de8c8c32b8 + last_write_checksum: sha1:c3ba1596c1159b39a5311c260e769dd576436479 + pristine_git_object: 7405144f509e378f06330c5512df22f0292f1059 + docs/components/speechunknownparametertype.mdx: + id: 0081e8495515 + last_write_checksum: sha1:2baad72f1b8a30c760fde2740f8e5b394d07d04e + pristine_git_object: 283b960830b3122c252035918afe8f1ef65b845f + docs/components/speechvoiceparameter.mdx: + id: 9040706385a9 + last_write_checksum: sha1:83c5a7d2c4b341b6035b3767ff4655dc919cc04e + pristine_git_object: ff2bc2e428ddd77d353b223b367a955391d46f90 + docs/components/speechvoiceparametertype.mdx: + id: aa0d5a2ff33d + last_write_checksum: sha1:3e964c72370b48d3bc1e4a81648e7d8e4dfd3fc4 + pristine_git_object: c53627eada1476b930df8019529bab065ddecc7d docs/components/speed.mdx: id: 4fd1f2823924 last_write_checksum: sha1:c6815d115b55b9409052f9d1d1d16bb1d7197763 @@ -8414,6 +8510,14 @@ trackedFiles: id: f34dfb27d78f last_write_checksum: sha1:a979de72a67038af692d17cdb379b1d58e7ad0c8 pristine_git_object: 64a19c185569b50eb0a3363b472c1c28807493f2 + docs/components/supportedinputs1.mdx: + id: 5c7328c325cf + last_write_checksum: sha1:ec10c636a26ee8e43f7ffa8e7c348b4113686625 + pristine_git_object: f9553dd27688e22f25128da2f5ff1a238217a844 + docs/components/supportedinputs2.mdx: + id: 95aa9b0b814e + last_write_checksum: sha1:ecf0cb27ad72d91c5337f1e1d7c8f7bfeb601237 + pristine_git_object: 9e517d78bd7a8ddc889d33e4813952b6c76764fc docs/components/supportedresolution.mdx: id: 4dab32379c4d last_write_checksum: sha1:0df389c4bfbe7f608751121a9d93b6ddb5838b87 @@ -8750,6 +8854,10 @@ trackedFiles: id: d4f863eecbe8 last_write_checksum: sha1:3cc0bd9a3336447a3ba36639b4af2dff530d33ac pristine_git_object: f713faa59d39701cafff13c07ed8995782187bd7 + docs/components/turns.mdx: + id: 4099fd10a80a + last_write_checksum: sha1:e6271ddf9ef719d78bd8e30bd5b8e9293b4db23c + pristine_git_object: 2ae9b4af3b22e0990b651b7c0168af15edb27859 docs/components/type.mdx: id: d15dd4f8a580 last_write_checksum: sha1:9ab10f9a767e94d7da3f931b62a4f5bc36da9e4c @@ -8778,6 +8886,10 @@ trackedFiles: id: b3bd6b0de96e last_write_checksum: sha1:7d4c65b6740216e057d36ea498509249d9c97354 pristine_git_object: 658b179115ff4db7f09c792544b5fae73a480520 + docs/components/typeaudio.mdx: + id: 1368b3bf77e0 + last_write_checksum: sha1:ce571623ad065e5504b139520cd6afcf728349fc + pristine_git_object: 9741986e74b7090247f827237f3900792050ba95 docs/components/typeavailable.mdx: id: 497347c01b9b last_write_checksum: sha1:05e7d05deed0895cb806dcccf13c8b5005d6331d @@ -10590,6 +10702,14 @@ trackedFiles: id: 2a527f1c393c last_write_checksum: sha1:9559722741ca45824a4c91bf523dfa2b75d9f1f3 pristine_git_object: f29108d61e7461346daeee8acf9bb26f52115312 + docs/operations/getspeechmodelglobals.mdx: + id: df6202f24875 + last_write_checksum: sha1:f05e15e0dde0409ac9b54e369276439a18a4cccd + pristine_git_object: db07aad96c4f97e814b141518782769d4f378b7a + docs/operations/getspeechmodelrequest.mdx: + id: cf33ff53d12a + last_write_checksum: sha1:323685a89f0ecf6dab575e72071d823e6ed387ef + pristine_git_object: 591b2b79e3c2fd83a6fee7d76679a56b08c7422f docs/operations/gettaskclassificationsglobals.mdx: id: 14d0010b40f8 last_write_checksum: sha1:526ef5fab3ed3773bf205252dc3732e5a2d1d4a2 @@ -11110,6 +11230,14 @@ trackedFiles: id: b763a3eaa70b last_write_checksum: sha1:246b6d9bb45198398a6fc3840164c2e70bfaf2e6 pristine_git_object: 7d77c461db62d65a8ede454c9b3322b01a52c4be + docs/operations/listspeechmodelsglobals.mdx: + id: c02b33cf5aa4 + last_write_checksum: sha1:43394566d6cd00506e365b341210d677b7e76292 + pristine_git_object: 03bb85e638f48efbcbe669aaf18c555580868b14 + docs/operations/listspeechmodelsrequest.mdx: + id: 6b0267d50573 + last_write_checksum: sha1:3f955fab123e059aed1144343d01e7872f92d860 + pristine_git_object: 491e743d69a97bda7428069521f6bfb001d94b6a docs/operations/listtoolsglobals.mdx: id: a03447166c23 last_write_checksum: sha1:77ccb3b0c9aa914fb39c3cd0bb7f4f4b45e59c1e @@ -11676,8 +11804,8 @@ trackedFiles: pristine_git_object: bcbe30fccceb97caa3a0e170038245dcc7f1e540 docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:565dd7f195ede7af7b6ef48157c6d82e5246c146 - pristine_git_object: 8a6d1a137c5b40bf3d65cee47de940370bf0daed + last_write_checksum: sha1:d153a25bafea3b9ec7a083ad0a352bc3682b4b16 + pristine_git_object: 0addd5d2acf64d1e0b7aed00f445f930affea1f8 docs/sdks/vault/README.mdx: id: 3738c6722acd last_write_checksum: sha1:290b439ff730b9eabf4a6ef93737d1c61006b0fa @@ -11696,8 +11824,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:4cc6ef7b624ab0b56e02154fbba11d3be76f0a31 - pristine_git_object: c30b65628bc4a3a5a57d3d10487d93847245f528 + last_write_checksum: sha1:294e7cefe0396a8cef9e5a7e2ec903b49845eba5 + pristine_git_object: 727db44388706e0efc292530827ea0b0209a228c scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11724,8 +11852,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:16288773611768ebe415309bd8736c9e27a0bbe3 - pristine_git_object: 0732c7cec623b1fea863a251926f1454d1bdaa42 + last_write_checksum: sha1:c8d57dc48762728c84f8c37c698a081d63c2616e + pristine_git_object: da165f5ad0843b54a96396a8c681c3dd2db6a5cc src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -11772,8 +11900,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:07b08d642682f126555eab11a3c87b956e80348f - pristine_git_object: a3ca8f5cb158649ab5214cba5f03b0c1af501329 + last_write_checksum: sha1:dcde151db91a9baa7c7285a403a18e948935cad8 + pristine_git_object: fa9b11cb967ad7ed5c53f429979cd9fbcc52d57a src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:08125e1d60df82793e11e8aed6e3c9fdb7512ebb @@ -15066,10 +15194,18 @@ trackedFiles: id: 6d6e8d7d80ad last_write_checksum: sha1:d065afdd505a8303f6ba8e268cef42a3e9ea39fb pristine_git_object: 418953ba7366a6015934bf8795178d79adb03b89 + src/openrouter/components/speechenumparameter.py: + id: edfe3e5c287c + last_write_checksum: sha1:dec28c479253e9fce17078fb08d77872ea447229 + pristine_git_object: 2892182b8d9e834cf37731e18dfe645b22d7bd06 src/openrouter/components/speechinput.py: id: 14e46bea4b32 last_write_checksum: sha1:511d19d682544c5e51c2995ae3c2a3dda6349c13 pristine_git_object: cc45b6da88350cd9ab4b9c6456b5dd81c0b4c8e9 + src/openrouter/components/speechinputmodality.py: + id: d475c5a1288b + last_write_checksum: sha1:d7cb1c376050175c0bb863d19e4a9e5d28097ff3 + pristine_git_object: 1b218efd1773d5badce422f442a00d69236c681a src/openrouter/components/speechinputreference.py: id: 8e2b63f83354 last_write_checksum: sha1:b2ebc68fae64644f8bfca9b555ca7d2a7b46c9e1 @@ -15094,14 +15230,50 @@ trackedFiles: id: d9cd9e42ac40 last_write_checksum: sha1:3acdadbccb53ffe81cf7221c5f13ef031436adb7 pristine_git_object: 4633e5d7658c500aa903ce8caa8ef86cc97b78eb + src/openrouter/components/speechmodelendpoint.py: + id: cdf152283ac0 + last_write_checksum: sha1:5d1962f7fb2afc314002734dd3fbb7bcc2307fe7 + pristine_git_object: 874f71c5697a86e0af69ee2e11854edf17bbf4a4 + src/openrouter/components/speechmodelresponse.py: + id: 0aab9b3236ac + last_write_checksum: sha1:0519e1411f11ea5c375d69836fad987e2705d381 + pristine_git_object: b5a75e72f82dfe495b3c43aaa98af31218b17e3f + src/openrouter/components/speechmodelslistresponse.py: + id: 3ae706aadf41 + last_write_checksum: sha1:4483c4675bf16b78e421bc02021d8d52badc735e + pristine_git_object: e25941ae3887aa19695261e2d3e3e512363a3503 + src/openrouter/components/speechoutputmodality.py: + id: 3c5e674ca4df + last_write_checksum: sha1:10d6d66d75ebb5d03d334d7d0c256c3f3c9343d7 + pristine_git_object: 40509b5004357d4359679a94cfff7a4272a4b3a2 + src/openrouter/components/speechrangeparameter.py: + id: 304a657ec76c + last_write_checksum: sha1:41173c24c432ae65c0db63825b601468e2edbe3a + pristine_git_object: f25b8fcc2ea2d785456f7cced31090170fc4ea7f + src/openrouter/components/speechreferencecount.py: + id: f46b63b7642d + last_write_checksum: sha1:f572edd57b5547ccb93ee07ae88875caeaced508 + pristine_git_object: 69c0355e7d575e6b7c52183d3cd5696611e4e8bf src/openrouter/components/speechrequest.py: id: 2a9400167112 last_write_checksum: sha1:cf22dbaca7ef549f6f5baf48b5e9f95cbfdceeb0 pristine_git_object: 9ba3e70a09cd8bbae8b8fc995237e60566549a88 + src/openrouter/components/speechsupportedparameters.py: + id: 618f33cc9229 + last_write_checksum: sha1:9c152515a0cedad80d796c8981df706c08746d45 + pristine_git_object: cbb22d167e87004e1ab1b6e625ce3a2700d3d77c src/openrouter/components/speechturn.py: id: 121e0a940f91 last_write_checksum: sha1:31bdba00e027b81de8a3872d48e694475cf02e7a pristine_git_object: d3e0e4be8c2b3fcc3427657d9c6eb162031b118a + src/openrouter/components/speechunknownparameter.py: + id: 5b3b05a92fe9 + last_write_checksum: sha1:f3349a46c0ae81368af102d36216e742cc41f2e9 + pristine_git_object: c28ec9144c59a0564086f79596a58ead8adfda31 + src/openrouter/components/speechvoiceparameter.py: + id: a6696a7b92e3 + last_write_checksum: sha1:054fae68651736db2dfcebdb5bc15a718c7bb58a + pristine_git_object: 85881124e624a1e84cb9adfbbddb6b604df791ab src/openrouter/components/stopservertoolswhencondition.py: id: 2deeda4209ac last_write_checksum: sha1:581e0ee62776d42bf598b9f68b998faabfecd3ce @@ -15820,8 +15992,8 @@ trackedFiles: pristine_git_object: dd8a6eccda3fb29e478c0edef674bd491a1dad24 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:698becc71b7c317e30a1849cd5ecd6b4fba66051 - pristine_git_object: a20109487634a5025d8e33f0c04e62637c90cd56 + last_write_checksum: sha1:7c25d7304f0298876943ea893583c17e1ae537d1 + pristine_git_object: 70bc0a74a8ca60f3cdd4be4b64be3c93eed441f7 src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -16202,6 +16374,10 @@ trackedFiles: id: d01a691a6603 last_write_checksum: sha1:aa6af6b0570292ca32e27400e4278ce0b21b3bce pristine_git_object: 7a5e3e1cf09fcd3ac3a50b8f5790a1d6f35e5381 + src/openrouter/operations/getspeechmodel.py: + id: ac45380d02d5 + last_write_checksum: sha1:f59076274a0038fc6f51327949724e992aef6ec3 + pristine_git_object: 2a9f4fcb2aa9670b1f417df4288d2aa12da2c195 src/openrouter/operations/gettaskclassifications.py: id: ba6156d68acf last_write_checksum: sha1:c569572d21aa766ac542d5c535208e8b1caae503 @@ -16370,6 +16546,10 @@ trackedFiles: id: 9f32309bb157 last_write_checksum: sha1:2319b023e5e8bd308df04a66e535edc2ffaa289d pristine_git_object: ac0de5426e797ff26d835fd88c0a4d7cb86844d3 + src/openrouter/operations/listspeechmodels.py: + id: bf5b66c7f12a + last_write_checksum: sha1:8c47519eff2a15a328928ab86f2f831b32754dbd + pristine_git_object: a9365d3cf407a698a708176f25a918590e82b63d src/openrouter/operations/listtools.py: id: e8a478b7266e last_write_checksum: sha1:6170d2c5211602d778c9bca2a9f637ef240b13cc @@ -16552,8 +16732,8 @@ trackedFiles: pristine_git_object: 701fa8597ff85f41a60736ade55fcb32f9ec7125 src/openrouter/tts.py: id: 5055d4b95f1d - last_write_checksum: sha1:8dd6960ade426953bcb7ffc6be108ed8d1a22af4 - pristine_git_object: f0867ac9f9e12e5b754e8e8de1c443e258d2cdff + last_write_checksum: sha1:6dc3d10fc7e927122eb139d65c9fea7cf534a9a4 + pristine_git_object: b9ee475523057e41efd726e86150e9e88a83b073 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -21746,8 +21926,36 @@ examples: application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listSpeechModels: + speakeasy-default-list-speech-models: + responses: + "200": + application/json: {"data": [{"created": 1742428800, "description": "Text-to-speech model with steerable delivery.", "endpoints": [{"input_modalities": [{"type": "text"}], "output_modalities": [{"supported_parameters": {}, "type": "speech"}], "provider_name": "OpenAI", "provider_slug": "openai"}], "id": "openai/gpt-4o-mini-tts", "input_modalities": [{"type": "text"}], "name": "OpenAI: GPT-4o mini TTS", "output_modalities": [{"supported_parameters": {}, "type": "speech"}]}]} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + getSpeechModel: + speakeasy-default-get-speech-model: + parameters: + path: + author: "openai" + slug: "gpt-4o-mini-tts" + responses: + "200": + application/json: {"created": 1742428800, "description": "Text-to-speech model with steerable delivery.", "endpoints": [{"input_modalities": [{"type": "text"}], "output_modalities": [{"supported_parameters": {}, "type": "speech"}], "provider_name": "OpenAI", "provider_slug": "openai"}], "id": "openai/gpt-4o-mini-tts", "input_modalities": [{"type": "text"}], "name": "OpenAI: GPT-4o mini TTS", "output_modalities": [{"supported_parameters": {}, "type": "speech"}]} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.stt.create_transcription()`: `request.prompt` **Added** - * `open_router.stt.create_transcription_multipart()`: `request.prompt` **Added** + * `open_router.tts.list_models()`: **Added** + * `open_router.tts.get_model()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0c94cab11..d0b4c7c41 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.194 + version: 1.3.195 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 991f9fe5d..ac3584c91 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -34269,6 +34269,25 @@ components: oneOf: - $ref: '#/components/schemas/ContainerAutoEnvironment' - $ref: '#/components/schemas/ContainerReferenceEnvironment' + SpeechEnumParameter: + example: + type: 'enum' + values: + - 'alloy' + - 'coral' + properties: + type: + enum: + - 'enum' + type: 'string' + values: + items: + type: 'string' + type: 'array' + required: + - 'type' + - 'values' + type: 'object' SpeechInput: anyOf: - type: 'string' @@ -34278,6 +34297,67 @@ components: type: 'array' 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.' + example: + type: 'text' + oneOf: + - description: 'The `input` text.' + properties: + turns: + description: '`optional`: `input` may also be a multi-speaker turn array, which cannot be combined with `input_references`. `required`: `input` must be a turn array with at least two distinct voices. Absent: `input` is a string.' + enum: + - 'required' + - 'optional' + type: 'string' + x-speakeasy-unknown-values: allow + type: + enum: + - 'text' + type: 'string' + required: + - 'type' + type: 'object' + - properties: + supported_inputs: + description: '`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder.' + properties: + references: + $ref: '#/components/schemas/SpeechReferenceCount' + required: + - 'references' + type: 'object' + type: + enum: + - 'audio' + type: 'string' + required: + - 'type' + - 'supported_inputs' + type: 'object' + - properties: + supported_inputs: + properties: + audio: + description: '`required`: an image reference is accepted only together with an audio reference. `excluded`: only without one. Absent: either.' + enum: + - 'required' + - 'excluded' + type: 'string' + x-speakeasy-unknown-values: allow + references: + $ref: '#/components/schemas/SpeechReferenceCount' + required: + - 'references' + type: 'object' + type: + enum: + - 'image' + type: 'string' + required: + - 'type' + - 'supported_inputs' + type: 'object' SpeechInputReference: description: 'Reference content part for stateless voice cloning or voice design' discriminator: @@ -34383,6 +34463,263 @@ components: - 'type' - 'text' type: 'object' + SpeechModelEndpoint: + description: 'One endpoint serving a speech model, with the inputs and parameters it accepts.' + example: + input_modalities: + - type: 'text' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + provider_name: 'OpenAI' + provider_slug: 'openai' + properties: + input_modalities: + items: + $ref: '#/components/schemas/SpeechInputModality' + type: 'array' + output_modalities: + items: + $ref: '#/components/schemas/SpeechOutputModality' + type: 'array' + provider_name: + description: 'Provider display name' + example: 'OpenAI' + type: 'string' + provider_slug: + description: 'Provider slug' + example: 'openai' + type: 'string' + required: + - 'provider_name' + - 'provider_slug' + - 'input_modalities' + - 'output_modalities' + type: 'object' + SpeechModelResponse: + description: 'A text-to-speech model. Its members are the envelope of its endpoints'': enums are unioned and ranges widened, so a value inside a range may be accepted by no single endpoint. Each record in `endpoints` lists exactly what that endpoint accepts.' + example: + created: 1742428800 + description: 'Text-to-speech model with steerable delivery.' + endpoints: + - input_modalities: + - type: 'text' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + provider_name: 'OpenAI' + provider_slug: 'openai' + id: 'openai/gpt-4o-mini-tts' + input_modalities: + - type: 'text' + name: 'OpenAI: GPT-4o mini TTS' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + properties: + created: + description: 'Unix timestamp (seconds) of when the model was created' + type: 'integer' + description: + type: 'string' + endpoints: + description: 'Each endpoint serving the model, with exactly the inputs and parameters it accepts. Some endpoints route only after the caller accepts a provider requirement such as a self-attestation; until then, a request to them is rejected with a 403 that names the requirement.' + items: + $ref: '#/components/schemas/SpeechModelEndpoint' + type: 'array' + id: + description: 'Model slug' + example: 'openai/gpt-4o-mini-tts' + type: 'string' + input_modalities: + items: + $ref: '#/components/schemas/SpeechInputModality' + type: 'array' + name: + example: 'OpenAI: GPT-4o mini TTS' + type: 'string' + output_modalities: + items: + $ref: '#/components/schemas/SpeechOutputModality' + type: 'array' + required: + - 'id' + - 'name' + - 'description' + - 'created' + - 'input_modalities' + - 'output_modalities' + - 'endpoints' + type: 'object' + SpeechModelsListResponse: + description: 'List of text-to-speech models, each with its endpoints.' + example: + data: + - created: 1742428800 + description: 'Text-to-speech model with steerable delivery.' + endpoints: + - input_modalities: + - type: 'text' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + provider_name: 'OpenAI' + provider_slug: 'openai' + id: 'openai/gpt-4o-mini-tts' + input_modalities: + - type: 'text' + name: 'OpenAI: GPT-4o mini TTS' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + properties: + data: + items: + $ref: '#/components/schemas/SpeechModelResponse' + type: 'array' + required: + - 'data' + type: 'object' + SpeechOutputModality: + example: + supported_parameters: + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + properties: + supported_parameters: + $ref: '#/components/schemas/SpeechSupportedParameters' + type: + enum: + - 'speech' + type: 'string' + required: + - 'type' + - 'supported_parameters' + type: 'object' + SpeechRangeParameter: + description: 'The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`.' + example: + max: 4 + min: 0.25 + type: 'range' + properties: + max: + format: 'double' + type: 'number' + min: + format: 'double' + type: 'number' + type: + enum: + - 'range' + type: 'string' + required: + - 'type' + - 'min' + - 'max' + type: 'object' + SpeechReferenceCount: + example: + max: 1 + min: 1 + type: 'integer' + properties: + max: + type: 'integer' + min: + type: 'integer' + type: + enum: + - 'integer' + type: 'string' + required: + - 'type' + - 'min' + type: 'object' SpeechRequest: description: 'Text-to-speech request input' example: @@ -34513,6 +34850,34 @@ components: - 'model' - 'input' type: 'object' + SpeechSupportedParameters: + example: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + properties: + instructions: + $ref: '#/components/schemas/SpeechUnknownParameter' + response_format: + $ref: '#/components/schemas/SpeechEnumParameter' + speed: + $ref: '#/components/schemas/SpeechRangeParameter' + voice: + $ref: '#/components/schemas/SpeechVoiceParameter' + type: 'object' SpeechTurn: properties: instructions: @@ -34531,6 +34896,43 @@ components: required: - 'text' type: 'object' + SpeechUnknownParameter: + example: + type: 'unknown' + properties: + type: + enum: + - 'unknown' + type: 'string' + required: + - 'type' + type: 'object' + SpeechVoiceParameter: + description: '`enum` lists the documented voices in `values`; some providers also accept voice IDs not listed there (custom or cloned voices). `unknown` means the field is accepted but no voices are listed.' + example: + type: 'enum' + values: + - 'alloy' + - 'coral' + properties: + references: + description: '`excluded`: `voice` is rejected when the request also sends a nonempty `input_references`. Absent: they can be combined.' + enum: + - 'excluded' + type: 'string' + type: + enum: + - 'enum' + - 'unknown' + type: 'string' + x-speakeasy-unknown-values: allow + values: + items: + type: 'string' + type: 'array' + required: + - 'type' + type: 'object' StopServerToolsWhen: description: 'Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.' example: @@ -41190,6 +41592,234 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /audio/speech/models: + get: + description: 'Lists every text-to-speech model with the inputs it accepts and its speech output parameters, merged across its endpoints, plus each endpoint with its own.' + operationId: 'listSpeechModels' + responses: + '200': + content: + application/json: + example: + data: + - created: 1742428800 + description: 'Text-to-speech model with steerable delivery.' + endpoints: + - input_modalities: + - type: 'text' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + provider_name: 'OpenAI' + provider_slug: 'openai' + id: 'openai/gpt-4o-mini-tts' + input_modalities: + - type: 'text' + name: 'OpenAI: GPT-4o mini TTS' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + schema: + $ref: '#/components/schemas/SpeechModelsListResponse' + description: 'List of text-to-speech models' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + security: [] + summary: 'List text-to-speech models' + tags: + - 'TTS' + x-speakeasy-name-override: 'listModels' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /audio/speech/models/{author}/{slug}: + get: + description: 'Returns a text-to-speech model with each endpoint''s own inputs and speech output parameters.' + operationId: 'getSpeechModel' + parameters: + - description: 'Model author/organization' + in: 'path' + name: 'author' + required: true + schema: + description: 'Model author/organization' + example: 'openai' + type: 'string' + - description: 'Model slug' + in: 'path' + name: 'slug' + required: true + schema: + description: 'Model slug' + example: 'gpt-4o-mini-tts' + type: 'string' + responses: + '200': + content: + application/json: + example: + created: 1742428800 + description: 'Text-to-speech model with steerable delivery.' + endpoints: + - input_modalities: + - type: 'text' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + provider_name: 'OpenAI' + provider_slug: 'openai' + id: 'openai/gpt-4o-mini-tts' + input_modalities: + - type: 'text' + name: 'OpenAI: GPT-4o mini TTS' + output_modalities: + - supported_parameters: + instructions: + type: 'unknown' + response_format: + type: 'enum' + values: + - 'mp3' + - 'pcm' + speed: + max: 4 + min: 0.25 + type: 'range' + voice: + type: 'enum' + values: + - 'alloy' + - 'coral' + type: 'speech' + schema: + $ref: '#/components/schemas/SpeechModelResponse' + description: 'A text-to-speech model and its endpoints' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + security: [] + summary: 'Get a text-to-speech model' + tags: + - 'TTS' + x-speakeasy-name-override: 'getModel' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /audio/transcriptions: post: description: 'Transcribes audio into text. Accepts base64-encoded audio input as JSON, an OpenAI-style multipart/form-data file upload, or a URL the provider downloads directly, and returns the transcribed text.' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 333dc401e..c11d31d71 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:d2a065fc6f56085a1e126f144517568a6fa4e69b262530d3d75e2de353a8c9f0 - sourceBlobDigest: sha256:cdc1920471b27ea7c0bf892ab1f9495b1959b053ec9e229ab901f3be5fa8e00c + sourceRevisionDigest: sha256:258f3ac44b2bd0d5303c0deadf2467946a8b6ee58c650bbbb4db36f2b155cd4e + sourceBlobDigest: sha256:060309982caf29bc1bd15b6cc707a8a5f706137cc350c8cd1719c6081fc7c1a4 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:d2a065fc6f56085a1e126f144517568a6fa4e69b262530d3d75e2de353a8c9f0 - sourceBlobDigest: sha256:cdc1920471b27ea7c0bf892ab1f9495b1959b053ec9e229ab901f3be5fa8e00c + sourceRevisionDigest: sha256:258f3ac44b2bd0d5303c0deadf2467946a8b6ee58c650bbbb4db36f2b155cd4e + sourceBlobDigest: sha256:060309982caf29bc1bd15b6cc707a8a5f706137cc350c8cd1719c6081fc7c1a4 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:40b9eb17a2f8db677c205746a0158c692f2548209dd69782ee6b2b736d3fdc03 + codeSamplesRevisionDigest: sha256:d67e6c855983dac9e09ba28b99246da5a7c644ad388ff6f0f40f843397d19f64 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index f3a366678..2ee3c8790 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4709,4 +4709,14 @@ Based on: ### Generated - [python v1.3.194] . ### Releases -- [PyPI v1.3.194] https://pypi.org/project/openrouter/1.3.194 - . \ No newline at end of file +- [PyPI v1.3.194] https://pypi.org/project/openrouter/1.3.194 - . + +## 2026-11-19 15:12:05 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.195] . +### Releases +- [PyPI v1.3.195] https://pypi.org/project/openrouter/1.3.195 - . \ No newline at end of file diff --git a/docs/components/audioenum.mdx b/docs/components/audioenum.mdx new file mode 100644 index 000000000..0bde2a43c --- /dev/null +++ b/docs/components/audioenum.mdx @@ -0,0 +1,22 @@ +--- +title: "AudioEnum" +--- + +`required`: an image reference is accepted only together with an audio reference. `excluded`: only without one. Absent: either. + +## Example Usage + +```python +from openrouter.components import AudioEnum + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: AudioEnum = "required" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"required"` +- `"excluded"` diff --git a/docs/components/references.mdx b/docs/components/references.mdx new file mode 100644 index 000000000..02f51497f --- /dev/null +++ b/docs/components/references.mdx @@ -0,0 +1,17 @@ +--- +title: "References" +--- + +`excluded`: `voice` is rejected when the request also sends a nonempty `input_references`. Absent: they can be combined. + +## Example Usage + +```python +from openrouter.components import References +value: References = "excluded" +``` + + +## Values + +- `"excluded"` diff --git a/docs/components/speechenumparameter.mdx b/docs/components/speechenumparameter.mdx new file mode 100644 index 000000000..ee8c8a636 --- /dev/null +++ b/docs/components/speechenumparameter.mdx @@ -0,0 +1,10 @@ +--- +title: "SpeechEnumParameter" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `type` | [components.SpeechEnumParameterType](../components/speechenumparametertype.mdx) | ✔️ | N/A | +| `values` | List[*str*] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechenumparametertype.mdx b/docs/components/speechenumparametertype.mdx new file mode 100644 index 000000000..edbaa3cf9 --- /dev/null +++ b/docs/components/speechenumparametertype.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechEnumParameterType" +--- + +## Example Usage + +```python +from openrouter.components import SpeechEnumParameterType +value: SpeechEnumParameterType = "enum" +``` + + +## Values + +- `"enum"` diff --git a/docs/components/speechinputmodality.mdx b/docs/components/speechinputmodality.mdx new file mode 100644 index 000000000..73d08f72f --- /dev/null +++ b/docs/components/speechinputmodality.mdx @@ -0,0 +1,27 @@ +--- +title: "SpeechInputModality" +--- + +An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design. + + +## Supported Types + +### `components.SpeechInputModalityText` + +```python +value: components.SpeechInputModalityText = /* values here */ +``` + +### `components.SpeechInputModalityAudio` + +```python +value: components.SpeechInputModalityAudio = /* values here */ +``` + +### `components.SpeechInputModalityImage` + +```python +value: components.SpeechInputModalityImage = /* values here */ +``` + diff --git a/docs/components/speechinputmodalityaudio.mdx b/docs/components/speechinputmodalityaudio.mdx new file mode 100644 index 000000000..c5d518162 --- /dev/null +++ b/docs/components/speechinputmodalityaudio.mdx @@ -0,0 +1,10 @@ +--- +title: "SpeechInputModalityAudio" +--- + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `supported_inputs` | [components.SupportedInputs1](../components/supportedinputs1.mdx) | ✔️ | `references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. | +| `type` | [components.TypeAudio](../components/typeaudio.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechinputmodalityimage.mdx b/docs/components/speechinputmodalityimage.mdx new file mode 100644 index 000000000..1e5957cbd --- /dev/null +++ b/docs/components/speechinputmodalityimage.mdx @@ -0,0 +1,10 @@ +--- +title: "SpeechInputModalityImage" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `supported_inputs` | [components.SupportedInputs2](../components/supportedinputs2.mdx) | ✔️ | N/A | +| `type` | [components.SpeechInputModalityTypeImage](../components/speechinputmodalitytypeimage.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechinputmodalitytext.mdx b/docs/components/speechinputmodalitytext.mdx new file mode 100644 index 000000000..6c63a5e46 --- /dev/null +++ b/docs/components/speechinputmodalitytext.mdx @@ -0,0 +1,13 @@ +--- +title: "SpeechInputModalityText" +--- + +The `input` text. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `turns` | [Optional[components.Turns]](../components/turns.mdx) | ➖ | `optional`: `input` may also be a multi-speaker turn array, which cannot be combined with `input_references`. `required`: `input` must be a turn array with at least two distinct voices. Absent: `input` is a string. | +| `type` | [components.SpeechInputModalityTypeText](../components/speechinputmodalitytypetext.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechinputmodalitytypeimage.mdx b/docs/components/speechinputmodalitytypeimage.mdx new file mode 100644 index 000000000..6aa1bd5d9 --- /dev/null +++ b/docs/components/speechinputmodalitytypeimage.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechInputModalityTypeImage" +--- + +## Example Usage + +```python +from openrouter.components import SpeechInputModalityTypeImage +value: SpeechInputModalityTypeImage = "image" +``` + + +## Values + +- `"image"` diff --git a/docs/components/speechinputmodalitytypetext.mdx b/docs/components/speechinputmodalitytypetext.mdx new file mode 100644 index 000000000..8c006e8a5 --- /dev/null +++ b/docs/components/speechinputmodalitytypetext.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechInputModalityTypeText" +--- + +## Example Usage + +```python +from openrouter.components import SpeechInputModalityTypeText +value: SpeechInputModalityTypeText = "text" +``` + + +## Values + +- `"text"` diff --git a/docs/components/speechmodelendpoint.mdx b/docs/components/speechmodelendpoint.mdx new file mode 100644 index 000000000..7bbe4ebda --- /dev/null +++ b/docs/components/speechmodelendpoint.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechModelEndpoint" +--- + +One endpoint serving a speech model, with the inputs and parameters it accepts. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `input_modalities` | List[[components.SpeechInputModality](../components/speechinputmodality.mdx)] | ✔️ | N/A | | +| `output_modalities` | List[[components.SpeechOutputModality](../components/speechoutputmodality.mdx)] | ✔️ | N/A | | +| `provider_name` | *str* | ✔️ | Provider display name | OpenAI | +| `provider_slug` | *str* | ✔️ | Provider slug | openai | \ No newline at end of file diff --git a/docs/components/speechmodelresponse.mdx b/docs/components/speechmodelresponse.mdx new file mode 100644 index 000000000..7812507d0 --- /dev/null +++ b/docs/components/speechmodelresponse.mdx @@ -0,0 +1,18 @@ +--- +title: "SpeechModelResponse" +--- + +A text-to-speech model. Its members are the envelope of its endpoints': enums are unioned and ranges widened, so a value inside a range may be accepted by no single endpoint. Each record in `endpoints` lists exactly what that endpoint accepts. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created` | *int* | ✔️ | Unix timestamp (seconds) of when the model was created | | +| `description` | *str* | ✔️ | N/A | | +| `endpoints` | List[[components.SpeechModelEndpoint](../components/speechmodelendpoint.mdx)] | ✔️ | Each endpoint serving the model, with exactly the inputs and parameters it accepts. Some endpoints route only after the caller accepts a provider requirement such as a self-attestation; until then, a request to them is rejected with a 403 that names the requirement. | | +| `id` | *str* | ✔️ | Model slug | openai/gpt-4o-mini-tts | +| `input_modalities` | List[[components.SpeechInputModality](../components/speechinputmodality.mdx)] | ✔️ | N/A | | +| `name` | *str* | ✔️ | N/A | OpenAI: GPT-4o mini TTS | +| `output_modalities` | List[[components.SpeechOutputModality](../components/speechoutputmodality.mdx)] | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/speechmodelslistresponse.mdx b/docs/components/speechmodelslistresponse.mdx new file mode 100644 index 000000000..f1efb6365 --- /dev/null +++ b/docs/components/speechmodelslistresponse.mdx @@ -0,0 +1,12 @@ +--- +title: "SpeechModelsListResponse" +--- + +List of text-to-speech models, each with its endpoints. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `data` | List[[components.SpeechModelResponse](../components/speechmodelresponse.mdx)] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechoutputmodality.mdx b/docs/components/speechoutputmodality.mdx new file mode 100644 index 000000000..e4cd60f7e --- /dev/null +++ b/docs/components/speechoutputmodality.mdx @@ -0,0 +1,10 @@ +--- +title: "SpeechOutputModality" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `supported_parameters` | [components.SpeechSupportedParameters](../components/speechsupportedparameters.mdx) | ✔️ | N/A | \{
"instructions": \{
"type": "unknown"
},
"response_format": \{
"type": "enum",
"values": [
"mp3",
"pcm"
]
},
"speed": \{
"max": 4,
"min": 0.25,
"type": "range"
},
"voice": \{
"type": "enum",
"values": [
"alloy",
"coral"
]
}
} | +| `type` | [components.SpeechOutputModalityType](../components/speechoutputmodalitytype.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/speechoutputmodalitytype.mdx b/docs/components/speechoutputmodalitytype.mdx new file mode 100644 index 000000000..18a2ac290 --- /dev/null +++ b/docs/components/speechoutputmodalitytype.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechOutputModalityType" +--- + +## Example Usage + +```python +from openrouter.components import SpeechOutputModalityType +value: SpeechOutputModalityType = "speech" +``` + + +## Values + +- `"speech"` diff --git a/docs/components/speechrangeparameter.mdx b/docs/components/speechrangeparameter.mdx new file mode 100644 index 000000000..80dcae831 --- /dev/null +++ b/docs/components/speechrangeparameter.mdx @@ -0,0 +1,14 @@ +--- +title: "SpeechRangeParameter" +--- + +The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `max` | *float* | ✔️ | N/A | +| `min` | *float* | ✔️ | N/A | +| `type` | [components.SpeechRangeParameterType](../components/speechrangeparametertype.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechrangeparametertype.mdx b/docs/components/speechrangeparametertype.mdx new file mode 100644 index 000000000..584aac82f --- /dev/null +++ b/docs/components/speechrangeparametertype.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechRangeParameterType" +--- + +## Example Usage + +```python +from openrouter.components import SpeechRangeParameterType +value: SpeechRangeParameterType = "range" +``` + + +## Values + +- `"range"` diff --git a/docs/components/speechreferencecount.mdx b/docs/components/speechreferencecount.mdx new file mode 100644 index 000000000..9db0dfbf8 --- /dev/null +++ b/docs/components/speechreferencecount.mdx @@ -0,0 +1,11 @@ +--- +title: "SpeechReferenceCount" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `max` | *Optional[int]* | ➖ | N/A | +| `min` | *int* | ✔️ | N/A | +| `type` | [components.SpeechReferenceCountType](../components/speechreferencecounttype.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechreferencecounttype.mdx b/docs/components/speechreferencecounttype.mdx new file mode 100644 index 000000000..38be122fc --- /dev/null +++ b/docs/components/speechreferencecounttype.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechReferenceCountType" +--- + +## Example Usage + +```python +from openrouter.components import SpeechReferenceCountType +value: SpeechReferenceCountType = "integer" +``` + + +## Values + +- `"integer"` diff --git a/docs/components/speechsupportedparameters.mdx b/docs/components/speechsupportedparameters.mdx new file mode 100644 index 000000000..cb4800901 --- /dev/null +++ b/docs/components/speechsupportedparameters.mdx @@ -0,0 +1,12 @@ +--- +title: "SpeechSupportedParameters" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `instructions` | [Optional[components.SpeechUnknownParameter]](../components/speechunknownparameter.mdx) | ➖ | N/A | \{
"type": "unknown"
} | +| `response_format` | [Optional[components.SpeechEnumParameter]](../components/speechenumparameter.mdx) | ➖ | N/A | \{
"type": "enum",
"values": [
"alloy",
"coral"
]
} | +| `speed` | [Optional[components.SpeechRangeParameter]](../components/speechrangeparameter.mdx) | ➖ | The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`. | \{
"max": 4,
"min": 0.25,
"type": "range"
} | +| `voice` | [Optional[components.SpeechVoiceParameter]](../components/speechvoiceparameter.mdx) | ➖ | `enum` lists the documented voices in `values`; some providers also accept voice IDs not listed there (custom or cloned voices). `unknown` means the field is accepted but no voices are listed. | \{
"type": "enum",
"values": [
"alloy",
"coral"
]
} | \ No newline at end of file diff --git a/docs/components/speechunknownparameter.mdx b/docs/components/speechunknownparameter.mdx new file mode 100644 index 000000000..7405144f5 --- /dev/null +++ b/docs/components/speechunknownparameter.mdx @@ -0,0 +1,9 @@ +--- +title: "SpeechUnknownParameter" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `type` | [components.SpeechUnknownParameterType](../components/speechunknownparametertype.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/speechunknownparametertype.mdx b/docs/components/speechunknownparametertype.mdx new file mode 100644 index 000000000..283b96083 --- /dev/null +++ b/docs/components/speechunknownparametertype.mdx @@ -0,0 +1,15 @@ +--- +title: "SpeechUnknownParameterType" +--- + +## Example Usage + +```python +from openrouter.components import SpeechUnknownParameterType +value: SpeechUnknownParameterType = "unknown" +``` + + +## Values + +- `"unknown"` diff --git a/docs/components/speechvoiceparameter.mdx b/docs/components/speechvoiceparameter.mdx new file mode 100644 index 000000000..ff2bc2e42 --- /dev/null +++ b/docs/components/speechvoiceparameter.mdx @@ -0,0 +1,14 @@ +--- +title: "SpeechVoiceParameter" +--- + +`enum` lists the documented voices in `values`; some providers also accept voice IDs not listed there (custom or cloned voices). `unknown` means the field is accepted but no voices are listed. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `references` | [Optional[components.References]](../components/references.mdx) | ➖ | `excluded`: `voice` is rejected when the request also sends a nonempty `input_references`. Absent: they can be combined. | +| `type` | [components.SpeechVoiceParameterType](../components/speechvoiceparametertype.mdx) | ✔️ | N/A | +| `values` | List[*str*] | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/speechvoiceparametertype.mdx b/docs/components/speechvoiceparametertype.mdx new file mode 100644 index 000000000..c53627ead --- /dev/null +++ b/docs/components/speechvoiceparametertype.mdx @@ -0,0 +1,20 @@ +--- +title: "SpeechVoiceParameterType" +--- + +## Example Usage + +```python +from openrouter.components import SpeechVoiceParameterType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: SpeechVoiceParameterType = "enum" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"enum"` +- `"unknown"` diff --git a/docs/components/supportedinputs1.mdx b/docs/components/supportedinputs1.mdx new file mode 100644 index 000000000..f9553dd27 --- /dev/null +++ b/docs/components/supportedinputs1.mdx @@ -0,0 +1,12 @@ +--- +title: "SupportedInputs1" +--- + +`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder. + + +## 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/supportedinputs2.mdx b/docs/components/supportedinputs2.mdx new file mode 100644 index 000000000..9e517d78b --- /dev/null +++ b/docs/components/supportedinputs2.mdx @@ -0,0 +1,10 @@ +--- +title: "SupportedInputs2" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | [Optional[components.AudioEnum]](../components/audioenum.mdx) | ➖ | `required`: an image reference is accepted only together with an audio reference. `excluded`: only without one. Absent: either. | | +| `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/turns.mdx b/docs/components/turns.mdx new file mode 100644 index 000000000..2ae9b4af3 --- /dev/null +++ b/docs/components/turns.mdx @@ -0,0 +1,22 @@ +--- +title: "Turns" +--- + +`optional`: `input` may also be a multi-speaker turn array, which cannot be combined with `input_references`. `required`: `input` must be a turn array with at least two distinct voices. Absent: `input` is a string. + +## Example Usage + +```python +from openrouter.components import Turns + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Turns = "required" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"required"` +- `"optional"` diff --git a/docs/components/typeaudio.mdx b/docs/components/typeaudio.mdx new file mode 100644 index 000000000..9741986e7 --- /dev/null +++ b/docs/components/typeaudio.mdx @@ -0,0 +1,15 @@ +--- +title: "TypeAudio" +--- + +## Example Usage + +```python +from openrouter.components import TypeAudio +value: TypeAudio = "audio" +``` + + +## Values + +- `"audio"` diff --git a/docs/operations/getspeechmodelglobals.mdx b/docs/operations/getspeechmodelglobals.mdx new file mode 100644 index 000000000..db07aad96 --- /dev/null +++ b/docs/operations/getspeechmodelglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetSpeechModelGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| \ No newline at end of file diff --git a/docs/operations/getspeechmodelrequest.mdx b/docs/operations/getspeechmodelrequest.mdx new file mode 100644 index 000000000..591b2b79e --- /dev/null +++ b/docs/operations/getspeechmodelrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "GetSpeechModelRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| | +| `author` | *str* | ✔️ | Model author/organization | openai | +| `slug` | *str* | ✔️ | Model slug | gpt-4o-mini-tts | \ No newline at end of file diff --git a/docs/operations/listspeechmodelsglobals.mdx b/docs/operations/listspeechmodelsglobals.mdx new file mode 100644 index 000000000..03bb85e63 --- /dev/null +++ b/docs/operations/listspeechmodelsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListSpeechModelsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| \ No newline at end of file diff --git a/docs/operations/listspeechmodelsrequest.mdx b/docs/operations/listspeechmodelsrequest.mdx new file mode 100644 index 000000000..491e743d6 --- /dev/null +++ b/docs/operations/listspeechmodelsrequest.mdx @@ -0,0 +1,11 @@ +--- +title: "ListSpeechModelsRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| \ No newline at end of file diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index 8a6d1a137..0addd5d2a 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -10,6 +10,8 @@ Text-to-speech endpoints ### Available Operations * [create_speech](#create_speech) - Create speech +* [list_models](#list_models) - List text-to-speech models +* [get_model](#get_model) - Get a text-to-speech model ## create_speech @@ -76,4 +78,97 @@ with OpenRouter( | errors.ServiceUnavailableResponseError | 503 | application/json | | errors.EdgeNetworkTimeoutResponseError | 524 | application/json | | errors.ProviderOverloadedResponseError | 529 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_models + +Lists every text-to-speech model with the inputs it accepts and its speech output parameters, merged across its endpoints, plus each endpoint with its own. + +### Example Usage + +```python +from openrouter import OpenRouter + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", +) as open_router: + + res = open_router.tts.list_models() + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.SpeechModelsListResponse](../../components/speechmodelslistresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_model + +Returns a text-to-speech model with each endpoint's own inputs and speech output parameters. + +### Example Usage + +```python +from openrouter import OpenRouter + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", +) as open_router: + + res = open_router.tts.get_model(author="openai", slug="gpt-4o-mini-tts") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `author` | *str* | ✔️ | Model author/organization | openai | +| `slug` | *str* | ✔️ | Model slug | gpt-4o-mini-tts | +| `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.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.SpeechModelResponse](../../components/speechmodelresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c30b65628..727db4438 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.194" +version = "1.3.195" 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 0732c7cec..da165f5ad 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.194" +__version__: str = "1.3.195" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.194 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.195 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 a3ca8f5cb..fa9b11cb9 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -4504,7 +4504,32 @@ ShellServerToolEnvironment, ShellServerToolEnvironmentTypedDict, ) + from .speechenumparameter import ( + SpeechEnumParameter, + SpeechEnumParameterType, + SpeechEnumParameterTypedDict, + ) from .speechinput import SpeechInput, SpeechInputTypedDict + from .speechinputmodality import ( + AudioEnum, + SpeechInputModality, + SpeechInputModalityAudio, + SpeechInputModalityAudioTypedDict, + SpeechInputModalityImage, + SpeechInputModalityImageTypedDict, + SpeechInputModalityText, + SpeechInputModalityTextTypedDict, + SpeechInputModalityTypeImage, + SpeechInputModalityTypeText, + SpeechInputModalityTypedDict, + SupportedInputs1, + SupportedInputs1TypedDict, + SupportedInputs2, + SupportedInputs2TypedDict, + Turns, + TypeAudio, + UnknownSpeechInputModality, + ) from .speechinputreference import ( SpeechInputReference, SpeechInputReferenceTypedDict, @@ -4532,6 +4557,27 @@ SpeechInputReferenceTextType, SpeechInputReferenceTextTypedDict, ) + from .speechmodelendpoint import SpeechModelEndpoint, SpeechModelEndpointTypedDict + from .speechmodelresponse import SpeechModelResponse, SpeechModelResponseTypedDict + from .speechmodelslistresponse import ( + SpeechModelsListResponse, + SpeechModelsListResponseTypedDict, + ) + from .speechoutputmodality import ( + SpeechOutputModality, + SpeechOutputModalityType, + SpeechOutputModalityTypedDict, + ) + from .speechrangeparameter import ( + SpeechRangeParameter, + SpeechRangeParameterType, + SpeechRangeParameterTypedDict, + ) + from .speechreferencecount import ( + SpeechReferenceCount, + SpeechReferenceCountType, + SpeechReferenceCountTypedDict, + ) from .speechrequest import ( SpeechRequest, SpeechRequestDataCollection, @@ -4546,7 +4592,22 @@ SpeechRequestResponseFormat, SpeechRequestTypedDict, ) + from .speechsupportedparameters import ( + SpeechSupportedParameters, + SpeechSupportedParametersTypedDict, + ) from .speechturn import SpeechTurn, SpeechTurnTypedDict + from .speechunknownparameter import ( + SpeechUnknownParameter, + SpeechUnknownParameterType, + SpeechUnknownParameterTypedDict, + ) + from .speechvoiceparameter import ( + References, + SpeechVoiceParameter, + SpeechVoiceParameterType, + SpeechVoiceParameterTypedDict, + ) from .stopservertoolswhencondition import ( StopServerToolsWhenCondition, StopServerToolsWhenConditionTypedDict, @@ -5617,6 +5678,7 @@ "ArmorSafeguardResultTypedDict", "ArmorTypedDict", "Audio", + "AudioEnum", "AudioPcm1", "AudioPcm1TypedDict", "AudioPcm2", @@ -8142,6 +8204,7 @@ "ReasoningTextContent", "ReasoningTextContentType", "ReasoningTextContentTypedDict", + "References", "Refusal", "RefusalDeltaEvent", "RefusalDeltaEventType", @@ -8343,7 +8406,20 @@ "SourceContent", "SourceContentTypedDict", "SourceType", + "SpeechEnumParameter", + "SpeechEnumParameterType", + "SpeechEnumParameterTypedDict", "SpeechInput", + "SpeechInputModality", + "SpeechInputModalityAudio", + "SpeechInputModalityAudioTypedDict", + "SpeechInputModalityImage", + "SpeechInputModalityImageTypedDict", + "SpeechInputModalityText", + "SpeechInputModalityTextTypedDict", + "SpeechInputModalityTypeImage", + "SpeechInputModalityTypeText", + "SpeechInputModalityTypedDict", "SpeechInputReference", "SpeechInputReferenceAudio", "SpeechInputReferenceAudioInput", @@ -8360,6 +8436,21 @@ "SpeechInputReferenceTextTypedDict", "SpeechInputReferenceTypedDict", "SpeechInputTypedDict", + "SpeechModelEndpoint", + "SpeechModelEndpointTypedDict", + "SpeechModelResponse", + "SpeechModelResponseTypedDict", + "SpeechModelsListResponse", + "SpeechModelsListResponseTypedDict", + "SpeechOutputModality", + "SpeechOutputModalityType", + "SpeechOutputModalityTypedDict", + "SpeechRangeParameter", + "SpeechRangeParameterType", + "SpeechRangeParameterTypedDict", + "SpeechReferenceCount", + "SpeechReferenceCountType", + "SpeechReferenceCountTypedDict", "SpeechRequest", "SpeechRequestDataCollection", "SpeechRequestIgnore", @@ -8372,8 +8463,16 @@ "SpeechRequestProviderTypedDict", "SpeechRequestResponseFormat", "SpeechRequestTypedDict", + "SpeechSupportedParameters", + "SpeechSupportedParametersTypedDict", "SpeechTurn", "SpeechTurnTypedDict", + "SpeechUnknownParameter", + "SpeechUnknownParameterType", + "SpeechUnknownParameterTypedDict", + "SpeechVoiceParameter", + "SpeechVoiceParameterType", + "SpeechVoiceParameterTypedDict", "Speed", "Stance", "StanceTypedDict", @@ -8441,6 +8540,10 @@ "SubmitGenerationFeedbackResponseTypedDict", "SupportedAspectRatio", "SupportedFrameImage", + "SupportedInputs1", + "SupportedInputs1TypedDict", + "SupportedInputs2", + "SupportedInputs2TypedDict", "SupportedResolution", "SupportedSize", "SwitchyardRouterPlugin", @@ -8580,6 +8683,7 @@ "TrueTTypedDict", "Truncation", "TurnRange", + "Turns", "Type", "TypeAdaptive", "TypeAdditionalTools", @@ -8587,6 +8691,7 @@ "TypeAgentMessage", "TypeAllowlist", "TypeAny", + "TypeAudio", "TypeAvailable", "TypeBetweenTools", "TypeClearThinking20251015", @@ -8697,6 +8802,7 @@ "UnknownOutputWebSearchCallItemActionUnion", "UnknownReasoningDetail", "UnknownReasoningDetailUnion", + "UnknownSpeechInputModality", "UnknownStreamEvents", "UnknownToolUses", "UnknownTypedDict", @@ -12191,8 +12297,29 @@ "ShellServerToolEngine": ".shellservertoolengine", "ShellServerToolEnvironment": ".shellservertoolenvironment", "ShellServerToolEnvironmentTypedDict": ".shellservertoolenvironment", + "SpeechEnumParameter": ".speechenumparameter", + "SpeechEnumParameterType": ".speechenumparameter", + "SpeechEnumParameterTypedDict": ".speechenumparameter", "SpeechInput": ".speechinput", "SpeechInputTypedDict": ".speechinput", + "AudioEnum": ".speechinputmodality", + "SpeechInputModality": ".speechinputmodality", + "SpeechInputModalityAudio": ".speechinputmodality", + "SpeechInputModalityAudioTypedDict": ".speechinputmodality", + "SpeechInputModalityImage": ".speechinputmodality", + "SpeechInputModalityImageTypedDict": ".speechinputmodality", + "SpeechInputModalityText": ".speechinputmodality", + "SpeechInputModalityTextTypedDict": ".speechinputmodality", + "SpeechInputModalityTypeImage": ".speechinputmodality", + "SpeechInputModalityTypeText": ".speechinputmodality", + "SpeechInputModalityTypedDict": ".speechinputmodality", + "SupportedInputs1": ".speechinputmodality", + "SupportedInputs1TypedDict": ".speechinputmodality", + "SupportedInputs2": ".speechinputmodality", + "SupportedInputs2TypedDict": ".speechinputmodality", + "Turns": ".speechinputmodality", + "TypeAudio": ".speechinputmodality", + "UnknownSpeechInputModality": ".speechinputmodality", "SpeechInputReference": ".speechinputreference", "SpeechInputReferenceTypedDict": ".speechinputreference", "SpeechInputReferenceAudio": ".speechinputreferenceaudio", @@ -12208,6 +12335,21 @@ "SpeechInputReferenceText": ".speechinputreferencetext", "SpeechInputReferenceTextType": ".speechinputreferencetext", "SpeechInputReferenceTextTypedDict": ".speechinputreferencetext", + "SpeechModelEndpoint": ".speechmodelendpoint", + "SpeechModelEndpointTypedDict": ".speechmodelendpoint", + "SpeechModelResponse": ".speechmodelresponse", + "SpeechModelResponseTypedDict": ".speechmodelresponse", + "SpeechModelsListResponse": ".speechmodelslistresponse", + "SpeechModelsListResponseTypedDict": ".speechmodelslistresponse", + "SpeechOutputModality": ".speechoutputmodality", + "SpeechOutputModalityType": ".speechoutputmodality", + "SpeechOutputModalityTypedDict": ".speechoutputmodality", + "SpeechRangeParameter": ".speechrangeparameter", + "SpeechRangeParameterType": ".speechrangeparameter", + "SpeechRangeParameterTypedDict": ".speechrangeparameter", + "SpeechReferenceCount": ".speechreferencecount", + "SpeechReferenceCountType": ".speechreferencecount", + "SpeechReferenceCountTypedDict": ".speechreferencecount", "SpeechRequest": ".speechrequest", "SpeechRequestDataCollection": ".speechrequest", "SpeechRequestIgnore": ".speechrequest", @@ -12220,8 +12362,17 @@ "SpeechRequestProviderTypedDict": ".speechrequest", "SpeechRequestResponseFormat": ".speechrequest", "SpeechRequestTypedDict": ".speechrequest", + "SpeechSupportedParameters": ".speechsupportedparameters", + "SpeechSupportedParametersTypedDict": ".speechsupportedparameters", "SpeechTurn": ".speechturn", "SpeechTurnTypedDict": ".speechturn", + "SpeechUnknownParameter": ".speechunknownparameter", + "SpeechUnknownParameterType": ".speechunknownparameter", + "SpeechUnknownParameterTypedDict": ".speechunknownparameter", + "References": ".speechvoiceparameter", + "SpeechVoiceParameter": ".speechvoiceparameter", + "SpeechVoiceParameterType": ".speechvoiceparameter", + "SpeechVoiceParameterTypedDict": ".speechvoiceparameter", "StopServerToolsWhenCondition": ".stopservertoolswhencondition", "StopServerToolsWhenConditionTypedDict": ".stopservertoolswhencondition", "StopServerToolsWhenFinishReasonIs": ".stopservertoolswhenfinishreasonis", diff --git a/src/openrouter/components/speechenumparameter.py b/src/openrouter/components/speechenumparameter.py new file mode 100644 index 000000000..2892182b8 --- /dev/null +++ b/src/openrouter/components/speechenumparameter.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import List, Literal +from typing_extensions import TypedDict + + +SpeechEnumParameterType = Literal["enum",] + + +class SpeechEnumParameterTypedDict(TypedDict): + type: SpeechEnumParameterType + values: List[str] + + +class SpeechEnumParameter(BaseModel): + type: SpeechEnumParameterType + + values: List[str] diff --git a/src/openrouter/components/speechinputmodality.py b/src/openrouter/components/speechinputmodality.py new file mode 100644 index 000000000..1b218efd1 --- /dev/null +++ b/src/openrouter/components/speechinputmodality.py @@ -0,0 +1,186 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .speechreferencecount import SpeechReferenceCount, SpeechReferenceCountTypedDict +from functools import partial +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.utils.unions import parse_open_union +from pydantic import ConfigDict, model_serializer +from pydantic.functional_validators import BeforeValidator +from typing import Any, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +AudioEnum = Union[ + Literal[ + "required", + "excluded", + ], + UnrecognizedStr, +] +r"""`required`: an image reference is accepted only together with an audio reference. `excluded`: only without one. Absent: either.""" + + +class SupportedInputs2TypedDict(TypedDict): + references: SpeechReferenceCountTypedDict + audio: NotRequired[AudioEnum] + r"""`required`: an image reference is accepted only together with an audio reference. `excluded`: only without one. Absent: either.""" + + +class SupportedInputs2(BaseModel): + references: SpeechReferenceCount + + audio: Optional[AudioEnum] = None + r"""`required`: an image reference is accepted only together with an audio reference. `excluded`: only without one. Absent: either.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["audio"]) + 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 + + +SpeechInputModalityTypeImage = Literal["image",] + + +class SpeechInputModalityImageTypedDict(TypedDict): + supported_inputs: SupportedInputs2TypedDict + type: SpeechInputModalityTypeImage + + +class SpeechInputModalityImage(BaseModel): + supported_inputs: SupportedInputs2 + + type: SpeechInputModalityTypeImage + + +class SupportedInputs1TypedDict(TypedDict): + r"""`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder.""" + + references: SpeechReferenceCountTypedDict + + +class SupportedInputs1(BaseModel): + r"""`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder.""" + + references: SpeechReferenceCount + + +TypeAudio = Literal["audio",] + + +class SpeechInputModalityAudioTypedDict(TypedDict): + supported_inputs: SupportedInputs1TypedDict + r"""`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder.""" + type: TypeAudio + + +class SpeechInputModalityAudio(BaseModel): + supported_inputs: SupportedInputs1 + r"""`references` is how many audio clips a request may send. With more than one, some providers require the text to address every clip with an `@AudioN` placeholder.""" + + type: TypeAudio + + +Turns = Union[ + Literal[ + "required", + "optional", + ], + UnrecognizedStr, +] +r"""`optional`: `input` may also be a multi-speaker turn array, which cannot be combined with `input_references`. `required`: `input` must be a turn array with at least two distinct voices. Absent: `input` is a string.""" + + +SpeechInputModalityTypeText = Literal["text",] + + +class SpeechInputModalityTextTypedDict(TypedDict): + r"""The `input` text.""" + + type: SpeechInputModalityTypeText + turns: NotRequired[Turns] + r"""`optional`: `input` may also be a multi-speaker turn array, which cannot be combined with `input_references`. `required`: `input` must be a turn array with at least two distinct voices. Absent: `input` is a string.""" + + +class SpeechInputModalityText(BaseModel): + r"""The `input` text.""" + + type: SpeechInputModalityTypeText + + turns: Optional[Turns] = None + r"""`optional`: `input` may also be a multi-speaker turn array, which cannot be combined with `input_references`. `required`: `input` must be a turn array with at least two distinct voices. Absent: `input` is a string.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["turns"]) + 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 + + +SpeechInputModalityTypedDict = TypeAliasType( + "SpeechInputModalityTypedDict", + Union[ + SpeechInputModalityTextTypedDict, + SpeechInputModalityAudioTypedDict, + SpeechInputModalityImageTypedDict, + ], +) +r"""An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design.""" + + +class UnknownSpeechInputModality(BaseModel): + r"""A SpeechInputModality variant the SDK doesn't recognize. Preserves the raw payload.""" + + type: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_SPEECH_INPUT_MODALITY_VARIANTS: dict[str, Any] = { + "text": SpeechInputModalityText, + "audio": SpeechInputModalityAudio, + "image": SpeechInputModalityImage, +} + + +SpeechInputModality = Annotated[ + Union[ + SpeechInputModalityText, + SpeechInputModalityAudio, + SpeechInputModalityImage, + UnknownSpeechInputModality, + ], + BeforeValidator( + partial( + parse_open_union, + disc_key="type", + variants=_SPEECH_INPUT_MODALITY_VARIANTS, + unknown_cls=UnknownSpeechInputModality, + union_name="SpeechInputModality", + ) + ), +] +r"""An input the model accepts. `audio` and `image` are `input_references` for voice cloning and voice design.""" diff --git a/src/openrouter/components/speechmodelendpoint.py b/src/openrouter/components/speechmodelendpoint.py new file mode 100644 index 000000000..874f71c56 --- /dev/null +++ b/src/openrouter/components/speechmodelendpoint.py @@ -0,0 +1,33 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .speechinputmodality import SpeechInputModality, SpeechInputModalityTypedDict +from .speechoutputmodality import SpeechOutputModality, SpeechOutputModalityTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class SpeechModelEndpointTypedDict(TypedDict): + r"""One endpoint serving a speech model, with the inputs and parameters it accepts.""" + + input_modalities: List[SpeechInputModalityTypedDict] + output_modalities: List[SpeechOutputModalityTypedDict] + provider_name: str + r"""Provider display name""" + provider_slug: str + r"""Provider slug""" + + +class SpeechModelEndpoint(BaseModel): + r"""One endpoint serving a speech model, with the inputs and parameters it accepts.""" + + input_modalities: List[SpeechInputModality] + + output_modalities: List[SpeechOutputModality] + + provider_name: str + r"""Provider display name""" + + provider_slug: str + r"""Provider slug""" diff --git a/src/openrouter/components/speechmodelresponse.py b/src/openrouter/components/speechmodelresponse.py new file mode 100644 index 000000000..b5a75e72f --- /dev/null +++ b/src/openrouter/components/speechmodelresponse.py @@ -0,0 +1,45 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .speechinputmodality import SpeechInputModality, SpeechInputModalityTypedDict +from .speechmodelendpoint import SpeechModelEndpoint, SpeechModelEndpointTypedDict +from .speechoutputmodality import SpeechOutputModality, SpeechOutputModalityTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class SpeechModelResponseTypedDict(TypedDict): + r"""A text-to-speech model. Its members are the envelope of its endpoints': enums are unioned and ranges widened, so a value inside a range may be accepted by no single endpoint. Each record in `endpoints` lists exactly what that endpoint accepts.""" + + created: int + r"""Unix timestamp (seconds) of when the model was created""" + description: str + endpoints: List[SpeechModelEndpointTypedDict] + r"""Each endpoint serving the model, with exactly the inputs and parameters it accepts. Some endpoints route only after the caller accepts a provider requirement such as a self-attestation; until then, a request to them is rejected with a 403 that names the requirement.""" + id: str + r"""Model slug""" + input_modalities: List[SpeechInputModalityTypedDict] + name: str + output_modalities: List[SpeechOutputModalityTypedDict] + + +class SpeechModelResponse(BaseModel): + r"""A text-to-speech model. Its members are the envelope of its endpoints': enums are unioned and ranges widened, so a value inside a range may be accepted by no single endpoint. Each record in `endpoints` lists exactly what that endpoint accepts.""" + + created: int + r"""Unix timestamp (seconds) of when the model was created""" + + description: str + + endpoints: List[SpeechModelEndpoint] + r"""Each endpoint serving the model, with exactly the inputs and parameters it accepts. Some endpoints route only after the caller accepts a provider requirement such as a self-attestation; until then, a request to them is rejected with a 403 that names the requirement.""" + + id: str + r"""Model slug""" + + input_modalities: List[SpeechInputModality] + + name: str + + output_modalities: List[SpeechOutputModality] diff --git a/src/openrouter/components/speechmodelslistresponse.py b/src/openrouter/components/speechmodelslistresponse.py new file mode 100644 index 000000000..e25941ae3 --- /dev/null +++ b/src/openrouter/components/speechmodelslistresponse.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .speechmodelresponse import SpeechModelResponse, SpeechModelResponseTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class SpeechModelsListResponseTypedDict(TypedDict): + r"""List of text-to-speech models, each with its endpoints.""" + + data: List[SpeechModelResponseTypedDict] + + +class SpeechModelsListResponse(BaseModel): + r"""List of text-to-speech models, each with its endpoints.""" + + data: List[SpeechModelResponse] diff --git a/src/openrouter/components/speechoutputmodality.py b/src/openrouter/components/speechoutputmodality.py new file mode 100644 index 000000000..40509b500 --- /dev/null +++ b/src/openrouter/components/speechoutputmodality.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .speechsupportedparameters import ( + SpeechSupportedParameters, + SpeechSupportedParametersTypedDict, +) +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +SpeechOutputModalityType = Literal["speech",] + + +class SpeechOutputModalityTypedDict(TypedDict): + supported_parameters: SpeechSupportedParametersTypedDict + type: SpeechOutputModalityType + + +class SpeechOutputModality(BaseModel): + supported_parameters: SpeechSupportedParameters + + type: SpeechOutputModalityType diff --git a/src/openrouter/components/speechrangeparameter.py b/src/openrouter/components/speechrangeparameter.py new file mode 100644 index 000000000..f25b8fcc2 --- /dev/null +++ b/src/openrouter/components/speechrangeparameter.py @@ -0,0 +1,27 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +SpeechRangeParameterType = Literal["range",] + + +class SpeechRangeParameterTypedDict(TypedDict): + r"""The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`.""" + + max: float + min: float + type: SpeechRangeParameterType + + +class SpeechRangeParameter(BaseModel): + r"""The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`.""" + + max: float + + min: float + + type: SpeechRangeParameterType diff --git a/src/openrouter/components/speechreferencecount.py b/src/openrouter/components/speechreferencecount.py new file mode 100644 index 000000000..69c0355e7 --- /dev/null +++ b/src/openrouter/components/speechreferencecount.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 Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +SpeechReferenceCountType = Literal["integer",] + + +class SpeechReferenceCountTypedDict(TypedDict): + min: int + type: SpeechReferenceCountType + max: NotRequired[int] + + +class SpeechReferenceCount(BaseModel): + min: int + + type: SpeechReferenceCountType + + max: Optional[int] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["max"]) + 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/speechsupportedparameters.py b/src/openrouter/components/speechsupportedparameters.py new file mode 100644 index 000000000..cbb22d167 --- /dev/null +++ b/src/openrouter/components/speechsupportedparameters.py @@ -0,0 +1,51 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .speechenumparameter import SpeechEnumParameter, SpeechEnumParameterTypedDict +from .speechrangeparameter import SpeechRangeParameter, SpeechRangeParameterTypedDict +from .speechunknownparameter import ( + SpeechUnknownParameter, + SpeechUnknownParameterTypedDict, +) +from .speechvoiceparameter import SpeechVoiceParameter, SpeechVoiceParameterTypedDict +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class SpeechSupportedParametersTypedDict(TypedDict): + instructions: NotRequired[SpeechUnknownParameterTypedDict] + response_format: NotRequired[SpeechEnumParameterTypedDict] + speed: NotRequired[SpeechRangeParameterTypedDict] + r"""The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`.""" + voice: NotRequired[SpeechVoiceParameterTypedDict] + r"""`enum` lists the documented voices in `values`; some providers also accept voice IDs not listed there (custom or cloned voices). `unknown` means the field is accepted but no voices are listed.""" + + +class SpeechSupportedParameters(BaseModel): + instructions: Optional[SpeechUnknownParameter] = None + + response_format: Optional[SpeechEnumParameter] = None + + speed: Optional[SpeechRangeParameter] = None + r"""The accepted `speed` range. Absent: the provider documents no range; some providers still forward `speed`.""" + + voice: Optional[SpeechVoiceParameter] = None + r"""`enum` lists the documented voices in `values`; some providers also accept voice IDs not listed there (custom or cloned voices). `unknown` means the field is accepted but no voices are listed.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["instructions", "response_format", "speed", "voice"]) + 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/speechunknownparameter.py b/src/openrouter/components/speechunknownparameter.py new file mode 100644 index 000000000..c28ec9144 --- /dev/null +++ b/src/openrouter/components/speechunknownparameter.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +SpeechUnknownParameterType = Literal["unknown",] + + +class SpeechUnknownParameterTypedDict(TypedDict): + type: SpeechUnknownParameterType + + +class SpeechUnknownParameter(BaseModel): + type: SpeechUnknownParameterType diff --git a/src/openrouter/components/speechvoiceparameter.py b/src/openrouter/components/speechvoiceparameter.py new file mode 100644 index 000000000..85881124e --- /dev/null +++ b/src/openrouter/components/speechvoiceparameter.py @@ -0,0 +1,56 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict + + +References = Literal["excluded",] +r"""`excluded`: `voice` is rejected when the request also sends a nonempty `input_references`. Absent: they can be combined.""" + + +SpeechVoiceParameterType = Union[ + Literal[ + "enum", + "unknown", + ], + UnrecognizedStr, +] + + +class SpeechVoiceParameterTypedDict(TypedDict): + r"""`enum` lists the documented voices in `values`; some providers also accept voice IDs not listed there (custom or cloned voices). `unknown` means the field is accepted but no voices are listed.""" + + type: SpeechVoiceParameterType + references: NotRequired[References] + r"""`excluded`: `voice` is rejected when the request also sends a nonempty `input_references`. Absent: they can be combined.""" + values: NotRequired[List[str]] + + +class SpeechVoiceParameter(BaseModel): + r"""`enum` lists the documented voices in `values`; some providers also accept voice IDs not listed there (custom or cloned voices). `unknown` means the field is accepted but no voices are listed.""" + + type: SpeechVoiceParameterType + + references: Optional[References] = None + r"""`excluded`: `voice` is rejected when the request also sends a nonempty `input_references`. Absent: they can be combined.""" + + values: Optional[List[str]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["references", "values"]) + 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/operations/__init__.py b/src/openrouter/operations/__init__.py index a20109487..70bc0a74a 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -728,6 +728,12 @@ GetSessionCostResponseTypedDict, TurnRange, ) + from .getspeechmodel import ( + GetSpeechModelGlobals, + GetSpeechModelGlobalsTypedDict, + GetSpeechModelRequest, + GetSpeechModelRequestTypedDict, + ) from .gettaskclassifications import ( GetTaskClassificationsGlobals, GetTaskClassificationsGlobalsTypedDict, @@ -1061,6 +1067,12 @@ ListScimGroupsResponse, ListScimGroupsResponseTypedDict, ) + from .listspeechmodels import ( + ListSpeechModelsGlobals, + ListSpeechModelsGlobalsTypedDict, + ListSpeechModelsRequest, + ListSpeechModelsRequestTypedDict, + ) from .listtools import ( APIFormat, ListToolsGlobals, @@ -1796,6 +1808,10 @@ "GetSessionCostRequestTypedDict", "GetSessionCostResponse", "GetSessionCostResponseTypedDict", + "GetSpeechModelGlobals", + "GetSpeechModelGlobalsTypedDict", + "GetSpeechModelRequest", + "GetSpeechModelRequestTypedDict", "GetTaskClassificationsGlobals", "GetTaskClassificationsGlobalsTypedDict", "GetTaskClassificationsRequest", @@ -2051,6 +2067,10 @@ "ListScimGroupsRequestTypedDict", "ListScimGroupsResponse", "ListScimGroupsResponseTypedDict", + "ListSpeechModelsGlobals", + "ListSpeechModelsGlobalsTypedDict", + "ListSpeechModelsRequest", + "ListSpeechModelsRequestTypedDict", "ListToolsGlobals", "ListToolsGlobalsTypedDict", "ListToolsRequest", @@ -2777,6 +2797,10 @@ "GetSessionCostResponse": ".getsessioncost", "GetSessionCostResponseTypedDict": ".getsessioncost", "TurnRange": ".getsessioncost", + "GetSpeechModelGlobals": ".getspeechmodel", + "GetSpeechModelGlobalsTypedDict": ".getspeechmodel", + "GetSpeechModelRequest": ".getspeechmodel", + "GetSpeechModelRequestTypedDict": ".getspeechmodel", "GetTaskClassificationsGlobals": ".gettaskclassifications", "GetTaskClassificationsGlobalsTypedDict": ".gettaskclassifications", "GetTaskClassificationsRequest": ".gettaskclassifications", @@ -3026,6 +3050,10 @@ "ListScimGroupsRequestTypedDict": ".listscimgroups", "ListScimGroupsResponse": ".listscimgroups", "ListScimGroupsResponseTypedDict": ".listscimgroups", + "ListSpeechModelsGlobals": ".listspeechmodels", + "ListSpeechModelsGlobalsTypedDict": ".listspeechmodels", + "ListSpeechModelsRequest": ".listspeechmodels", + "ListSpeechModelsRequestTypedDict": ".listspeechmodels", "APIFormat": ".listtools", "ListToolsGlobals": ".listtools", "ListToolsGlobalsTypedDict": ".listtools", diff --git a/src/openrouter/operations/getspeechmodel.py b/src/openrouter/operations/getspeechmodel.py new file mode 100644 index 000000000..2a9f4fcb2 --- /dev/null +++ b/src/openrouter/operations/getspeechmodel.py @@ -0,0 +1,151 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetSpeechModelGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetSpeechModelGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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 + + +class GetSpeechModelRequestTypedDict(TypedDict): + author: str + r"""Model author/organization""" + slug: str + r"""Model slug""" + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetSpeechModelRequest(BaseModel): + author: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Model author/organization""" + + slug: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Model slug""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/operations/listspeechmodels.py b/src/openrouter/operations/listspeechmodels.py new file mode 100644 index 000000000..a9365d3cf --- /dev/null +++ b/src/openrouter/operations/listspeechmodels.py @@ -0,0 +1,137 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListSpeechModelsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListSpeechModelsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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 + + +class ListSpeechModelsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""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: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListSpeechModelsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""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: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/tts.py b/src/openrouter/tts.py index f0867ac9f..b9ee47552 100644 --- a/src/openrouter/tts.py +++ b/src/openrouter/tts.py @@ -524,3 +524,517 @@ async def create_speech_async( raise errors.OpenRouterDefaultError( "Unexpected response received", http_res, http_res_text ) + + def list_models( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SpeechModelsListResponse: + r"""List text-to-speech models + + Lists every text-to-speech model with the inputs it accepts and its speech output parameters, merged across its endpoints, plus each endpoint with its own. + + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListSpeechModelsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + ) + + req = self._build_request( + method="GET", + path="/audio/speech/models", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListSpeechModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listSpeechModels", + oauth2_scopes=None, + security_source=None, + tags=["TTS"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.SpeechModelsListResponse, http_res + ) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_models_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SpeechModelsListResponse: + r"""List text-to-speech models + + Lists every text-to-speech model with the inputs it accepts and its speech output parameters, merged across its endpoints, plus each endpoint with its own. + + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListSpeechModelsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + ) + + req = self._build_request_async( + method="GET", + path="/audio/speech/models", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListSpeechModelsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listSpeechModels", + oauth2_scopes=None, + security_source=None, + tags=["TTS"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.SpeechModelsListResponse, http_res + ) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_model( + self, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SpeechModelResponse: + r"""Get a text-to-speech model + + Returns a text-to-speech model with each endpoint's own inputs and speech output parameters. + + :param author: Model author/organization + :param slug: Model slug + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetSpeechModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request( + method="GET", + path="/audio/speech/models/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetSpeechModelGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getSpeechModel", + oauth2_scopes=None, + security_source=None, + tags=["TTS"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.SpeechModelResponse, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_model_async( + self, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SpeechModelResponse: + r"""Get a text-to-speech model + + Returns a text-to-speech model with each endpoint's own inputs and speech output parameters. + + :param author: Model author/organization + :param slug: Model slug + :param http_referer: 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. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetSpeechModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request_async( + method="GET", + path="/audio/speech/models/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=False, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetSpeechModelGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getSpeechModel", + oauth2_scopes=None, + security_source=None, + tags=["TTS"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.SpeechModelResponse, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/uv.lock b/uv.lock index 4e49cc74d..2556f736c 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.194" +version = "1.3.195" source = { editable = "." } dependencies = [ { name = "httpcore" }, From f8b4a43600ff3a831d54167466518986a4f031a6 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:14:55 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow