diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 396929a..c7d8d27 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,4 +1,9 @@ +
+ +
+
+ > **Remember to shutdown a GitHub Codespace when it is not in use!** # Dev Containers Quick Start diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 8f932cd..a9b35bc 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,17 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 59bf622329ff2d6d2a28acceada10a6d + docChecksum: f11a1f2f45b9a2d3792fda2221267c07 docVersion: 1.0.0 speakeasyVersion: 1.680.0 generationVersion: 2.788.4 - releaseVersion: 0.9.1 - configChecksum: 9c8b936b4b1d37d964e844ee1a15cd4b + releaseVersion: 0.9.2 + configChecksum: f906b25652bcc83a52d1c74e5018c02e + repoURL: https://github.com/OpenRouterTeam/python-sdk.git + installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: ce3858e4-7fbd-4f52-9d57-24016d5c1504 - pristine_commit_hash: c581f0a6ace9e1c793b0f4d759585b420c157610 - pristine_tree_hash: c5a3bf3d181c5c54d764cdf6372feb79505d5ed7 + generation_id: 27ace82f-926e-4125-876b-3e41897dbdfe + pristine_commit_hash: 19894aad2b9a5db5fd40fe2e3f818a7ea8ddbce7 + pristine_tree_hash: aa78fae2ff519ce4564960f0d9d858871f115df0 features: python: acceptHeaders: 3.0.0 @@ -50,8 +52,8 @@ features: trackedFiles: .devcontainer/README.md: id: b170c0f184ac - last_write_checksum: sha1:3c63dfd4dcea8df0d4add09e975a6887e6da4aab - pristine_git_object: 396929ab2e57cf09dd25ec83bd4496f733b95701 + last_write_checksum: sha1:919a25ed5129d316f05a60131c164011763b7c54 + pristine_git_object: c7d8d278438e7906fedb39d99151372b3324ea66 .devcontainer/devcontainer.json: id: b34062a34eb1 last_write_checksum: sha1:94309e8c8eab5ab063986bf625f513a59825e947 @@ -718,12 +720,12 @@ trackedFiles: pristine_git_object: ada009ced29fcaf5d19e81bc67276fe9718ccfaa docs/components/createguardrailrequest.md: id: 5144188aed43 - last_write_checksum: sha1:78119c6dd8cc0b40009afb1da489638ac35f16b6 - pristine_git_object: 77b840640f4d30cf4513745df984d3a950b76c12 + last_write_checksum: sha1:db9d47079aa62c89dc20ab215f5bf22c62c93666 + pristine_git_object: 971a9785fccd13b44b19fe61ce530b544416ffa5 docs/components/createguardrailresponse.md: id: 94a5ed00d7b9 - last_write_checksum: sha1:bad318ece1219797a8db60631961006554b38cda - pristine_git_object: bf3c2f7a4c16ba60ecac1fef7a733cfe6c9efb3b + last_write_checksum: sha1:a6354ced927a1dce6bee519fce24ab1f46eaca54 + pristine_git_object: f8e3aca017593dfa3e941dd7c02b0127916a183b docs/components/customtool.md: id: ff0ec1b8ea8b last_write_checksum: sha1:1da938f1452f026020f8f3c617e2ee3fd11b78e5 @@ -1014,12 +1016,12 @@ trackedFiles: pristine_git_object: 2f4629220306ced5674a9ef70dbcbce1f908b93a docs/components/getguardrailresponse.md: id: eac79c96805c - last_write_checksum: sha1:da1d99fad316a21e9db253b30bbf9d590062fc59 - pristine_git_object: d7de0f8ddb4847ec9c60c25f3d46ab408aac707d + last_write_checksum: sha1:800319e81a56baaf0759c26a90e0050b17f5851c + pristine_git_object: 2ce7c298c24262dfe049e0ea2ef387d28f8cba90 docs/components/guardrail.md: id: ce84902d4cc2 - last_write_checksum: sha1:bf7a0be7e156abadc6adf0d426c40bf7c088bcd0 - pristine_git_object: 994b02604a9be6a0e9705b182621e9a2df085864 + last_write_checksum: sha1:24480751267ac11c267c1b73b839c22f9738827d + pristine_git_object: 1e5405c60ec7f2bce71f43f25786ac18ebc58aac docs/components/guardrailinterval.md: id: 79efeedcb880 last_write_checksum: sha1:3c071c14943c7b26474847eee46925ae884a8a6b @@ -1070,16 +1072,16 @@ trackedFiles: pristine_git_object: e38b5c19b6356f255783dfacea66b45418679e21 docs/components/imagegenerationservertoolconfig.md: id: 4086d42eed1b - last_write_checksum: sha1:9da8f5dbeb8e76419b5ca3041965105934b0ad9b - pristine_git_object: b3fbb8ea61ef0f98681cc1507b2f192556822141 + last_write_checksum: sha1:4be4af2bb484ca26d779f052da6a645dcb4d912c + pristine_git_object: d1bc3aceee221331b9f45bd00bbd8d0ea75a4a73 docs/components/imagegenerationservertoolconfigunion.md: id: 7ba56d56f6bc last_write_checksum: sha1:99eb92cf87c2e68e8db530d3ebdaaff6be117587 pristine_git_object: b9319d587cbf5118b4b12874b67a4a86ec4d1b16 docs/components/imagegenerationservertoolopenrouter.md: id: c5bf0021441a - last_write_checksum: sha1:25069e75ba4a6a6b98bc6c168ef09c2e2960f630 - pristine_git_object: edee38367aaf7511e2a5d3f386d493005ce3c544 + last_write_checksum: sha1:01a0ffcf8d7d3c806c1135e73ed4926ca5d05dc9 + pristine_git_object: dce650cbf584a1798754d1610898a9432b544d28 docs/components/imagegenerationservertoolopenroutertype.md: id: 420c811d4561 last_write_checksum: sha1:6b8ce48b3e662ea3bfd8a9be737e43cd1b051e39 @@ -1550,8 +1552,8 @@ trackedFiles: pristine_git_object: e88886f738fef9ad22e5efc74e3e0ea2cd8ceeb3 docs/components/openresponsesresult.md: id: 9795b7de3f92 - last_write_checksum: sha1:5c1834da4b2297e6cdc0328c8d9c026303f6b9b3 - pristine_git_object: 7980a1a0edea51a2fa9cde48f5f9554029ef827b + last_write_checksum: sha1:616759398ca0662e4e9b6bf424727b8b019cc379 + pristine_git_object: 1dd4efe3b7032b9dc3c86e4202bde0c8dcd97360 docs/components/openresponsesresultobject.md: id: a8c7f7bc0b24 last_write_checksum: sha1:3df49df80dda49ea4cb53f913931fd4754769b66 @@ -1578,8 +1580,8 @@ trackedFiles: pristine_git_object: 947a0b4decad7398ad4ddd0ff70a3a8cf95c5e87 docs/components/options.md: id: d57f3108a48d - last_write_checksum: sha1:33aba904de1c5bbbb772a34eaf56daa859a81143 - pristine_git_object: e695cb694be73ef388c6039ef8803a6ce146e500 + last_write_checksum: sha1:1b035f938558bfad488929b804e3a863f3cf0c9e + pristine_git_object: e14bae1858d5ed546b84b553a9e87bcfbfae22c3 docs/components/order.md: id: 16e6ae6962e7 last_write_checksum: sha1:a060705e562a2f3fc024c4fd8aa80604535b0bc1 @@ -1702,8 +1704,8 @@ trackedFiles: pristine_git_object: d7d592b96122136f2e4becd5edc72b95062d6237 docs/components/outputimagegenerationservertoolitem.md: id: 0a39a1c10949 - last_write_checksum: sha1:b7ffc78b0acdbd0c9e5c9b6a777e8e2e39ff16ee - pristine_git_object: 563b9e780a842074f1ea9da0a9b81133833609fc + last_write_checksum: sha1:794cbf0f99dc7ea2739d94d9ab96e2f3f07bb323 + pristine_git_object: ec9409ff0690e6787b0f464c83aa9cf5753fb4f6 docs/components/outputimagegenerationservertoolitemtype.md: id: e8483d8856aa last_write_checksum: sha1:43f034d1b716ef2878be034bb01e836395c7b686 @@ -1722,8 +1724,8 @@ trackedFiles: pristine_git_object: d9e663fcae49dba7885223f4f0848aa9f9a23002 docs/components/outputitems.md: id: 92565743132e - last_write_checksum: sha1:0080f5650ea184795c28fc44983eec2989b58634 - pristine_git_object: aaa3a85a2a72fba77cc2a3e939d8df3a00e1073e + last_write_checksum: sha1:58d753ef954e4e8d45c7d74a14257fac307eaf3d + pristine_git_object: 146c12f4dd9b8583c2a7874d80362b9182b1bb1b docs/components/outputlogs.md: id: 0821eefe9546 last_write_checksum: sha1:1ff4592093bd2fe28038cc8db28bee6a35025c96 @@ -1834,8 +1836,8 @@ trackedFiles: pristine_git_object: acbedfe1aca86bfe4d682abcd075b89d872e9e06 docs/components/outputmodality.md: id: 8e1105f01041 - last_write_checksum: sha1:6fe20f70faa190a188e00961cb8f13edb2dc371c - pristine_git_object: 7b8edcffcb042e3dd1115d6a2f976ac4d5967461 + last_write_checksum: sha1:f9d0e822a4f2da4631f55f01e6a168f0cfaef225 + pristine_git_object: 1644bdacc55db827ad4cb087550ddb8ceae11991 docs/components/outputmodalityenum.md: id: 9e9b5b751962 last_write_checksum: sha1:e445a894b182e6fd805d5b9310d13b8a8520349d @@ -1864,6 +1866,14 @@ trackedFiles: id: 2efd271441f7 last_write_checksum: sha1:36a63bf61d927a595f3e58dd0b607a8937db9ff3 pristine_git_object: 24800454b81c6b2f9a0180f283d793216bd90384 + docs/components/outputsearchmodelsservertoolitem.md: + id: 17da96b2505f + last_write_checksum: sha1:da40a4743d0ae6385588944cac094ce9bd4d14c9 + pristine_git_object: a5e1fb16896dc6841105b7f01e735539b8876a5b + docs/components/outputsearchmodelsservertoolitemtype.md: + id: 37be34b271c8 + last_write_checksum: sha1:237762e35b5cf89509bc3bf8b261f174016d3903 + pristine_git_object: dc9df5ca2122a044efa3d2ab1d13b2f957f67d34 docs/components/outputtexteditorservertoolitem.md: id: 6c114519044a last_write_checksum: sha1:7b90b5ce30ff6df03376e337e266dbdadfa751c0 @@ -2006,8 +2016,8 @@ trackedFiles: pristine_git_object: 56d2fd0642e93c72502597f761e75cf50ef6a597 docs/components/providername.md: id: fe24a77d9911 - last_write_checksum: sha1:47af6679dbedcf8d8d0ac8995cfc9cd3020a6b7b - pristine_git_object: 22effdd1f55bc9d60648a80e825e17d4b94b01c1 + last_write_checksum: sha1:f824508d7058025fba04264c5086e374c23e0a76 + pristine_git_object: 1136a77ac827853575c6ae83a4efdf0bd097fec0 docs/components/provideroverloadedresponseerrordata.md: id: c2a8cc4ec6df last_write_checksum: sha1:1d206d00dc0d91b5ceec470579c6ce345cc23d29 @@ -2022,8 +2032,8 @@ trackedFiles: pristine_git_object: 9dca4ee9d4a9ec0a46ce21fb3823f05e8e119334 docs/components/providerresponseprovidername.md: id: 800bab487911 - last_write_checksum: sha1:befe2d2077d8abc969729b09ce4aba6a2b14bb37 - pristine_git_object: 73838c84a7682a4b6903b0ab3383b6514ca6951e + last_write_checksum: sha1:2674cebb5d1bb256776d982001c05305c0a0e419 + pristine_git_object: 49b34491b8fc5c7b70462dcdd8d16fe0b0d3c002 docs/components/providersort.md: id: 290449b1880f last_write_checksum: sha1:f15d65e5c226a222c3bfc0b9f55dd9ca0443d415 @@ -2412,14 +2422,6 @@ trackedFiles: id: 0cf5ab254bc8 last_write_checksum: sha1:632fc2775ec4066a2b1ee403579ff59bdddb4a91 pristine_git_object: 4b82eb64344981f49f6a8fa220eb817427f4de78 - docs/components/textconfig.md: - id: 11301a29023b - last_write_checksum: sha1:62e407146de6b41467b9ec8c630ad8ad8a3f1743 - pristine_git_object: cb4ddd8f20f0302ac0550682d8e75f162c78c0b3 - docs/components/textconfigverbosity.md: - id: d49483ecf413 - last_write_checksum: sha1:a51ce28b6733aa1b579c3f9dacee605e08086497 - pristine_git_object: 0bdb609ebbb664477effde646423a619b74738b9 docs/components/textdeltaevent.md: id: 339fe3591c0d last_write_checksum: sha1:97aed7ba0e23221806738f4ed7819f8aec0db957 @@ -2438,12 +2440,8 @@ trackedFiles: pristine_git_object: 5c73058b054429983632f0542af4fc0fb50300c5 docs/components/textextendedconfig.md: id: 669e1815f825 - last_write_checksum: sha1:a64da07e11d1437c3c7453d7a6c8d3f2757a8af6 - pristine_git_object: cdda558b74a056f33dbc0f2cf63a02265087d7db - docs/components/textextendedconfigverbosity.md: - id: 355071ba1bcf - last_write_checksum: sha1:9457b6011994833a86a2223b544d9d7d1b7189b6 - pristine_git_object: bbb9988342a55552bdd3c0985cd9f6aa9a302bdd + last_write_checksum: sha1:7751fbe499ffee299268428faa3a3c63a5541796 + pristine_git_object: b876df7514e8427c7eb7bacd42461924d5b0796f docs/components/tokenizer.md: id: f1ad3417d8d1 last_write_checksum: sha1:4223f630f7d880b9288fb654f67817560fb2dbd8 @@ -2534,8 +2532,8 @@ trackedFiles: pristine_git_object: 36829dd7af525b1289daa3a84c583689dc5ae125 docs/components/updateguardrailresponse.md: id: 311d3e7a185a - last_write_checksum: sha1:240e2fc38ee1954caf6afb473cd9d85030b28285 - pristine_git_object: d88f7735cfa90be90763bbcfc7cbf1b8e12d7cf4 + last_write_checksum: sha1:30d7c6ef7475a6b09fbf3f3cd67cdc4fb3a4467a + pristine_git_object: 094c4b352de1442c4aac33bf2790f563dec3a20e docs/components/urlcitation.md: id: 02c4f88e5f51 last_write_checksum: sha1:5d5a717a552b86279bfe20c6125cb0561d2052dd @@ -2560,6 +2558,10 @@ trackedFiles: id: ad5d1b284346 last_write_checksum: sha1:30ebb41e8bac9a8d817b2c0ab0a9e9fded4a73ee pristine_git_object: 0698d06289a06a6cfcd35f7069f2ef64a0aa0e25 + docs/components/verbosity.md: + id: 0a9da5ac382d + last_write_checksum: sha1:76ec453c1e767ce0f8c76afc0617cdc7ff29b60c + pristine_git_object: cf10c9e56352e1ef074e794b915639774a0de872 docs/components/videogenerationrequest.md: id: cacead3ac9fe last_write_checksum: sha1:e9f69f5b244d468fbf3ecdd1872671fca4b4fc9b @@ -2746,8 +2748,8 @@ trackedFiles: pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf docs/operations/apitype.md: id: e271bff20dc7 - last_write_checksum: sha1:589d9ed0a91014cf2b66f83a118259aafb78983f - pristine_git_object: ffff0b9ea5cb410b51798b848ccf40a763edc216 + last_write_checksum: sha1:da6482291629866b38facb5b8cb2b65fa42f0246 + pristine_git_object: 2fab7cdc89cd708d30ecf5d3b23f61e115189b71 docs/operations/bulkassignkeystoguardrailglobals.md: id: 10cab63c9a95 last_write_checksum: sha1:5c7983931ef784a72f7dfec732eb7809d352c313 @@ -2846,8 +2848,8 @@ trackedFiles: pristine_git_object: 1ff75cb8fa59d2b7b756ea07e9f5849995b62435 docs/operations/createembeddingsusage.md: id: 2dc99973f6c7 - last_write_checksum: sha1:a51043a1dcc144a05c76c218c73ff3f413d313ec - pristine_git_object: ef0429e0678238d40901c630b48ab20680eee1f5 + last_write_checksum: sha1:b01ba733f5d1369b21a54b9f3bfb0e4059504b6f + pristine_git_object: 007fb235eef4ebb9b3dda14352e9a252004de4c2 docs/operations/createguardrailglobals.md: id: 34f5b2a17330 last_write_checksum: sha1:a43fb357b9c08974befd14a79da7623e72bc3245 @@ -2858,8 +2860,8 @@ trackedFiles: pristine_git_object: 5a414e26806520a98f50229a063f127f712054b0 docs/operations/createkeysdata.md: id: 903a6d611ab2 - last_write_checksum: sha1:fd7089b7dff765f863b0c02542c9e480656526a8 - pristine_git_object: f51f201d1e8c5c7216a508a652b154ca9fa20543 + last_write_checksum: sha1:78eb64a7cc6deeb3959adeb0ca705826f5f47005 + pristine_git_object: e60eaf9f45abcfdba122a7b04d1c66be31af48fa docs/operations/createkeysglobals.md: id: 15dd52d4443e last_write_checksum: sha1:032800ca0e8b56a1819431b9b27fa09a5b4b09c9 @@ -2874,12 +2876,12 @@ trackedFiles: pristine_git_object: f587de752afc6f5f82d55ba4b80f6d59336db24a docs/operations/createkeysrequestbody.md: id: 9aee51637cee - last_write_checksum: sha1:1d8572e91a7634a55014b51d6eff7be8e8e92690 - pristine_git_object: a384fabe3ae8b6d1fa3ead87957d9552591d7664 + last_write_checksum: sha1:dbd509a932f74e85a237fa1f4a2fab4c78af6c89 + pristine_git_object: e63e997bf3d6eba579db664fba80bd295c145f17 docs/operations/createkeysresponse.md: id: 42bb3427e12b - last_write_checksum: sha1:b3aab1702c99f425a12e00607278808682bcf666 - pristine_git_object: e74907571f4147d457e544df8bcf6e4bb5be38fa + last_write_checksum: sha1:e113e49e9b3aa54f0d8021d13be59fc533830a7e + pristine_git_object: 91744f3dce817f96d0f5bb44af9988f4c54feac2 docs/operations/creatererankglobals.md: id: 46c967a0d2ba last_write_checksum: sha1:9dffe3342695ec66163cb83423f441d527d4e561 @@ -2920,6 +2922,18 @@ trackedFiles: id: 5f7fc3c975e3 last_write_checksum: sha1:79a9815ab0129b3254e878501ebe5b2cd85c51e1 pristine_git_object: b6dddbc3a55f3297719a3648b699634e50ca2f98 + docs/operations/createttsglobals.md: + id: 42bf2b6a7087 + last_write_checksum: sha1:90523d8f180b8a9e9c45c0373aec2d13b18ffabb + pristine_git_object: 17fbce661cd2889f08825cbad321b649f755bb44 + docs/operations/createttsrequest.md: + id: 76dfbdf2ac95 + last_write_checksum: sha1:919810bdb4e14f4b2ea1f4902a9758bbd89cf013 + pristine_git_object: b8828feebbd252a50f081f2b0ad88f595ac47272 + docs/operations/createttsrequestbody.md: + id: 6bc2e74e7cdf + last_write_checksum: sha1:2d012e2dc2cee73657437181a15b1be4c9f61545 + pristine_git_object: b2035a020e0df7451605ffe83a318ef106271953 docs/operations/createvideosglobals.md: id: 356f4c73b7c4 last_write_checksum: sha1:c639cea73f4e6c596f5b1fe567fa9b0c584caa6d @@ -3018,8 +3032,8 @@ trackedFiles: pristine_git_object: 2855d5b95d41a494bc7ffa9f85c74ff27a46ca96 docs/operations/getgenerationdata.md: id: 89a3aab8da20 - last_write_checksum: sha1:a535e1604ef9524eb8fb752711abd36dbe7219c6 - pristine_git_object: 7be5766a6c6a5f065834bdbbec761795c255689f + last_write_checksum: sha1:a9390399582e009205faf25c8b1de90b1dad0db7 + pristine_git_object: 183399a0b5f704e790a1d2777cd45ec886154a5e docs/operations/getgenerationglobals.md: id: 0d6e856c5861 last_write_checksum: sha1:b5236815132dedf2b595fd520f1753d5ec8bb6e0 @@ -3042,8 +3056,8 @@ trackedFiles: pristine_git_object: ad49c823ffd11b46d8a8ce2a67eed5bd71d09db8 docs/operations/getkeydata.md: id: 4fba05263947 - last_write_checksum: sha1:15596e6d829847c4916aa0c8cc2d53f47cf43295 - pristine_git_object: 5ba4a1f8bb80defa921093533a2c7e5f1a4c45a2 + last_write_checksum: sha1:914831859afa885b63cf4d8a252ae16997007438 + pristine_git_object: c5a3db6f9a847b1fafaca37b04e58e0f63cf77e0 docs/operations/getkeyglobals.md: id: 7f990e0efc1e last_write_checksum: sha1:12dcc44c433951cdd8c4136ae1a70702e2b3e47d @@ -3054,8 +3068,8 @@ trackedFiles: pristine_git_object: b7b0a302d24d5964ce5a4bd24672d766362564cf docs/operations/getkeyresponse.md: id: c145b1a0dd5f - last_write_checksum: sha1:71d93bb73bc10bb55afe1d816f2c839b43528c96 - pristine_git_object: 7959a400503db3233fc13546d4b63995690d5984 + last_write_checksum: sha1:c315584d278f8f91f4437479ef8e95ce48b3130c + pristine_git_object: 72e8055b7d9b0de224ea423fab24a5614d6e9da3 docs/operations/getmodelsglobals.md: id: 61588f3029c8 last_write_checksum: sha1:f1565d45f3d06f070a8bc5ebe53d6205656b4b3b @@ -3098,8 +3112,8 @@ trackedFiles: pristine_git_object: 655cca3c9dde2904f47187955063ed1def505e47 docs/operations/listdata.md: id: 3a3029670d40 - last_write_checksum: sha1:3849b8da164914dd9aedabf0982439c1e1bef02e - pristine_git_object: d8fcbe3395bbf9581c75455e3c0c49dae72f73a2 + last_write_checksum: sha1:1384605ff96cc0e7797d7dd2ff42752fe980d91e + pristine_git_object: d2a0b36ca2cbc9e297beba6471f7838b12b0b783 docs/operations/listembeddingsmodelsglobals.md: id: 29c3a9629ff7 last_write_checksum: sha1:a8b2d679ac7a558761e4289233d31084f4f7663e @@ -3166,12 +3180,12 @@ trackedFiles: pristine_git_object: 4a623f2b7664346b324037e5e099cc19a22e0f99 docs/operations/listguardrailsrequest.md: id: c00416201071 - last_write_checksum: sha1:59f051110dcbb0bff3ef96bb5f098b561a810c43 - pristine_git_object: 65946b14204dcd39c2a43303d56e62439506a07b + last_write_checksum: sha1:e73c3a5dab8af65b85eafbacaa9c3e7bff99ce3d + pristine_git_object: e6f8126048b2344f42c86d1df9e472b9b0618bc7 docs/operations/listguardrailsresponse.md: id: 0e85f301aa5c - last_write_checksum: sha1:ef8d1dd575f41c8fdbefce870526326b9f213912 - pristine_git_object: 3046aeb171cb27a5ce37814a5723e3fae8ef2969 + last_write_checksum: sha1:8d23f9946567190f0e7c5ffede3c7ee23c20dc32 + pristine_git_object: 1bb2d533834b2fb807868313475e316c43499671 docs/operations/listkeyassignmentsglobals.md: id: eb16fba53032 last_write_checksum: sha1:823375a0dc84574748befda39821c790b469a6b4 @@ -3254,8 +3268,8 @@ trackedFiles: pristine_git_object: 922cc65548995e12edbe83abf86732c4190c7a97 docs/operations/listrequest.md: id: 40bb7fe37ce6 - last_write_checksum: sha1:36a84dbd57ce7422a28707449d645c467d77dcb4 - pristine_git_object: 5507b0aa07c0220cfdad1e7ec264f0d74cd2ac94 + last_write_checksum: sha1:dd1cdb3c672fb456b05afa8c838bfca5e7a4f2db + pristine_git_object: a5646bdeb6412940b9f6f2320315d9f1f58788d6 docs/operations/listresponse.md: id: 14450e1d6614 last_write_checksum: sha1:e432e29d3c7de8517cc16b59b958134ec561f09c @@ -3284,10 +3298,26 @@ trackedFiles: id: 7a144a9c7a29 last_write_checksum: sha1:5f009bd24fd951128cdc546a6a5c937ab0426387 pristine_git_object: 4f8c20dd33dceafda3362119a1cfb1e5133810d1 + docs/operations/options.md: + id: ab00aa7aa4e4 + last_write_checksum: sha1:1b035f938558bfad488929b804e3a863f3cf0c9e + pristine_git_object: e14bae1858d5ed546b84b553a9e87bcfbfae22c3 + docs/operations/prompttokensdetails.md: + id: 4e204e79631e + last_write_checksum: sha1:ef933f99c0536defe9d256dffa169b8752d3acc6 + pristine_git_object: ed43c6c17061267e697480a5276ae5ae5e89145f + docs/operations/provider.md: + id: 9d89f101fabf + last_write_checksum: sha1:b91b27519ff10e436a7407728268e6dd5bac4f47 + pristine_git_object: 71ad490ab430d964f966e7f471a274852aefdeb1 docs/operations/ratelimit.md: id: 55ccfab9dcb0 last_write_checksum: sha1:ba383320e312bc87bd156a5d338f3d973376ec02 pristine_git_object: eeed3720e0eef6a871483dabd4a345495b466339 + docs/operations/responseformat.md: + id: b6fbaacf116b + last_write_checksum: sha1:22d7dd7aa9450d206abf2f00f6ec01c1cf2eedd4 + pristine_git_object: f0c6c3af35e6314be8f792204cc9bf73f79825ef docs/operations/result.md: id: 432b3cd4c69c last_write_checksum: sha1:1eab024add8cac132cf311dcb6d569e059aa7329 @@ -3330,8 +3360,8 @@ trackedFiles: pristine_git_object: 58ac81b1a12447b17d1da21f1b2275b32e2c2ca7 docs/operations/updatekeysdata.md: id: 989d7ddeeb46 - last_write_checksum: sha1:bf9ed436df63ce56f2b3c570f96bed89ebe42400 - pristine_git_object: 499598c65d3218fac3da20e1f6a42e8f6d691c16 + last_write_checksum: sha1:81679927eccfbb9957d4cc3454668f9cc60458dc + pristine_git_object: f1ef38208b77ffa7eabeb448a4d6b7894315dcb0 docs/operations/updatekeysglobals.md: id: fe06e9820a16 last_write_checksum: sha1:bc44e1936abe8d3ce77e223aacb0326143a4a812 @@ -3350,8 +3380,8 @@ trackedFiles: pristine_git_object: a6130fd788229ee52843ebbb537b1a9ef6601278 docs/operations/updatekeysresponse.md: id: 594f08a35b03 - last_write_checksum: sha1:f4a1479f7df16e20dcc7f9259245163c0550d423 - pristine_git_object: c1dde7cca4a08be11d91f1f97bea5d2a08ab5d6e + last_write_checksum: sha1:4590d0a24f313d60e4e7e18688eac54e755151a1 + pristine_git_object: 8b5ef1fca6768575bb49ed510fd83b27c77db805 docs/operations/usagelimittype.md: id: f83f3fcb36f8 last_write_checksum: sha1:9c272d9908a57fdbd2b376e13c8fd226e7d4ce65 @@ -3362,8 +3392,8 @@ trackedFiles: pristine_git_object: 44f78122819ded7e472e28ebcf37dd8812707097 docs/sdks/apikeys/README.md: id: e2bd25998427 - last_write_checksum: sha1:59291dbba3de15ee545d124fb51232152b2c7e4a - pristine_git_object: 0e6da8598106dcd4130e57ef747c365915ed0c79 + last_write_checksum: sha1:82bec11fedf21eed760739e1adb08fec06239279 + pristine_git_object: 6e72f51df9e9811cee424032f7dba0887e15afec docs/sdks/chat/README.md: id: 393193527c2c last_write_checksum: sha1:74076b3d74207ac98f47e323bd2badbeeb604e3f @@ -3386,8 +3416,8 @@ trackedFiles: pristine_git_object: 332b5683cfe8c07ce4cae93b3247cd56f545f535 docs/sdks/guardrails/README.md: id: f72b38a5a2a7 - last_write_checksum: sha1:e55d9d4938da4dd306775c589d48e99e7f169870 - pristine_git_object: 7bcdbb6e6baa29cc411a01eb20c3ee63064dc8ea + last_write_checksum: sha1:add43f6da46b1511a68bdc4bdf6b02cf6d20eaa6 + pristine_git_object: dfb499d3d37d059f1116ab61709e33e8abdb2884 docs/sdks/models/README.md: id: b35bdf4bc7ed last_write_checksum: sha1:ac628dd17b528a4772ef0797c4c47906faf8dc40 @@ -3412,6 +3442,10 @@ trackedFiles: id: e717bad14f63 last_write_checksum: sha1:02f29159f69cbc264437745e1d7cd54ed7e30ced pristine_git_object: a38d2b1b819d977c739f6a7b6f55344514c5447c + docs/sdks/tts/README.md: + id: 0c425074d09f + last_write_checksum: sha1:ae24d9a76749b199f45b01dce50b247f5d069c87 + pristine_git_object: 602540d5f511ffbb63e9b232caa773a3f0c00146 docs/sdks/videogeneration/README.md: id: b6dbf7b0729c last_write_checksum: sha1:594c4bbe8b2396d28e4a5fe664e21de4d2dc8444 @@ -3422,12 +3456,16 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:fe68c7165977ede3cf438be1344f72e54cf67919 - pristine_git_object: c678027236e18070a0081d37fb78bfd44392a8c0 + last_write_checksum: sha1:62d35f2ecbe840540100da937920ee63980a1e12 + pristine_git_object: 9e4606d0c68e092819b9d86eb23859bd85c5ede7 + scripts/prepare_readme.py: + id: e0c5957a6035 + last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 + pristine_git_object: 03e9f9b59063c73d6f24995a77cdb971f3318d30 scripts/publish.sh: id: fe273b08f514 - last_write_checksum: sha1:adc9b741c12ad1591ab4870eabe20f0d0a86cd1a - pristine_git_object: ef28dc10c60d7d6a4bac0c6a1e9caba36b471861 + last_write_checksum: sha1:b290b25b36dca3d5eb1a2e66a2e1bcf2e7326cf3 + pristine_git_object: c35748f360329c2bc370e9b189f49b1a360b2c48 src/openrouter/__init__.py: id: 4514650f64eb last_write_checksum: sha1:da077c0bdfcef64a4a5aea91a17292f72fa2b088 @@ -3446,16 +3484,16 @@ trackedFiles: pristine_git_object: 07ace03229fd3267623c8f48665d2c3a67c3565d src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:8283c360656da42036d190270a7ad47551bc4317 - pristine_git_object: 4d43d337f71492564f02b651e5bfc78d27932ac5 + last_write_checksum: sha1:dd226a1c87253767a3a41d735f600db8980faa45 + pristine_git_object: fcebde34f88b9450f406b1563d00942dbd6d7b80 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:6d47d1ab3da9cb4ac9f0a2bfe442f1a82a614f35 pristine_git_object: ea004eaf47a1a48622d4a4276fba1e329d5559ab src/openrouter/api_keys.py: id: 876fac88fff6 - last_write_checksum: sha1:749055fb2e5719d1cdc72c4391d83cb498e37080 - pristine_git_object: 923a5f8c432f42427caa517e5fb1fab9b10f029e + last_write_checksum: sha1:4c037d1c4fc922061ca968b9cd961b2db69429f6 + pristine_git_object: e4a30e1b293a197994317a1e2169619fcbd0a0c6 src/openrouter/basesdk.py: id: c5733c5a1e12 last_write_checksum: sha1:71f242fd9955e5a17a8d055e2210cc2708bb94fc @@ -3470,8 +3508,8 @@ trackedFiles: pristine_git_object: bfa078ebbbff63f2c80860abf718fc57abcac2bd src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:fba957e705a1e6222a64cdd71111390c6e14826e - pristine_git_object: e41de295792aaaea529e94d6c70c3ee111266202 + last_write_checksum: sha1:24ac44b6fc1dc2ed3b7f73a33c8c76b0ee924642 + pristine_git_object: cce159ecb2d000232c002caceef3ad73ab5b6073 src/openrouter/components/activityitem.py: id: 3bbe7d35f459 last_write_checksum: sha1:32b873ba5c0a9dbf5f0cf32c0217ce17395ae69e @@ -3754,8 +3792,8 @@ trackedFiles: pristine_git_object: 22758a015ceb978263246b58da19d382ae38938e src/openrouter/components/createguardrailrequest.py: id: 34d69149fb33 - last_write_checksum: sha1:8ee78165a84f16ed848fc6ce3ac7898df7d1a60c - pristine_git_object: c6dd6d6088287c6f1cf8adc4841ba5756e59031e + last_write_checksum: sha1:13b1d5f69acc3af92a344d086f85c12652d77d33 + pristine_git_object: 421b13f4c09641965bc4a17a38a5bedb8016460c src/openrouter/components/createguardrailresponse.py: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 @@ -3858,8 +3896,8 @@ trackedFiles: pristine_git_object: 6cdeb99e76ab6ad2e22b13164efbdb68cf8f328d src/openrouter/components/guardrail.py: id: 67ee78dd06e6 - last_write_checksum: sha1:51ab908cd40c1dad9c499c4dec4ebb29ecd94b87 - pristine_git_object: afc25c729b3d7583ea116b1fbdb0e0e3e06aac3a + last_write_checksum: sha1:b55997d74e312405119e037e70ea847615fe80c5 + pristine_git_object: 64bb092555bc83d71e02d00287e1975251f065c3 src/openrouter/components/guardrailinterval.py: id: 01687fc135ab last_write_checksum: sha1:430f886f371b85777346de663202d62708cd84cf @@ -3894,8 +3932,8 @@ trackedFiles: pristine_git_object: c9609dbda39bbc43666c9625cf58baf469a6160c src/openrouter/components/imagegenerationservertoolconfig.py: id: 76f45207c1be - last_write_checksum: sha1:8d092f865ab995390b0370627657a8689c6a36aa - pristine_git_object: 7b7010abb24612645e134c7052a9475ca327b2d5 + last_write_checksum: sha1:065e1ab5d5e29f01bc86428ecb438ad9f7f9dc7b + pristine_git_object: 0fdc8f67a8af50e789e2ae73d647d9ba43b703b2 src/openrouter/components/imagegenerationservertoolconfig_union.py: id: d1c630a1476a last_write_checksum: sha1:50d45b5a787e8cc9024c05b31e4113993ffe4038 @@ -4058,8 +4096,8 @@ trackedFiles: pristine_git_object: 08d990d8cc07b7928158fc55784cd9d613f4c58b src/openrouter/components/openresponsesresult.py: id: 78f7e33b19e6 - last_write_checksum: sha1:8dd339b5021699b49dbfcff86e388947f61d5747 - pristine_git_object: fa04955d5675d8aef3ff3deaeb6560c7a0070f4f + last_write_checksum: sha1:4f234023126aad91df715d99450768fc2ed3252b + pristine_git_object: ea63258a915e1cd5663aa9f352f83af40f50e4a2 src/openrouter/components/openrouterwebsearchservertool.py: id: f5400a5de3cd last_write_checksum: sha1:e1cd10158e15f88d5c2903b1508a42d4006f4f3f @@ -4110,16 +4148,16 @@ trackedFiles: pristine_git_object: abaaa53610171f25ed9d814f355f9a600101b254 src/openrouter/components/outputimagegenerationservertoolitem.py: id: cb34639447d7 - last_write_checksum: sha1:2383f1a2904297a4289e0523778bb928f5614d1f - pristine_git_object: e91756b3e8d3e46283706192f9e44d03770d0fb3 + last_write_checksum: sha1:21f58c84bea8a3ace8b91bba914e54cf62dad70e + pristine_git_object: a94bd0964eb714782858820e0db39afc28a0dcc3 src/openrouter/components/outputitemimagegenerationcall.py: id: 0b4cbdbd733f last_write_checksum: sha1:f9ea61a170b8e516108d2d59b0e7df9d264d3aad pristine_git_object: 897c4727eec2497fe15e5603187e24218c08ac87 src/openrouter/components/outputitems.py: id: 90f107de3116 - last_write_checksum: sha1:3e25cbb638d9f753193e6c7882077468032a30f8 - pristine_git_object: 4457f805c46470e36ff5cfd30eebab43e0039a96 + last_write_checksum: sha1:0f241fcf9e8eb3dd8b315c6efee2d4017d0203fb + pristine_git_object: 75ffbc584663c12c8e7629145a76ca8d60b7de75 src/openrouter/components/outputmcpservertoolitem.py: id: bb8c2536a58e last_write_checksum: sha1:6cbe556b2268af0142d982007b273cc43b7605c7 @@ -4138,8 +4176,8 @@ trackedFiles: pristine_git_object: ec59a9d5b4c96843033bd73783a7b923fb741928 src/openrouter/components/outputmodality.py: id: 74c79e4cad45 - last_write_checksum: sha1:76cc17e2a535074d823d7250c3e856d165ceeb70 - pristine_git_object: c926bb65891bd067cfbf45ae48f960a63820aa70 + last_write_checksum: sha1:20b876e2df7a4fa278d413e7fa45e273ec1cfa19 + pristine_git_object: 4d38da683d5e4e37193312e4ec5b2886b65ec0c2 src/openrouter/components/outputmodalityenum.py: id: 82bebf193d55 last_write_checksum: sha1:2983ef9a3c82244eff5f8b1184637a1fef13573c @@ -4148,6 +4186,10 @@ trackedFiles: id: 0bc0568f44f9 last_write_checksum: sha1:3c460a262ff94910ea443fa6ac7d3f6608c3209f pristine_git_object: 50eff94f87fe82aba4fe330ee61e79ab885847fc + src/openrouter/components/outputsearchmodelsservertoolitem.py: + id: ba87dc220c62 + last_write_checksum: sha1:f9682aae6fc8cafa19217af10d745180cacde1e2 + pristine_git_object: f94949d2e5aedf4873295efcdf87f0f5367c1d32 src/openrouter/components/outputtexteditorservertoolitem.py: id: 2a5dc9318fe6 last_write_checksum: sha1:75ce53e78b352b0427acfb5310b2500ee76351dd @@ -4226,8 +4268,8 @@ trackedFiles: pristine_git_object: 72dd15242d7d35b2b493f90d0cdebf6f8a51d684 src/openrouter/components/providername.py: id: fcc722fa2fce - last_write_checksum: sha1:5f1b8a8471ab3d11bd0d18927a9cd9c747bababe - pristine_git_object: 7764a12512827640f3c32a22b199b09cd890b57f + last_write_checksum: sha1:be70b906ae9d172c5e5310728d3a4e83cff153ab + pristine_git_object: 109379a879ba8882755e0f069963062e0d792a06 src/openrouter/components/provideroverloadedresponseerrordata.py: id: 5b693682570e last_write_checksum: sha1:41a977452d58b52cb9d4b3a85f4b7970529352d5 @@ -4238,8 +4280,8 @@ trackedFiles: pristine_git_object: 5145815e6196470f3f5f24893afdc4415d27c53e src/openrouter/components/providerresponse.py: id: ad3887be54c5 - last_write_checksum: sha1:d5988a5d8c6174971287275305c6b638b6325940 - pristine_git_object: 4856eee2be0d7aeaadc4cbacd0ba1b08e5886999 + last_write_checksum: sha1:7c354d7847c0714711db5b75350ec406222f443d + pristine_git_object: 14f4f7ed497f6d78c51be562f3b6274c7496ef95 src/openrouter/components/providersort.py: id: 348e382bf494 last_write_checksum: sha1:57551507f95cd2e16ef995e1c13f859fd0726152 @@ -4420,10 +4462,6 @@ trackedFiles: id: e39bb8998edb last_write_checksum: sha1:cd5570f2a08ea1c0315dfcbc0e4d704610adca41 pristine_git_object: 49f4ae2d09fa5d311465a0a77f7cede0f97f779a - src/openrouter/components/textconfig.py: - id: cbd40c12b745 - last_write_checksum: sha1:737f5adabb641d1d30152cee2f9a8db1e43d697b - pristine_git_object: cf8fa534d38146d0734b6161264406d5d53b7955 src/openrouter/components/textdeltaevent.py: id: 6d1d416a373d last_write_checksum: sha1:9a024e07b3f2d65d5f88e01f0e2035efd956f3fc @@ -4434,8 +4472,8 @@ trackedFiles: pristine_git_object: 9bc3b1fd09ca7d4be981ceb7b10e14fb157dbb5f src/openrouter/components/textextendedconfig.py: id: 150a449e46de - last_write_checksum: sha1:8e6dd8672fcc687c8a930c533d94daac4bb4ce5d - pristine_git_object: ee561b18699c16f952bc036a2d0903e0ea3a8d9b + last_write_checksum: sha1:81f539fffffee92247de216b1ddc9269b02fcd54 + pristine_git_object: 89224c7a342575e694ac269e1773c4c2a0ad5c07 src/openrouter/components/toolcallstatus.py: id: 32339139c3f3 last_write_checksum: sha1:a75631cdb460f190aa10d5557519519d1ef5fbe3 @@ -4486,8 +4524,8 @@ trackedFiles: pristine_git_object: 3ff415b693496c00c41261d09e7c0c12d83730fd src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c - last_write_checksum: sha1:f892d1c5506561312151604aa837b90546603d7f - pristine_git_object: db54f129779d55863e0ea63affc0600700d2fcaf + last_write_checksum: sha1:5849b89902428311a0328c40e472c6f796119ffa + pristine_git_object: 4efa2a085160d7eac83b1677584dbc8b76c3d021 src/openrouter/components/videogenerationresponse.py: id: 541f1321b072 last_write_checksum: sha1:051ace67776106616ec4c8e55cf2df9a99855d0f @@ -4658,8 +4696,8 @@ trackedFiles: pristine_git_object: fddcce7468125b281b22f520928ee5d31f027fc5 src/openrouter/guardrails.py: id: 705839f34e66 - last_write_checksum: sha1:b8b1ea14cd57a7f4100f63efbe76d3baf5e62254 - pristine_git_object: 7d1038da0c7b1e6989aaeb070b1a2081157b53e1 + last_write_checksum: sha1:d6dc827f53d97b7764d5e6f98c53eafb133e3be2 + pristine_git_object: f80ac692626e67574877c5503e1e004461becde1 src/openrouter/httpclient.py: id: e9311185443d last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 @@ -4686,8 +4724,8 @@ trackedFiles: pristine_git_object: ef6eb9aa10d9b067d96dad78a1d34f939c1091e8 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:ec3ab8fd0729912259f86a370453dd311f440953 - pristine_git_object: 8c2b3198136aec28d1b51abc1b12386429039561 + last_write_checksum: sha1:4847eea2656150261024403d68ca3f4fa392e53e + pristine_git_object: 1dcc933e305a6fc382d40fb44c746098d2a7fa45 src/openrouter/operations/bulkassignkeystoguardrail.py: id: 6d8435d51d9d last_write_checksum: sha1:2136b0223191e5d8159c77cff06845958930184e @@ -4710,16 +4748,16 @@ trackedFiles: pristine_git_object: d3ef6c4b8374be3dfa5d807f879a430e50dc444e src/openrouter/operations/createembeddings.py: id: fe1160a960e9 - last_write_checksum: sha1:7c43b2de3e40ec1fcbac46f4bc89ae6fbf5eb95d - pristine_git_object: 3872d32380bd3ae8cb9cdb6d7420a4e32464596f + last_write_checksum: sha1:e152bffcd6eee6a8787f529b2e5b29786e3c7f09 + pristine_git_object: e0efba7b495001313dcc86a7e725269eb636b92a src/openrouter/operations/createguardrail.py: id: 52ed4b2f5903 last_write_checksum: sha1:119141c01d19df6b6d090b67f80145e3bf4d4d60 pristine_git_object: 75b9661b38be99f2a067eda4051592111301bed1 src/openrouter/operations/createkeys.py: id: 64ad31fdaa6c - last_write_checksum: sha1:2d9152fa4d928959e6fa6fd87064a5eff9593f85 - pristine_git_object: 5ed218dc83d851e8ccf7da73203c7677c7ef75c5 + last_write_checksum: sha1:41931fecbca34b228d5fe6230810eb6bf9271250 + pristine_git_object: 6d18cf707841629cc63ed2ed56aacd67f639a717 src/openrouter/operations/creatererank.py: id: 99b5d368a168 last_write_checksum: sha1:86b7c32d7b0bb77f16b9926384c47774e9e25c6a @@ -4728,6 +4766,10 @@ trackedFiles: id: afb834172b62 last_write_checksum: sha1:55f5ba6a2eafc9d0519fa5aa072a1c22e42ed5f2 pristine_git_object: e92bbc2995c3a3769c9cc45b0a6b6b690e67d02c + src/openrouter/operations/createtts.py: + id: d3832f076d20 + last_write_checksum: sha1:5306ac966304d80a1e75c8ddde1e57af7443529c + pristine_git_object: 02cc51dcbf2807810817d3c6c46fce6c5f94c395 src/openrouter/operations/createvideos.py: id: d52f6a4a3fe4 last_write_checksum: sha1:12507b8087961d8efe67590e8c5b93f47a9d1a23 @@ -4754,16 +4796,16 @@ trackedFiles: pristine_git_object: 2d26173fd7e4555e188999eee1e282e85b68c73d src/openrouter/operations/getgeneration.py: id: d7c64961334f - last_write_checksum: sha1:8816e63b89634cc5b5df7ef6119421224965e529 - pristine_git_object: 94dfcb738c716d409f17be7a2e11485531d90a34 + last_write_checksum: sha1:e25661705812b44a6bd4180c424cd8ebb71ed9d4 + pristine_git_object: a7e457e7e76fad582add7447ad676e034592cb1c src/openrouter/operations/getguardrail.py: id: 9b3309b59c64 last_write_checksum: sha1:f83b3d52731324d0bc87c382196b84713e77f6da pristine_git_object: e3a2ca2914e9add5060e7efa73dd268d5e32a9a5 src/openrouter/operations/getkey.py: id: d9769da90865 - last_write_checksum: sha1:3630fb35d372c6541061cf2d425ebf58acc336f7 - pristine_git_object: ec3948b6b7c470258a3dfe10d304c2d52bd68b04 + last_write_checksum: sha1:511b994a0bd1241856b06184f05433bec3a16733 + pristine_git_object: d2370a94a10fadec861d31e6fd1a9b2566e94d22 src/openrouter/operations/getmodels.py: id: 5bd5dfcb0125 last_write_checksum: sha1:013ccee44da99aa609f290aef9f253e64dca38c6 @@ -4778,8 +4820,8 @@ trackedFiles: pristine_git_object: 3a120ed0aacd7ac94b3421fc1439e1308d53f83f src/openrouter/operations/list.py: id: 3ced31e3804e - last_write_checksum: sha1:a160c202d3cce31f3cb2f9cc911d5e4cd9c44c30 - pristine_git_object: e1d703cfe6485faee33c1ca4a7599b9c950bb7af + last_write_checksum: sha1:aeaae46cbe0e9403241e50baab791212404b29a0 + pristine_git_object: bf9965a274d7249abb169adb43c8358b1ee73105 src/openrouter/operations/listembeddingsmodels.py: id: bf749a1f23d6 last_write_checksum: sha1:654a4e7e7b486f1d321eeb11ef7a7fa928e501a6 @@ -4802,8 +4844,8 @@ trackedFiles: pristine_git_object: c9c8c3ec5ea6ebcf1e160aa1e3ec41390bcbdfe3 src/openrouter/operations/listguardrails.py: id: c99a9e7be93c - last_write_checksum: sha1:0a38c88bb6f4f89dc5dd671d6d8b752902e042b5 - pristine_git_object: 8345e0e2d960cb1df76f5a8c60dd7817db7d22f8 + last_write_checksum: sha1:f82932a120516264880ec2defa377bb03a56071f + pristine_git_object: f91db9e67fe3a10b2fffd681a517a65eee4df8c8 src/openrouter/operations/listkeyassignments.py: id: e26c11d1bd3c last_write_checksum: sha1:2c4e9b2dac5566beb3b4f1331686ec45c174e021 @@ -4846,8 +4888,8 @@ trackedFiles: pristine_git_object: b3675a1d1a828f26750e5b7ac98fb7cf42ed49e1 src/openrouter/operations/updatekeys.py: id: 56fb213253a8 - last_write_checksum: sha1:cd60ee4ccc84dc5e491edc2df0780f2ea757d3ae - pristine_git_object: a8d2f865c3915c75bfef1865f567c3ffe6129bf7 + last_write_checksum: sha1:d7eeeaae7c738016d176985c529b9a60df5f7966 + pristine_git_object: 8ea23655b38916560ec65dc2f37842812add7c3f src/openrouter/organization.py: id: 6f4c63c416e8 last_write_checksum: sha1:4ca00158cd6a4971e7a4cf6da1ef084da25630d9 @@ -4870,12 +4912,16 @@ trackedFiles: pristine_git_object: 4844bc0a635f0d4450e617c4a66810ff9e55890e src/openrouter/sdk.py: id: ee9846c4c9c5 - last_write_checksum: sha1:af0469095dac69b5b92dd0f717ecf193a9c353e2 - pristine_git_object: 43d1636646e181c09eaa9a42cae71c53d8ee9f1e + last_write_checksum: sha1:a78099e4aa3470355b38ed1db8e61999c6af3c57 + pristine_git_object: 8b26010939b1294301fb2e0a0ecdc3f142ba547a src/openrouter/sdkconfiguration.py: id: 55773bb98d7c last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001 pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 + src/openrouter/tts.py: + id: 5055d4b95f1d + last_write_checksum: sha1:ff84cecddfa83ca30a41585d2c7c7a4ae69e28f9 + pristine_git_object: f06e5fc53c13fb040a714e27da7a22cef9eebf25 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:140ebdd01a46f92ffc710c52c958c4eba3cf68ed @@ -5098,7 +5144,7 @@ examples: id: "gen-1234567890" responses: "200": - application/json: {"data": {"api_type": "completions", "app_id": 12345, "cache_discount": 0.0002, "cancelled": false, "created_at": "2024-07-15T23:33:19.433273+00:00", "external_user": "user-123", "finish_reason": "stop", "generation_time": 1200, "http_referer": "", "id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "is_byok": false, "latency": 1250, "model": "sao10k/l3-stheno-8b", "moderation_latency": 50, "native_finish_reason": "stop", "native_tokens_cached": 3, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_prompt": 10, "native_tokens_reasoning": 5, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_media_prompt": 1, "num_search_results": 5, "origin": "https://openrouter.ai/", "provider_name": "Infermatic", "provider_responses": [], "router": "openrouter/auto", "streamed": true, "tokens_completion": 25, "tokens_prompt": 10, "total_cost": 0.0015, "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "upstream_inference_cost": 0.0012, "usage": 0.0015, "user_agent": ""}} + application/json: {"data": {"api_type": "completions", "app_id": 12345, "cache_discount": 0.0002, "cancelled": false, "created_at": "2024-07-15T23:33:19.433273+00:00", "external_user": "user-123", "finish_reason": "stop", "generation_time": 1200, "http_referer": "", "id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", "is_byok": false, "latency": 1250, "model": "sao10k/l3-stheno-8b", "moderation_latency": 50, "native_finish_reason": "stop", "native_tokens_cached": 3, "native_tokens_completion": 25, "native_tokens_completion_images": 0, "native_tokens_prompt": 10, "native_tokens_reasoning": 5, "num_input_audio_prompt": 0, "num_media_completion": 0, "num_media_prompt": 1, "num_search_results": 5, "origin": "https://openrouter.ai/", "provider_name": "Infermatic", "provider_responses": [], "router": "openrouter/auto", "streamed": true, "tokens_completion": 25, "tokens_prompt": 10, "total_cost": 0.0015, "upstream_id": "chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946", "upstream_inference_cost": 0.0012, "usage": 0.0015, "user_agent": "", "web_search_engine": "exa"}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "402": @@ -5175,7 +5221,7 @@ examples: speakeasy-default-list: responses: "200": - application/json: {"data": [{"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5}]} + application/json: {"data": [{"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}]} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "429": @@ -5188,7 +5234,7 @@ examples: application/json: {"name": "My New API Key"} responses: "201": - application/json: {"data": {"byok_usage": 0, "byok_usage_daily": 0, "byok_usage_monthly": 0, "byok_usage_weekly": 0, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "My New API Key", "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "name": "My New API Key", "updated_at": null, "usage": 0, "usage_daily": 0, "usage_monthly": 0, "usage_weekly": 0}, "key": "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"} + application/json: {"data": {"byok_usage": 0, "byok_usage_daily": 0, "byok_usage_monthly": 0, "byok_usage_weekly": 0, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "My New API Key", "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "name": "My New API Key", "updated_at": null, "usage": 0, "usage_daily": 0, "usage_monthly": 0, "usage_weekly": 0, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}, "key": "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"} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -5197,6 +5243,8 @@ examples: application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} updateKeys: speakeasy-default-update-keys: parameters: @@ -5206,7 +5254,7 @@ examples: application/json: {} responses: "200": - application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "Updated API Key Name", "limit": 75, "limit_remaining": 49.5, "limit_reset": "daily", "name": "Updated API Key Name", "updated_at": "2025-08-24T16:00:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5}} + application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": true, "label": "Updated API Key Name", "limit": 75, "limit_remaining": 49.5, "limit_reset": "daily", "name": "Updated API Key Name", "updated_at": "2025-08-24T16:00:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -5240,7 +5288,7 @@ examples: hash: "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943" responses: "200": - application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5}} + application/json: {"data": {"byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_monthly": 17.38, "byok_usage_weekly": 17.38, "created_at": "2025-08-24T10:30:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "disabled": false, "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", "include_byok_in_limit": false, "label": "Production API Key", "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "name": "My Production Key", "updated_at": "2025-08-24T15:45:00Z", "usage": 25.5, "usage_daily": 25.5, "usage_monthly": 25.5, "usage_weekly": 25.5, "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "404": @@ -5262,7 +5310,7 @@ examples: speakeasy-default-list-guardrails: responses: "200": - application/json: {"data": [{"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Production Guardrail"}], "total_count": 1} + application/json: {"data": [{"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Production Guardrail", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}], "total_count": 1} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "500": @@ -5273,13 +5321,15 @@ examples: application/json: {"name": "My New Guardrail"} responses: "201": - application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "My New Guardrail"}} + application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "My New Guardrail", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} getGuardrail: speakeasy-default-get-guardrail: parameters: @@ -5287,7 +5337,7 @@ examples: id: "550e8400-e29b-41d4-a716-446655440000" responses: "200": - application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Production Guardrail"}} + application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Production Guardrail", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "404": @@ -5303,7 +5353,7 @@ examples: application/json: {} responses: "200": - application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Updated Guardrail Name"}} + application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Updated Guardrail Name", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "401": @@ -5573,4 +5623,32 @@ examples: application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createTts: + speakeasy-default-create-tts: + requestBody: + application/json: {"input": "Hello world", "model": "elevenlabs/eleven-turbo-v2", "response_format": "pcm", "voice": "alloy"} + responses: + "200": + application/octet-stream: "" + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "402": + application/json: {"error": {"code": 402, "message": "Insufficient credits. Add more using https://openrouter.ai/credits"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "502": + application/json: {"error": {"code": 502, "message": "Provider returned error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + "524": + application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} + "529": + application/json: {"error": {"code": 529, "message": "Provider returned error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: `response` **Changed** **Breaking** :warning:\n* `open_router.guardrails.update()`: `response.data.workspace_id` **Added**\n* `open_router.generations.get_generation()`: `response.data.web_search_engine` **Added**\n* `open_router.guardrails.list()`: \n * `request.workspace_id` **Added**\n * `response.data.[].workspace_id` **Added**\n* `open_router.guardrails.create()`: \n * `request.workspace_id` **Added**\n * `response.data.workspace_id` **Added**\n * `error.status[403]` **Added**\n* `open_router.guardrails.get()`: `response.data.workspace_id` **Added**\n* `open_router.tts.create_speech()`: **Added**\n* `open_router.api_keys.list()`: \n * `request.workspace_id` **Added**\n * `response.data.[].workspace_id` **Added**\n* `open_router.api_keys.create()`: \n * `request.workspace_id` **Added**\n * `response.data.workspace_id` **Added**\n * `error.status[403]` **Added**\n* `open_router.api_keys.get()`: `response.data.workspace_id` **Added**\n* `open_router.api_keys.update()`: `response.data.workspace_id` **Added**\n* `open_router.embeddings.generate()`: `response.usage.prompt_tokens_details` **Added**\n* `open_router.video_generation.generate()`: \n * `request.provider.options.baidu` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 27a3b9f..a104a8b 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.9.1 + version: 0.9.2 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 6cbf6ba..5cfb5b9 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -1489,6 +1489,15 @@ components: - thinking - signature type: object + AnthropicThinkingDisplay: + enum: + - summarized + - omitted + - null + example: summarized + nullable: true + type: string + x-speakeasy-unknown-values: allow AnthropicThinkingTurns: example: type: thinking_turns @@ -4955,6 +4964,11 @@ components: type: string reset_interval: $ref: '#/components/schemas/GuardrailInterval' + workspace_id: + description: The workspace to create the guardrail in. Defaults to the default workspace if not provided. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + format: uuid + type: string required: - name type: object @@ -4976,6 +4990,7 @@ components: name: My New Guardrail reset_interval: monthly updated_at: null + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: data: allOf: @@ -5649,6 +5664,7 @@ components: name: Production Guardrail reset_interval: monthly updated_at: '2025-08-24T15:45:00Z' + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: data: allOf: @@ -5710,6 +5726,7 @@ components: name: Production Guardrail reset_interval: monthly updated_at: '2025-08-24T15:45:00Z' + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: allowed_models: description: Array of model canonical_slugs (immutable identifiers) @@ -5783,10 +5800,15 @@ components: example: '2025-08-24T15:45:00Z' nullable: true type: string + workspace_id: + description: The workspace ID this guardrail belongs to. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + type: string required: - id - name - created_at + - workspace_id type: object GuardrailInterval: description: Interval at which the limit resets (daily, weekly, monthly) @@ -5965,12 +5987,12 @@ components: Configuration for the openrouter:image_generation server tool. Accepts all image_config params (aspect_ratio, quality, size, background, output_format, output_compression, moderation, etc.) plus a model field. example: aspect_ratio: '16:9' - model: openai/gpt-image-1 + model: openai/gpt-5-image quality: high properties: model: - description: Which image generation model to use (e.g. "openai/gpt-image-1"). Defaults to "openai/gpt-image-1". - example: openai/gpt-image-1 + description: Which image generation model to use (e.g. "openai/gpt-5-image"). Defaults to "openai/gpt-5-image". + example: openai/gpt-5-image type: string type: object ImageGenerationStatus: @@ -6594,6 +6616,7 @@ components: name: Production Guardrail reset_interval: monthly updated_at: '2025-08-24T15:45:00Z' + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 total_count: 1 properties: data: @@ -7255,11 +7278,12 @@ components: properties: effort: description: >- - How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer. Valid values are `low`, `medium`, `high`, or `max`. + How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer. Valid values are `low`, `medium`, `high`, `xhigh`, or `max`. enum: - low - medium - high + - xhigh - max - null example: medium @@ -7283,6 +7307,29 @@ components: - type - schema type: object + task_budget: + description: >- + Task budget for an agentic turn. The model sees a countdown of remaining tokens and uses it to prioritize work and wind down gracefully. Advisory — does not enforce a hard cap. + example: + total: 400000 + type: tokens + nullable: true + properties: + remaining: + minimum: 0 + nullable: true + type: integer + total: + minimum: 20000 + type: integer + type: + enum: + - tokens + type: string + required: + - type + - total + type: object type: object MessagesPingEvent: description: Keep-alive ping event @@ -7475,6 +7522,8 @@ components: - properties: budget_tokens: type: integer + display: + $ref: '#/components/schemas/AnthropicThinkingDisplay' type: enum: - enabled @@ -7492,6 +7541,8 @@ components: - type type: object - properties: + display: + $ref: '#/components/schemas/AnthropicThinkingDisplay' type: enum: - adaptive @@ -7699,6 +7750,23 @@ components: allOf: - $ref: '#/components/schemas/BaseMessagesResult' - properties: + context_management: + nullable: true + properties: + applied_edits: + items: + additionalProperties: + nullable: true + properties: + type: + type: string + required: + - type + type: object + type: array + required: + - applied_edits + type: object provider: $ref: '#/components/schemas/ProviderName' usage: @@ -7835,6 +7903,7 @@ components: - AionLabs - Alibaba - Ambient + - Baidu - Amazon Bedrock - Amazon Nova - Anthropic @@ -8861,6 +8930,8 @@ components: service_tier: nullable: true type: string + text: + $ref: '#/components/schemas/TextExtendedConfig' usage: $ref: '#/components/schemas/Usage' type: object @@ -9248,6 +9319,7 @@ components: example: id: ig_tmp_abc123 imageUrl: https://example.com/image.png + result: https://example.com/image.png status: completed type: openrouter:image_generation properties: @@ -9257,6 +9329,10 @@ components: type: string imageUrl: type: string + result: + description: The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format + nullable: true + type: string revisedPrompt: type: string status: @@ -9504,6 +9580,7 @@ components: openrouter:browser_use: '#/components/schemas/OutputBrowserUseServerToolItem' openrouter:code_interpreter: '#/components/schemas/OutputCodeInterpreterServerToolItem' openrouter:datetime: '#/components/schemas/OutputDatetimeItem' + openrouter:experimental__search_models: '#/components/schemas/OutputSearchModelsServerToolItem' openrouter:file_search: '#/components/schemas/OutputFileSearchServerToolItem' openrouter:image_generation: '#/components/schemas/OutputImageGenerationServerToolItem' openrouter:mcp: '#/components/schemas/OutputMcpServerToolItem' @@ -9545,6 +9622,7 @@ components: - $ref: '#/components/schemas/OutputToolSearchServerToolItem' - $ref: '#/components/schemas/OutputMemoryServerToolItem' - $ref: '#/components/schemas/OutputMcpServerToolItem' + - $ref: '#/components/schemas/OutputSearchModelsServerToolItem' OutputItemWebSearchCall: example: action: @@ -9748,6 +9826,7 @@ components: - audio - video - rerank + - tts example: text type: string x-speakeasy-unknown-values: allow @@ -9788,6 +9867,32 @@ components: - text: Analyzed the problem and found the optimal solution. type: summary_text type: reasoning + OutputSearchModelsServerToolItem: + description: An openrouter:experimental__search_models server tool output item + example: + arguments: '{"query":"Claude Opus"}' + id: sm_tmp_abc123 + query: Claude Opus + status: completed + type: openrouter:experimental__search_models + properties: + arguments: + description: The JSON arguments submitted to the search tool (e.g. {"query":"Claude"}) + type: string + id: + type: string + query: + type: string + status: + $ref: '#/components/schemas/ToolCallStatus' + type: + enum: + - openrouter:experimental__search_models + type: string + required: + - status + - type + type: object OutputTextEditorServerToolItem: description: An openrouter:text_editor server tool output item example: @@ -10228,6 +10333,7 @@ components: - AionLabs - Alibaba - Ambient + - Baidu - Amazon Bedrock - Amazon Nova - Anthropic @@ -10533,6 +10639,7 @@ components: - AionLabs - Alibaba - Ambient + - Baidu - Amazon Bedrock - Amazon Nova - Anthropic @@ -11985,7 +12092,18 @@ components: TextExtendedConfig: allOf: - $ref: '#/components/schemas/TextConfig' - - properties: {} + - properties: + verbosity: + enum: + - low + - medium + - high + - xhigh + - max + - null + nullable: true + type: string + x-speakeasy-unknown-values: allow type: object description: Text output configuration including format and verbosity example: @@ -12273,6 +12391,7 @@ components: name: Updated Guardrail Name reset_interval: weekly updated_at: '2025-08-24T16:00:00Z' + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: data: allOf: @@ -12469,6 +12588,10 @@ components: additionalProperties: nullable: true type: object + baidu: + additionalProperties: + nullable: true + type: object baseten: additionalProperties: nullable: true @@ -14295,6 +14418,25 @@ paths: description: Number of tokens in the input example: 8 type: integer + prompt_tokens_details: + description: >- + Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. + properties: + audio_tokens: + description: Number of audio tokens in the input + type: integer + image_tokens: + description: Number of image tokens in the input + example: 258 + type: integer + text_tokens: + description: Number of text tokens in the input + example: 8 + type: integer + video_tokens: + description: Number of video tokens in the input + type: integer + type: object total_tokens: description: Total number of tokens used example: 8 @@ -14667,6 +14809,7 @@ paths: - completions - embeddings - rerank + - tts - video - null nullable: true @@ -14855,6 +14998,11 @@ paths: description: User-Agent header from the request nullable: true type: string + web_search_engine: + description: The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel) + example: exa + nullable: true + type: string required: - id - upstream_id @@ -14882,6 +15030,7 @@ paths: - num_input_audio_prompt - num_media_completion - num_search_results + - web_search_engine - origin - usage - is_byok @@ -15010,6 +15159,15 @@ paths: maximum: 100 minimum: 1 type: integer + - description: Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. + in: query + name: workspace_id + required: false + schema: + description: Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + format: uuid + type: string responses: '200': content: @@ -15031,6 +15189,7 @@ paths: name: Production Guardrail reset_interval: monthly updated_at: '2025-08-24T15:45:00Z' + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 total_count: 1 schema: $ref: '#/components/schemas/ListGuardrailsResponse' @@ -15114,6 +15273,7 @@ paths: name: My New Guardrail reset_interval: monthly updated_at: null + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 schema: $ref: '#/components/schemas/CreateGuardrailResponse' description: Guardrail created successfully @@ -15137,6 +15297,16 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' description: Unauthorized - Authentication required or invalid credentials + '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: @@ -15246,6 +15416,7 @@ paths: name: Production Guardrail reset_interval: monthly updated_at: '2025-08-24T15:45:00Z' + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 schema: $ref: '#/components/schemas/GetGuardrailResponse' description: Guardrail details @@ -15326,6 +15497,7 @@ paths: name: Updated Guardrail Name reset_interval: weekly updated_at: '2025-08-24T16:00:00Z' + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 schema: $ref: '#/components/schemas/UpdateGuardrailResponse' description: Guardrail updated successfully @@ -16333,6 +16505,15 @@ paths: minimum: 0 nullable: false type: integer + - description: Filter API keys by workspace ID. By default, keys in the default workspace are returned. + in: query + name: workspace_id + required: false + schema: + description: Filter API keys by workspace ID. By default, keys in the default workspace are returned. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + format: uuid + type: string responses: '200': content: @@ -16359,6 +16540,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 schema: example: data: @@ -16382,6 +16564,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: data: description: List of API keys @@ -16407,6 +16590,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: byok_usage: description: Total external BYOK usage (in USD) for the API key @@ -16506,6 +16690,10 @@ paths: example: 25.5 format: double type: number + workspace_id: + description: The workspace ID this API key belongs to. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + type: string required: - hash - name @@ -16526,6 +16714,7 @@ paths: - created_at - updated_at - creator_user_id + - workspace_id type: object type: array required: @@ -16628,6 +16817,11 @@ paths: example: My New API Key minLength: 1 type: string + workspace_id: + description: The workspace to create the API key in. Defaults to the default workspace if not provided. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + format: uuid + type: string required: - name type: object @@ -16658,6 +16852,7 @@ paths: usage_daily: 0 usage_monthly: 0 usage_weekly: 0 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 key: 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 schema: example: @@ -16682,6 +16877,7 @@ paths: usage_daily: 0 usage_monthly: 0 usage_weekly: 0 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 key: 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 properties: data: @@ -16707,6 +16903,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: byok_usage: description: Total external BYOK usage (in USD) for the API key @@ -16806,6 +17003,10 @@ paths: example: 25.5 format: double type: number + workspace_id: + description: The workspace ID this API key belongs to. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + type: string required: - hash - name @@ -16826,6 +17027,7 @@ paths: - created_at - updated_at - creator_user_id + - workspace_id type: object key: description: The actual API key string (only shown once) @@ -16856,6 +17058,16 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' description: Unauthorized - Authentication required or invalid credentials + '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 '429': content: application/json: @@ -16998,6 +17210,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 schema: example: data: @@ -17021,6 +17234,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: data: description: The API key information @@ -17045,6 +17259,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: byok_usage: description: Total external BYOK usage (in USD) for the API key @@ -17144,6 +17359,10 @@ paths: example: 25.5 format: double type: number + workspace_id: + description: The workspace ID this API key belongs to. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + type: string required: - hash - name @@ -17164,6 +17383,7 @@ paths: - created_at - updated_at - creator_user_id + - workspace_id type: object required: - data @@ -17300,6 +17520,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 schema: example: data: @@ -17323,6 +17544,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: data: description: The updated API key information @@ -17347,6 +17569,7 @@ paths: usage_daily: 25.5 usage_monthly: 25.5 usage_weekly: 25.5 + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: byok_usage: description: Total external BYOK usage (in USD) for the API key @@ -17446,6 +17669,10 @@ paths: example: 25.5 format: double type: number + workspace_id: + description: The workspace ID this API key belongs to. + example: 0df9e665-d932-5740-b2c7-b52af166bc11 + type: string required: - hash - name @@ -17466,6 +17693,7 @@ paths: - created_at - updated_at - creator_user_id + - workspace_id type: object required: - data @@ -19252,6 +19480,610 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /tts: + post: + description: Synthesizes audio from the input text + operationId: createTts + requestBody: + content: + application/json: + schema: + description: Text-to-speech request input + example: + input: Hello world + model: elevenlabs/eleven-turbo-v2 + response_format: pcm + speed: 1 + voice: alloy + properties: + input: + description: Text to synthesize + example: Hello world + type: string + model: + description: TTS model identifier + example: elevenlabs/eleven-turbo-v2 + type: string + provider: + description: Provider-specific passthrough configuration + properties: + options: + description: >- + Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body. + properties: + 01ai: + additionalProperties: + nullable: true + type: object + ai21: + additionalProperties: + nullable: true + type: object + aion-labs: + additionalProperties: + nullable: true + type: object + akashml: + additionalProperties: + nullable: true + type: object + alibaba: + additionalProperties: + nullable: true + type: object + amazon-bedrock: + additionalProperties: + nullable: true + type: object + amazon-nova: + additionalProperties: + nullable: true + type: object + ambient: + additionalProperties: + nullable: true + type: object + anthropic: + additionalProperties: + nullable: true + type: object + anyscale: + additionalProperties: + nullable: true + type: object + arcee-ai: + additionalProperties: + nullable: true + type: object + atlas-cloud: + additionalProperties: + nullable: true + type: object + atoma: + additionalProperties: + nullable: true + type: object + avian: + additionalProperties: + nullable: true + type: object + azure: + additionalProperties: + nullable: true + type: object + baidu: + additionalProperties: + nullable: true + type: object + baseten: + additionalProperties: + nullable: true + type: object + black-forest-labs: + additionalProperties: + nullable: true + type: object + byteplus: + additionalProperties: + nullable: true + type: object + centml: + additionalProperties: + nullable: true + type: object + cerebras: + additionalProperties: + nullable: true + type: object + chutes: + additionalProperties: + nullable: true + type: object + cirrascale: + additionalProperties: + nullable: true + type: object + clarifai: + additionalProperties: + nullable: true + type: object + cloudflare: + additionalProperties: + nullable: true + type: object + cohere: + additionalProperties: + nullable: true + type: object + crofai: + additionalProperties: + nullable: true + type: object + crusoe: + additionalProperties: + nullable: true + type: object + deepinfra: + additionalProperties: + nullable: true + type: object + deepseek: + additionalProperties: + nullable: true + type: object + dekallm: + additionalProperties: + nullable: true + type: object + enfer: + additionalProperties: + nullable: true + type: object + fake-provider: + additionalProperties: + nullable: true + type: object + featherless: + additionalProperties: + nullable: true + type: object + fireworks: + additionalProperties: + nullable: true + type: object + friendli: + additionalProperties: + nullable: true + type: object + gmicloud: + additionalProperties: + nullable: true + type: object + google-ai-studio: + additionalProperties: + nullable: true + type: object + google-vertex: + additionalProperties: + nullable: true + type: object + gopomelo: + additionalProperties: + nullable: true + type: object + groq: + additionalProperties: + nullable: true + type: object + huggingface: + additionalProperties: + nullable: true + type: object + hyperbolic: + additionalProperties: + nullable: true + type: object + hyperbolic-quantized: + additionalProperties: + nullable: true + type: object + inception: + additionalProperties: + nullable: true + type: object + inceptron: + additionalProperties: + nullable: true + type: object + inference-net: + additionalProperties: + nullable: true + type: object + infermatic: + additionalProperties: + nullable: true + type: object + inflection: + additionalProperties: + nullable: true + type: object + inocloud: + additionalProperties: + nullable: true + type: object + io-net: + additionalProperties: + nullable: true + type: object + ionstream: + additionalProperties: + nullable: true + type: object + klusterai: + additionalProperties: + nullable: true + type: object + lambda: + additionalProperties: + nullable: true + type: object + lepton: + additionalProperties: + nullable: true + type: object + liquid: + additionalProperties: + nullable: true + type: object + lynn: + additionalProperties: + nullable: true + type: object + lynn-private: + additionalProperties: + nullable: true + type: object + mancer: + additionalProperties: + nullable: true + type: object + mancer-old: + additionalProperties: + nullable: true + type: object + mara: + additionalProperties: + nullable: true + type: object + meta: + additionalProperties: + nullable: true + type: object + minimax: + additionalProperties: + nullable: true + type: object + mistral: + additionalProperties: + nullable: true + type: object + modal: + additionalProperties: + nullable: true + type: object + modelrun: + additionalProperties: + nullable: true + type: object + modular: + additionalProperties: + nullable: true + type: object + moonshotai: + additionalProperties: + nullable: true + type: object + morph: + additionalProperties: + nullable: true + type: object + ncompass: + additionalProperties: + nullable: true + type: object + nebius: + additionalProperties: + nullable: true + type: object + nextbit: + additionalProperties: + nullable: true + type: object + nineteen: + additionalProperties: + nullable: true + type: object + novita: + additionalProperties: + nullable: true + type: object + nvidia: + additionalProperties: + nullable: true + type: object + octoai: + additionalProperties: + nullable: true + type: object + open-inference: + additionalProperties: + nullable: true + type: object + openai: + additionalProperties: + nullable: true + type: object + parasail: + additionalProperties: + nullable: true + type: object + perplexity: + additionalProperties: + nullable: true + type: object + phala: + additionalProperties: + nullable: true + type: object + recraft: + additionalProperties: + nullable: true + type: object + recursal: + additionalProperties: + nullable: true + type: object + reflection: + additionalProperties: + nullable: true + type: object + reka: + additionalProperties: + nullable: true + type: object + relace: + additionalProperties: + nullable: true + type: object + replicate: + additionalProperties: + nullable: true + type: object + sambanova: + additionalProperties: + nullable: true + type: object + sambanova-cloaked: + additionalProperties: + nullable: true + type: object + seed: + additionalProperties: + nullable: true + type: object + sf-compute: + additionalProperties: + nullable: true + type: object + siliconflow: + additionalProperties: + nullable: true + type: object + sourceful: + additionalProperties: + nullable: true + type: object + stealth: + additionalProperties: + nullable: true + type: object + stepfun: + additionalProperties: + nullable: true + type: object + streamlake: + additionalProperties: + nullable: true + type: object + switchpoint: + additionalProperties: + nullable: true + type: object + targon: + additionalProperties: + nullable: true + type: object + together: + additionalProperties: + nullable: true + type: object + together-lite: + additionalProperties: + nullable: true + type: object + ubicloud: + additionalProperties: + nullable: true + type: object + upstage: + additionalProperties: + nullable: true + type: object + venice: + additionalProperties: + nullable: true + type: object + wandb: + additionalProperties: + nullable: true + type: object + xai: + additionalProperties: + nullable: true + type: object + xiaomi: + additionalProperties: + nullable: true + type: object + z-ai: + additionalProperties: + nullable: true + type: object + type: object + type: object + response_format: + default: pcm + description: Audio output format + enum: + - mp3 + - pcm + example: pcm + type: string + x-speakeasy-unknown-values: allow + speed: + description: >- + Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. + example: 1 + format: double + type: number + voice: + description: Voice identifier + example: alloy + type: string + required: + - model + - input + - voice + type: object + required: true + responses: + '200': + content: + application/octet-stream: + schema: + description: Raw audio bytestream. Content-Type varies by requested format (audio/mpeg for mp3, audio/L16 for pcm). + example: + format: binary + type: string + description: Audio bytes stream + '400': + content: + application/json: + example: + error: + code: 400 + message: Invalid request parameters + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: Bad Request - Invalid request parameters or malformed input + '401': + content: + application/json: + example: + error: + code: 401 + message: Missing Authentication header + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '402': + content: + application/json: + example: + error: + code: 402 + message: Insufficient credits. Add more using https://openrouter.ai/credits + schema: + $ref: '#/components/schemas/PaymentRequiredResponse' + description: Payment Required - Insufficient credits or quota to complete request + '404': + content: + application/json: + example: + error: + code: 404 + message: Resource not found + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist + '429': + content: + application/json: + example: + error: + code: 429 + message: Rate limit exceeded + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: Too Many Requests - Rate limit exceeded + '500': + content: + application/json: + example: + error: + code: 500 + message: Internal Server Error + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + '502': + content: + application/json: + example: + error: + code: 502 + message: Provider returned error + schema: + $ref: '#/components/schemas/BadGatewayResponse' + description: Bad Gateway - Provider/upstream API failure + '503': + content: + application/json: + example: + error: + code: 503 + message: Service temporarily unavailable + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: Service Unavailable - Service temporarily unavailable + '524': + content: + application/json: + example: + error: + code: 524 + message: Request timed out. Please try again later. + schema: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + description: Infrastructure Timeout - Provider request timed out at edge network + '529': + content: + application/json: + example: + error: + code: 529 + message: Provider returned error + schema: + $ref: '#/components/schemas/ProviderOverloadedResponse' + description: Provider Overloaded - Provider is temporarily overloaded + summary: Create speech + tags: + - TTS + x-speakeasy-name-override: createSpeech + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /videos: post: description: Submits a video generation request and returns a polling URL to check status @@ -19598,6 +20430,8 @@ tags: name: Providers - description: Rerank endpoints name: Rerank + - description: Text-to-speech endpoints + name: TTS - description: Video Generation endpoints name: Video Generation - description: beta.responses endpoints diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d4e0269..da75dba 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,19 +2,20 @@ speakeasyVersion: 1.680.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:3982892b2b8f82bfc2a26a0f6fcc9512b665a1051dc240a9cfa29001b9453aa9 - sourceBlobDigest: sha256:727d3c1f7d36ffbf94c57b565536d8a16804eaef4c4043dd6c98152fc1629c8f + sourceRevisionDigest: sha256:8952f0b66f84c421c33ccaca85559d29bddda7ba4fb349c5107f99166a3f298e + sourceBlobDigest: sha256:d356a07ffc76f402e2c15eeb1231ab2f8ba92b0717e89de74f6d47e227b78641 tags: - latest + - speakeasy-sdk-regen-1776300046 - 1.0.0 targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:3982892b2b8f82bfc2a26a0f6fcc9512b665a1051dc240a9cfa29001b9453aa9 - sourceBlobDigest: sha256:727d3c1f7d36ffbf94c57b565536d8a16804eaef4c4043dd6c98152fc1629c8f + sourceRevisionDigest: sha256:8952f0b66f84c421c33ccaca85559d29bddda7ba4fb349c5107f99166a3f298e + sourceBlobDigest: sha256:d356a07ffc76f402e2c15eeb1231ab2f8ba92b0717e89de74f6d47e227b78641 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:db86aed74d199f265e2e20442ef652dac0911c8a657ccb3e6614d56a26b8b44e + codeSamplesRevisionDigest: sha256:2a84ff570b29cc05e8589e226440d6cd6490ad491ca14cb52793dd9fbad883e7 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.680.0 diff --git a/README-PYPI.md b/README-PYPI.md index 5f7e784..35f11f1 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -169,6 +169,36 @@ asyncio.run(main()) + +## Pagination + +Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the +returned response object will have a `Next` method that can be called to pull down the next group of results. If the +return value of `Next` is `None`, then there are no more pages to be fetched. + +Here's an example of one such pagination call: +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrails.list() + + while res is not None: + # Handle items + + res = res.next() + +``` + + ## Resource Management diff --git a/RELEASES.md b/RELEASES.md index 0d0d01f..eb6b4a8 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -8,4 +8,14 @@ Based on: ### Generated - [python v0.0.16] . ### Releases -- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - . \ No newline at end of file +- [PyPI v0.0.16] https://pypi.org/project/openrouter/0.0.16 - . + +## 2026-04-20 00:38:49 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.9.2] . +### Releases +- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - . \ No newline at end of file diff --git a/docs/components/outputmodality.md b/docs/components/outputmodality.md index 7b8edcf..1644bda 100644 --- a/docs/components/outputmodality.md +++ b/docs/components/outputmodality.md @@ -10,4 +10,5 @@ | `EMBEDDINGS` | embeddings | | `AUDIO` | audio | | `VIDEO` | video | -| `RERANK` | rerank | \ No newline at end of file +| `RERANK` | rerank | +| `TTS` | tts | \ No newline at end of file diff --git a/docs/components/providername.md b/docs/components/providername.md index 22effdd..1136a77 100644 --- a/docs/components/providername.md +++ b/docs/components/providername.md @@ -10,6 +10,7 @@ | `AION_LABS` | AionLabs | | `ALIBABA` | Alibaba | | `AMBIENT` | Ambient | +| `BAIDU` | Baidu | | `AMAZON_BEDROCK` | Amazon Bedrock | | `AMAZON_NOVA` | Amazon Nova | | `ANTHROPIC` | Anthropic | diff --git a/docs/operations/apitype.md b/docs/operations/apitype.md index ffff0b9..2fab7cd 100644 --- a/docs/operations/apitype.md +++ b/docs/operations/apitype.md @@ -10,4 +10,5 @@ Type of API used for the generation | `COMPLETIONS` | completions | | `EMBEDDINGS` | embeddings | | `RERANK` | rerank | +| `TTS` | tts | | `VIDEO` | video | \ No newline at end of file diff --git a/docs/operations/createkeysdata.md b/docs/operations/createkeysdata.md index f51f201..e60eaf9 100644 --- a/docs/operations/createkeysdata.md +++ b/docs/operations/createkeysdata.md @@ -26,4 +26,5 @@ The created API key information | `usage` | *float* | :heavy_check_mark: | Total OpenRouter credit usage (in USD) for the API key | 25.5 | | `usage_daily` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC day | 25.5 | | `usage_monthly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC month | 25.5 | -| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | \ No newline at end of file +| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | +| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this API key belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/createkeysrequestbody.md b/docs/operations/createkeysrequestbody.md index a384fab..e63e997 100644 --- a/docs/operations/createkeysrequestbody.md +++ b/docs/operations/createkeysrequestbody.md @@ -10,4 +10,5 @@ | `include_byok_in_limit` | *Optional[bool]* | :heavy_minus_sign: | Whether to include BYOK usage in the limit | true | | `limit` | *OptionalNullable[float]* | :heavy_minus_sign: | Optional spending limit for the API key in USD | 50 | | `limit_reset` | [OptionalNullable[operations.CreateKeysLimitReset]](../operations/createkeyslimitreset.md) | :heavy_minus_sign: | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly | -| `name` | *str* | :heavy_check_mark: | Name for the new API key | My New API Key | \ No newline at end of file +| `name` | *str* | :heavy_check_mark: | Name for the new API key | My New API Key | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the API key in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/createkeysresponse.md b/docs/operations/createkeysresponse.md index e749075..91744f3 100644 --- a/docs/operations/createkeysresponse.md +++ b/docs/operations/createkeysresponse.md @@ -5,7 +5,7 @@ API key created successfully ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [operations.CreateKeysData](../operations/createkeysdata.md) | :heavy_check_mark: | The created API key information | {
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_monthly": 17.38,
"byok_usage_weekly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"disabled": false,
"expires_at": "2027-12-31T23:59:59Z",
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"include_byok_in_limit": false,
"label": "sk-or-v1-0e6...1c96",
"limit": 100,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"name": "My Production Key",
"updated_at": "2025-08-24T15:45:00Z",
"usage": 25.5,
"usage_daily": 25.5,
"usage_monthly": 25.5,
"usage_weekly": 25.5
} | -| `key` | *str* | :heavy_check_mark: | The actual API key string (only shown once) | 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 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `data` | [operations.CreateKeysData](../operations/createkeysdata.md) | :heavy_check_mark: | The created API key information | {
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_monthly": 17.38,
"byok_usage_weekly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"disabled": false,
"expires_at": "2027-12-31T23:59:59Z",
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"include_byok_in_limit": false,
"label": "sk-or-v1-0e6...1c96",
"limit": 100,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"name": "My Production Key",
"updated_at": "2025-08-24T15:45:00Z",
"usage": 25.5,
"usage_daily": 25.5,
"usage_monthly": 25.5,
"usage_weekly": 25.5,
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | +| `key` | *str* | :heavy_check_mark: | The actual API key string (only shown once) | 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 | \ No newline at end of file diff --git a/docs/operations/getgenerationdata.md b/docs/operations/getgenerationdata.md index 7be5766..183399a 100644 --- a/docs/operations/getgenerationdata.md +++ b/docs/operations/getgenerationdata.md @@ -5,43 +5,44 @@ Generation data ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | | -| `app_id` | *Nullable[int]* | :heavy_check_mark: | ID of the app that made the request | 12345 | -| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 | -| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false | -| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 | -| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | -| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop | -| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 | -| `http_referer` | *Nullable[str]* | :heavy_check_mark: | Referer header from the request | | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | -| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false | -| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 | -| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b | -| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 | -| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop | -| `native_tokens_cached` | *Nullable[int]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 | -| `native_tokens_completion` | *Nullable[int]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 | -| `native_tokens_completion_images` | *Nullable[int]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 | -| `native_tokens_prompt` | *Nullable[int]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 | -| `native_tokens_reasoning` | *Nullable[int]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 | -| `num_input_audio_prompt` | *Nullable[int]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 | -| `num_media_completion` | *Nullable[int]* | :heavy_check_mark: | Number of media items in the completion | 0 | -| `num_media_prompt` | *Nullable[int]* | :heavy_check_mark: | Number of media items in the prompt | 1 | -| `num_search_results` | *Nullable[int]* | :heavy_check_mark: | Number of search results included | 5 | -| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ | -| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic | -| `provider_responses` | List[[components.ProviderResponse](../components/providerresponse.md)] | :heavy_check_mark: | List of provider responses for this generation, including fallback attempts | | -| `request_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier grouping all generations from a single API request | req-1727282430-aBcDeFgHiJkLmNoPqRsT | -| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto | -| `session_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Session identifier grouping multiple generations in the same session | | -| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true | -| `tokens_completion` | *Nullable[int]* | :heavy_check_mark: | Number of tokens in the completion | 25 | -| `tokens_prompt` | *Nullable[int]* | :heavy_check_mark: | Number of tokens in the prompt | 10 | -| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 | -| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 | -| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 | -| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 | -| `user_agent` | *Nullable[str]* | :heavy_check_mark: | User-Agent header from the request | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `api_type` | [Nullable[operations.APIType]](../operations/apitype.md) | :heavy_check_mark: | Type of API used for the generation | | +| `app_id` | *Nullable[int]* | :heavy_check_mark: | ID of the app that made the request | 12345 | +| `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 | +| `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false | +| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 | +| `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | +| `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop | +| `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 | +| `http_referer` | *Nullable[str]* | :heavy_check_mark: | Referer header from the request | | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the generation | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | +| `is_byok` | *bool* | :heavy_check_mark: | Whether this used bring-your-own-key | false | +| `latency` | *Nullable[float]* | :heavy_check_mark: | Total latency in milliseconds | 1250 | +| `model` | *str* | :heavy_check_mark: | Model used for the generation | sao10k/l3-stheno-8b | +| `moderation_latency` | *Nullable[float]* | :heavy_check_mark: | Moderation latency in milliseconds | 50 | +| `native_finish_reason` | *Nullable[str]* | :heavy_check_mark: | Native finish reason as reported by provider | stop | +| `native_tokens_cached` | *Nullable[int]* | :heavy_check_mark: | Native cached tokens as reported by provider | 3 | +| `native_tokens_completion` | *Nullable[int]* | :heavy_check_mark: | Native completion tokens as reported by provider | 25 | +| `native_tokens_completion_images` | *Nullable[int]* | :heavy_check_mark: | Native completion image tokens as reported by provider | 0 | +| `native_tokens_prompt` | *Nullable[int]* | :heavy_check_mark: | Native prompt tokens as reported by provider | 10 | +| `native_tokens_reasoning` | *Nullable[int]* | :heavy_check_mark: | Native reasoning tokens as reported by provider | 5 | +| `num_input_audio_prompt` | *Nullable[int]* | :heavy_check_mark: | Number of audio inputs in the prompt | 0 | +| `num_media_completion` | *Nullable[int]* | :heavy_check_mark: | Number of media items in the completion | 0 | +| `num_media_prompt` | *Nullable[int]* | :heavy_check_mark: | Number of media items in the prompt | 1 | +| `num_search_results` | *Nullable[int]* | :heavy_check_mark: | Number of search results included | 5 | +| `origin` | *str* | :heavy_check_mark: | Origin URL of the request | https://openrouter.ai/ | +| `provider_name` | *Nullable[str]* | :heavy_check_mark: | Name of the provider that served the request | Infermatic | +| `provider_responses` | List[[components.ProviderResponse](../components/providerresponse.md)] | :heavy_check_mark: | List of provider responses for this generation, including fallback attempts | | +| `request_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier grouping all generations from a single API request | req-1727282430-aBcDeFgHiJkLmNoPqRsT | +| `router` | *Nullable[str]* | :heavy_check_mark: | Router used for the request (e.g., openrouter/auto) | openrouter/auto | +| `session_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Session identifier grouping multiple generations in the same session | | +| `streamed` | *Nullable[bool]* | :heavy_check_mark: | Whether the response was streamed | true | +| `tokens_completion` | *Nullable[int]* | :heavy_check_mark: | Number of tokens in the completion | 25 | +| `tokens_prompt` | *Nullable[int]* | :heavy_check_mark: | Number of tokens in the prompt | 10 | +| `total_cost` | *float* | :heavy_check_mark: | Total cost of the generation in USD | 0.0015 | +| `upstream_id` | *Nullable[str]* | :heavy_check_mark: | Upstream provider's identifier for this generation | chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 | +| `upstream_inference_cost` | *Nullable[float]* | :heavy_check_mark: | Cost charged by the upstream provider | 0.0012 | +| `usage` | *float* | :heavy_check_mark: | Usage amount in USD | 0.0015 | +| `user_agent` | *Nullable[str]* | :heavy_check_mark: | User-Agent header from the request | | +| `web_search_engine` | *Nullable[str]* | :heavy_check_mark: | The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel) | exa | \ No newline at end of file diff --git a/docs/operations/getkeydata.md b/docs/operations/getkeydata.md index 5ba4a1f..c5a3db6 100644 --- a/docs/operations/getkeydata.md +++ b/docs/operations/getkeydata.md @@ -26,4 +26,5 @@ The API key information | `usage` | *float* | :heavy_check_mark: | Total OpenRouter credit usage (in USD) for the API key | 25.5 | | `usage_daily` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC day | 25.5 | | `usage_monthly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC month | 25.5 | -| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | \ No newline at end of file +| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | +| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this API key belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/getkeyresponse.md b/docs/operations/getkeyresponse.md index 7959a40..72e8055 100644 --- a/docs/operations/getkeyresponse.md +++ b/docs/operations/getkeyresponse.md @@ -5,6 +5,6 @@ API key details ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [operations.GetKeyData](../operations/getkeydata.md) | :heavy_check_mark: | The API key information | {
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_monthly": 17.38,
"byok_usage_weekly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"disabled": false,
"expires_at": "2027-12-31T23:59:59Z",
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"include_byok_in_limit": false,
"label": "sk-or-v1-0e6...1c96",
"limit": 100,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"name": "My Production Key",
"updated_at": "2025-08-24T15:45:00Z",
"usage": 25.5,
"usage_daily": 25.5,
"usage_monthly": 25.5,
"usage_weekly": 25.5
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `data` | [operations.GetKeyData](../operations/getkeydata.md) | :heavy_check_mark: | The API key information | {
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_monthly": 17.38,
"byok_usage_weekly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"disabled": false,
"expires_at": "2027-12-31T23:59:59Z",
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"include_byok_in_limit": false,
"label": "sk-or-v1-0e6...1c96",
"limit": 100,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"name": "My Production Key",
"updated_at": "2025-08-24T15:45:00Z",
"usage": 25.5,
"usage_daily": 25.5,
"usage_monthly": 25.5,
"usage_weekly": 25.5,
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file diff --git a/docs/operations/listdata.md b/docs/operations/listdata.md index d8fcbe3..d2a0b36 100644 --- a/docs/operations/listdata.md +++ b/docs/operations/listdata.md @@ -24,4 +24,5 @@ | `usage` | *float* | :heavy_check_mark: | Total OpenRouter credit usage (in USD) for the API key | 25.5 | | `usage_daily` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC day | 25.5 | | `usage_monthly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC month | 25.5 | -| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | \ No newline at end of file +| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | +| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this API key belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/listguardrailsrequest.md b/docs/operations/listguardrailsrequest.md index 65946b1..e6f8126 100644 --- a/docs/operations/listguardrailsrequest.md +++ b/docs/operations/listguardrailsrequest.md @@ -9,4 +9,5 @@ | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `offset` | *Optional[int]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | -| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | \ No newline at end of file +| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/listguardrailsresponse.md b/docs/operations/listguardrailsresponse.md index 3046aeb..1bb2d53 100644 --- a/docs/operations/listguardrailsresponse.md +++ b/docs/operations/listguardrailsresponse.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `result` | [components.ListGuardrailsResponse](../components/listguardrailsresponse.md) | :heavy_check_mark: | N/A | {
"data": [
{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z"
}
],
"total_count": 1
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ListGuardrailsResponse](../components/listguardrailsresponse.md) | :heavy_check_mark: | N/A | {
"data": [
{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}
],
"total_count": 1
} | \ No newline at end of file diff --git a/docs/operations/listrequest.md b/docs/operations/listrequest.md index 5507b0a..a5646bd 100644 --- a/docs/operations/listrequest.md +++ b/docs/operations/listrequest.md @@ -9,4 +9,5 @@ | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `include_disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether to include disabled API keys in the response | false | -| `offset` | *Optional[int]* | :heavy_minus_sign: | Number of API keys to skip for pagination | 0 | \ No newline at end of file +| `offset` | *Optional[int]* | :heavy_minus_sign: | Number of API keys to skip for pagination | 0 | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Filter API keys by workspace ID. By default, keys in the default workspace are returned. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/updatekeysdata.md b/docs/operations/updatekeysdata.md index 499598c..f1ef382 100644 --- a/docs/operations/updatekeysdata.md +++ b/docs/operations/updatekeysdata.md @@ -26,4 +26,5 @@ The updated API key information | `usage` | *float* | :heavy_check_mark: | Total OpenRouter credit usage (in USD) for the API key | 25.5 | | `usage_daily` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC day | 25.5 | | `usage_monthly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC month | 25.5 | -| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | \ No newline at end of file +| `usage_weekly` | *float* | :heavy_check_mark: | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 | +| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this API key belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/operations/updatekeysresponse.md b/docs/operations/updatekeysresponse.md index c1dde7c..8b5ef1f 100644 --- a/docs/operations/updatekeysresponse.md +++ b/docs/operations/updatekeysresponse.md @@ -5,6 +5,6 @@ API key updated successfully ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [operations.UpdateKeysData](../operations/updatekeysdata.md) | :heavy_check_mark: | The updated API key information | {
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_monthly": 17.38,
"byok_usage_weekly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"disabled": false,
"expires_at": "2027-12-31T23:59:59Z",
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"include_byok_in_limit": false,
"label": "sk-or-v1-0e6...1c96",
"limit": 100,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"name": "My Production Key",
"updated_at": "2025-08-24T15:45:00Z",
"usage": 25.5,
"usage_daily": 25.5,
"usage_monthly": 25.5,
"usage_weekly": 25.5
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `data` | [operations.UpdateKeysData](../operations/updatekeysdata.md) | :heavy_check_mark: | The updated API key information | {
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_monthly": 17.38,
"byok_usage_weekly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"disabled": false,
"expires_at": "2027-12-31T23:59:59Z",
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"include_byok_in_limit": false,
"label": "sk-or-v1-0e6...1c96",
"limit": 100,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"name": "My Production Key",
"updated_at": "2025-08-24T15:45:00Z",
"usage": 25.5,
"usage_daily": 25.5,
"usage_monthly": 25.5,
"usage_weekly": 25.5,
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file diff --git a/docs/sdks/apikeys/README.md b/docs/sdks/apikeys/README.md index 0e6da85..6e72f51 100644 --- a/docs/sdks/apikeys/README.md +++ b/docs/sdks/apikeys/README.md @@ -95,6 +95,7 @@ with OpenRouter( | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `include_disabled` | *Optional[bool]* | :heavy_minus_sign: | Whether to include disabled API keys in the response | false | | `offset` | *Optional[int]* | :heavy_minus_sign: | Number of API keys to skip for pagination | 0 | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Filter API keys by workspace ID. By default, keys in the default workspace are returned. | 0df9e665-d932-5740-b2c7-b52af166bc11 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -150,6 +151,7 @@ with OpenRouter( | `include_byok_in_limit` | *Optional[bool]* | :heavy_minus_sign: | Whether to include BYOK usage in the limit | true | | `limit` | *OptionalNullable[float]* | :heavy_minus_sign: | Optional spending limit for the API key in USD | 50 | | `limit_reset` | [OptionalNullable[operations.CreateKeysLimitReset]](../../operations/createkeyslimitreset.md) | :heavy_minus_sign: | Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the API key in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -162,6 +164,7 @@ with OpenRouter( | ----------------------------------- | ----------------------------------- | ----------------------------------- | | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | | errors.TooManyRequestsResponseError | 429 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | diff --git a/docs/sdks/guardrails/README.md b/docs/sdks/guardrails/README.md index 7bcdbb6..dfb499d 100644 --- a/docs/sdks/guardrails/README.md +++ b/docs/sdks/guardrails/README.md @@ -57,6 +57,7 @@ with OpenRouter( | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `offset` | *Optional[int]* | :heavy_minus_sign: | Number of records to skip for pagination | 0 | | `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. | 0df9e665-d932-5740-b2c7-b52af166bc11 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -117,6 +118,7 @@ with OpenRouter( | `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | | `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | | `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.md) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -129,6 +131,7 @@ with OpenRouter( | ---------------------------------- | ---------------------------------- | ---------------------------------- | | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | diff --git a/pyproject.toml b/pyproject.toml index c678027..9e4606d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] name = "openrouter" -version = "0.9.1" +version = "0.9.2" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] -readme = "README.md" +readme = "README-PYPI.md" requires-python = ">=3.9.2" dependencies = [ "httpcore >=1.0.9", @@ -11,6 +11,7 @@ dependencies = [ "jsonpath-python >=1.0.6", "pydantic >=2.11.2", ] +urls.repository = "https://github.com/OpenRouterTeam/python-sdk.git" license = { text = "Apache-2.0" } [dependency-groups] diff --git a/scripts/publish.sh b/scripts/publish.sh index ef28dc1..c35748f 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +uv run python scripts/prepare_readme.py + uv build uv publish --token $PYPI_TOKEN diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 4d43d33..fcebde3 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.9.1" +__version__: str = "0.9.2" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.788.4" -__user_agent__: str = "speakeasy-sdk/python 0.9.1 2.788.4 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.9.2 2.788.4 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/api_keys.py b/src/openrouter/api_keys.py index 923a5f8..e4a30e1 100644 --- a/src/openrouter/api_keys.py +++ b/src/openrouter/api_keys.py @@ -257,6 +257,7 @@ def list( x_open_router_categories: Optional[str] = None, include_disabled: Optional[bool] = None, offset: Optional[int] = None, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -275,6 +276,7 @@ def list( :param include_disabled: Whether to include disabled API keys in the response :param offset: Number of API keys to skip for pagination + :param workspace_id: Filter API keys by workspace ID. By default, keys in the default workspace are returned. :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 @@ -296,6 +298,7 @@ def list( x_open_router_categories=x_open_router_categories, include_disabled=include_disabled, offset=offset, + workspace_id=workspace_id, ) req = self._build_request( @@ -386,6 +389,7 @@ async def list_async( x_open_router_categories: Optional[str] = None, include_disabled: Optional[bool] = None, offset: Optional[int] = None, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -404,6 +408,7 @@ async def list_async( :param include_disabled: Whether to include disabled API keys in the response :param offset: Number of API keys to skip for pagination + :param workspace_id: Filter API keys by workspace ID. By default, keys in the default workspace are returned. :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 @@ -425,6 +430,7 @@ async def list_async( x_open_router_categories=x_open_router_categories, include_disabled=include_disabled, offset=offset, + workspace_id=workspace_id, ) req = self._build_request_async( @@ -519,6 +525,7 @@ def create( include_byok_in_limit: Optional[bool] = None, limit: OptionalNullable[float] = UNSET, limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -541,6 +548,7 @@ def create( :param include_byok_in_limit: Whether to include BYOK usage in the limit :param limit: Optional spending limit for the API key in USD :param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. + :param workspace_id: The workspace to create the API key in. Defaults to the default workspace if not provided. :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 @@ -567,6 +575,7 @@ def create( limit=limit, limit_reset=limit_reset, name=name, + workspace_id=workspace_id, ), ) @@ -622,7 +631,7 @@ def create( ), ), request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + error_status_codes=["400", "401", "403", "429", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -639,6 +648,11 @@ def create( errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, 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, "429", "application/json"): response_data = unmarshal_json_response( errors.TooManyRequestsResponseErrorData, http_res @@ -674,6 +688,7 @@ async def create_async( include_byok_in_limit: Optional[bool] = None, limit: OptionalNullable[float] = UNSET, limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -696,6 +711,7 @@ async def create_async( :param include_byok_in_limit: Whether to include BYOK usage in the limit :param limit: Optional spending limit for the API key in USD :param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday. + :param workspace_id: The workspace to create the API key in. Defaults to the default workspace if not provided. :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 @@ -722,6 +738,7 @@ async def create_async( limit=limit, limit_reset=limit_reset, name=name, + workspace_id=workspace_id, ), ) @@ -777,7 +794,7 @@ async def create_async( ), ), request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + error_status_codes=["400", "401", "403", "429", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -794,6 +811,11 @@ async def create_async( errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, 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, "429", "application/json"): response_data = unmarshal_json_response( errors.TooManyRequestsResponseErrorData, http_res diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index e41de29..cce159e 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -921,6 +921,11 @@ OutputReasoningItemType, OutputReasoningItemTypedDict, ) + from .outputsearchmodelsservertoolitem import ( + OutputSearchModelsServerToolItem, + OutputSearchModelsServerToolItemType, + OutputSearchModelsServerToolItemTypedDict, + ) from .outputtexteditorservertoolitem import ( Command, OutputTextEditorServerToolItem, @@ -1217,7 +1222,6 @@ StreamLogprobTopLogprob, StreamLogprobTopLogprobTypedDict, ) - from .textconfig import TextConfig, TextConfigTypedDict, TextConfigVerbosity from .textdeltaevent import ( TextDeltaEvent, TextDeltaEventType, @@ -1227,7 +1231,7 @@ from .textextendedconfig import ( TextExtendedConfig, TextExtendedConfigTypedDict, - TextExtendedConfigVerbosity, + Verbosity, ) from .toolcallstatus import ToolCallStatus from .toolchoiceallowed import ( @@ -2058,6 +2062,9 @@ "OutputReasoningItemStatusUnionTypedDict", "OutputReasoningItemType", "OutputReasoningItemTypedDict", + "OutputSearchModelsServerToolItem", + "OutputSearchModelsServerToolItemType", + "OutputSearchModelsServerToolItemTypedDict", "OutputTextEditorServerToolItem", "OutputTextEditorServerToolItemType", "OutputTextEditorServerToolItemTypedDict", @@ -2271,9 +2278,6 @@ "SupportedResolution", "SupportedSize", "Syntax", - "TextConfig", - "TextConfigTypedDict", - "TextConfigVerbosity", "TextDeltaEvent", "TextDeltaEventType", "TextDeltaEventTypedDict", @@ -2282,7 +2286,6 @@ "TextDoneEventTypedDict", "TextExtendedConfig", "TextExtendedConfigTypedDict", - "TextExtendedConfigVerbosity", "Tokenizer", "TooManyRequestsResponseErrorData", "TooManyRequestsResponseErrorDataTypedDict", @@ -2326,6 +2329,7 @@ "Value2TypedDict", "Variables", "VariablesTypedDict", + "Verbosity", "VideoGenerationRequest", "VideoGenerationRequestTypedDict", "VideoGenerationResponse", @@ -3074,6 +3078,9 @@ "OutputReasoningItemStatusUnionTypedDict": ".outputreasoningitem", "OutputReasoningItemType": ".outputreasoningitem", "OutputReasoningItemTypedDict": ".outputreasoningitem", + "OutputSearchModelsServerToolItem": ".outputsearchmodelsservertoolitem", + "OutputSearchModelsServerToolItemType": ".outputsearchmodelsservertoolitem", + "OutputSearchModelsServerToolItemTypedDict": ".outputsearchmodelsservertoolitem", "Command": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItem": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItemType": ".outputtexteditorservertoolitem", @@ -3281,9 +3288,6 @@ "StreamLogprobTypedDict": ".streamlogprob", "StreamLogprobTopLogprob": ".streamlogprobtoplogprob", "StreamLogprobTopLogprobTypedDict": ".streamlogprobtoplogprob", - "TextConfig": ".textconfig", - "TextConfigTypedDict": ".textconfig", - "TextConfigVerbosity": ".textconfig", "TextDeltaEvent": ".textdeltaevent", "TextDeltaEventType": ".textdeltaevent", "TextDeltaEventTypedDict": ".textdeltaevent", @@ -3292,7 +3296,7 @@ "TextDoneEventTypedDict": ".textdoneevent", "TextExtendedConfig": ".textextendedconfig", "TextExtendedConfigTypedDict": ".textextendedconfig", - "TextExtendedConfigVerbosity": ".textextendedconfig", + "Verbosity": ".textextendedconfig", "ToolCallStatus": ".toolcallstatus", "Mode": ".toolchoiceallowed", "ModeAuto": ".toolchoiceallowed", diff --git a/src/openrouter/components/createguardrailrequest.py b/src/openrouter/components/createguardrailrequest.py index c6dd6d6..421b13f 100644 --- a/src/openrouter/components/createguardrailrequest.py +++ b/src/openrouter/components/createguardrailrequest.py @@ -12,7 +12,7 @@ from openrouter.utils import validate_open_enum from pydantic import model_serializer from pydantic.functional_validators import PlainValidator -from typing import List +from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -35,6 +35,8 @@ class CreateGuardrailRequestTypedDict(TypedDict): r"""Spending limit in USD""" reset_interval: NotRequired[Nullable[GuardrailInterval]] r"""Interval at which the limit resets (daily, weekly, monthly)""" + workspace_id: NotRequired[str] + r"""The workspace to create the guardrail in. Defaults to the default workspace if not provided.""" class CreateGuardrailRequest(BaseModel): @@ -67,6 +69,9 @@ class CreateGuardrailRequest(BaseModel): ] = UNSET r"""Interval at which the limit resets (daily, weekly, monthly)""" + workspace_id: Optional[str] = None + r"""The workspace to create the guardrail in. Defaults to the default workspace if not provided.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -78,6 +83,7 @@ def serialize_model(self, handler): "ignored_providers", "limit_usd", "reset_interval", + "workspace_id", ] nullable_fields = [ "allowed_models", diff --git a/src/openrouter/components/guardrail.py b/src/openrouter/components/guardrail.py index afc25c7..64bb092 100644 --- a/src/openrouter/components/guardrail.py +++ b/src/openrouter/components/guardrail.py @@ -23,6 +23,8 @@ class GuardrailTypedDict(TypedDict): r"""Unique identifier for the guardrail""" name: str r"""Name of the guardrail""" + workspace_id: str + r"""The workspace ID this guardrail belongs to.""" allowed_models: NotRequired[Nullable[List[str]]] r"""Array of model canonical_slugs (immutable identifiers)""" allowed_providers: NotRequired[Nullable[List[str]]] @@ -53,6 +55,9 @@ class Guardrail(BaseModel): name: str r"""Name of the guardrail""" + workspace_id: str + r"""The workspace ID this guardrail belongs to.""" + allowed_models: OptionalNullable[List[str]] = UNSET r"""Array of model canonical_slugs (immutable identifiers)""" diff --git a/src/openrouter/components/imagegenerationservertoolconfig.py b/src/openrouter/components/imagegenerationservertoolconfig.py index 7b7010a..0fdc8f6 100644 --- a/src/openrouter/components/imagegenerationservertoolconfig.py +++ b/src/openrouter/components/imagegenerationservertoolconfig.py @@ -13,7 +13,7 @@ class ImageGenerationServerToolConfigTypedDict(TypedDict): r"""Configuration for the openrouter:image_generation server tool. Accepts all image_config params (aspect_ratio, quality, size, background, output_format, output_compression, moderation, etc.) plus a model field.""" model: NotRequired[str] - r"""Which image generation model to use (e.g. \"openai/gpt-image-1\"). Defaults to \"openai/gpt-image-1\".""" + r"""Which image generation model to use (e.g. \"openai/gpt-5-image\"). Defaults to \"openai/gpt-5-image\".""" class ImageGenerationServerToolConfig(BaseModel): @@ -27,7 +27,7 @@ class ImageGenerationServerToolConfig(BaseModel): ) model: Optional[str] = None - r"""Which image generation model to use (e.g. \"openai/gpt-image-1\"). Defaults to \"openai/gpt-image-1\".""" + r"""Which image generation model to use (e.g. \"openai/gpt-5-image\"). Defaults to \"openai/gpt-5-image\".""" @property def additional_properties(self): diff --git a/src/openrouter/components/openresponsesresult.py b/src/openrouter/components/openresponsesresult.py index fa04955..ea63258 100644 --- a/src/openrouter/components/openresponsesresult.py +++ b/src/openrouter/components/openresponsesresult.py @@ -39,7 +39,7 @@ from .responseserrorfield import ResponsesErrorField, ResponsesErrorFieldTypedDict from .shellservertool import ShellServerTool, ShellServerToolTypedDict from .storedprompttemplate import StoredPromptTemplate, StoredPromptTemplateTypedDict -from .textconfig import TextConfig, TextConfigTypedDict +from .textextendedconfig import TextExtendedConfig, TextExtendedConfigTypedDict from .truncation import Truncation from .usage import Usage, UsageTypedDict from .websearchservertool import WebSearchServerTool, WebSearchServerToolTypedDict @@ -195,7 +195,7 @@ class OpenResponsesResultTypedDict(TypedDict): safety_identifier: NotRequired[Nullable[str]] service_tier: NotRequired[Nullable[str]] store: NotRequired[bool] - text: NotRequired[TextConfigTypedDict] + text: NotRequired[TextExtendedConfigTypedDict] r"""Text output configuration including format and verbosity""" top_logprobs: NotRequired[int] truncation: NotRequired[Nullable[Truncation]] @@ -269,7 +269,7 @@ class OpenResponsesResult(BaseModel): store: Optional[bool] = None - text: Optional[TextConfig] = None + text: Optional[TextExtendedConfig] = None r"""Text output configuration including format and verbosity""" top_logprobs: Optional[int] = None diff --git a/src/openrouter/components/outputimagegenerationservertoolitem.py b/src/openrouter/components/outputimagegenerationservertoolitem.py index e91756b..a94bd09 100644 --- a/src/openrouter/components/outputimagegenerationservertoolitem.py +++ b/src/openrouter/components/outputimagegenerationservertoolitem.py @@ -2,9 +2,16 @@ from __future__ import annotations from .toolcallstatus import ToolCallStatus -from openrouter.types import BaseModel +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from openrouter.utils import validate_open_enum import pydantic +from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import Literal, Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -21,6 +28,8 @@ class OutputImageGenerationServerToolItemTypedDict(TypedDict): id: NotRequired[str] image_b64: NotRequired[str] image_url: NotRequired[str] + result: NotRequired[Nullable[str]] + r"""The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format""" revised_prompt: NotRequired[str] @@ -37,6 +46,39 @@ class OutputImageGenerationServerToolItem(BaseModel): image_url: Annotated[Optional[str], pydantic.Field(alias="imageUrl")] = None + result: OptionalNullable[str] = UNSET + r"""The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format""" + revised_prompt: Annotated[Optional[str], pydantic.Field(alias="revisedPrompt")] = ( None ) + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["id", "imageB64", "imageUrl", "result", "revisedPrompt"] + nullable_fields = ["result"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/openrouter/components/outputitems.py b/src/openrouter/components/outputitems.py index 4457f80..75ffbc5 100644 --- a/src/openrouter/components/outputitems.py +++ b/src/openrouter/components/outputitems.py @@ -56,6 +56,10 @@ ) from .outputmessageitem import OutputMessageItem, OutputMessageItemTypedDict from .outputreasoningitem import OutputReasoningItem, OutputReasoningItemTypedDict +from .outputsearchmodelsservertoolitem import ( + OutputSearchModelsServerToolItem, + OutputSearchModelsServerToolItemTypedDict, +) from .outputtexteditorservertoolitem import ( OutputTextEditorServerToolItem, OutputTextEditorServerToolItemTypedDict, @@ -94,18 +98,19 @@ OutputTextEditorServerToolItemTypedDict, OutputApplyPatchServerToolItemTypedDict, OutputDatetimeItemTypedDict, + OutputSearchModelsServerToolItemTypedDict, OutputMcpServerToolItemTypedDict, OutputBrowserUseServerToolItemTypedDict, OutputFunctionCallItemTypedDict, - OutputImageGenerationServerToolItemTypedDict, OutputMessageItemTypedDict, OutputComputerCallItemTypedDict, OutputWebFetchServerToolItemTypedDict, OutputMemoryServerToolItemTypedDict, OutputCodeInterpreterCallItemTypedDict, + OutputImageGenerationServerToolItemTypedDict, OutputBashServerToolItemTypedDict, - OutputCodeInterpreterServerToolItemTypedDict, OutputReasoningItemTypedDict, + OutputCodeInterpreterServerToolItemTypedDict, ], ) r"""An output item from the response""" @@ -126,6 +131,10 @@ OutputCodeInterpreterServerToolItem, Tag("openrouter:code_interpreter") ], Annotated[OutputDatetimeItem, Tag("openrouter:datetime")], + Annotated[ + OutputSearchModelsServerToolItem, + Tag("openrouter:experimental__search_models"), + ], Annotated[OutputFileSearchServerToolItem, Tag("openrouter:file_search")], Annotated[ OutputImageGenerationServerToolItem, Tag("openrouter:image_generation") diff --git a/src/openrouter/components/outputmodality.py b/src/openrouter/components/outputmodality.py index c926bb6..4d38da6 100644 --- a/src/openrouter/components/outputmodality.py +++ b/src/openrouter/components/outputmodality.py @@ -13,6 +13,7 @@ "audio", "video", "rerank", + "tts", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/outputsearchmodelsservertoolitem.py b/src/openrouter/components/outputsearchmodelsservertoolitem.py new file mode 100644 index 0000000..f94949d --- /dev/null +++ b/src/openrouter/components/outputsearchmodelsservertoolitem.py @@ -0,0 +1,40 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .toolcallstatus import ToolCallStatus +from openrouter.types import BaseModel +from openrouter.utils import validate_open_enum +from pydantic.functional_validators import PlainValidator +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +OutputSearchModelsServerToolItemType = Literal[ + "openrouter:experimental__search_models", +] + + +class OutputSearchModelsServerToolItemTypedDict(TypedDict): + r"""An openrouter:experimental__search_models server tool output item""" + + status: ToolCallStatus + type: OutputSearchModelsServerToolItemType + arguments: NotRequired[str] + r"""The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})""" + id: NotRequired[str] + query: NotRequired[str] + + +class OutputSearchModelsServerToolItem(BaseModel): + r"""An openrouter:experimental__search_models server tool output item""" + + status: Annotated[ToolCallStatus, PlainValidator(validate_open_enum(False))] + + type: OutputSearchModelsServerToolItemType + + arguments: Optional[str] = None + r"""The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})""" + + id: Optional[str] = None + + query: Optional[str] = None diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index 7764a12..109379a 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -12,6 +12,7 @@ "AionLabs", "Alibaba", "Ambient", + "Baidu", "Amazon Bedrock", "Amazon Nova", "Anthropic", diff --git a/src/openrouter/components/providerresponse.py b/src/openrouter/components/providerresponse.py index 4856eee..14f4f7e 100644 --- a/src/openrouter/components/providerresponse.py +++ b/src/openrouter/components/providerresponse.py @@ -44,6 +44,7 @@ "AionLabs", "Alibaba", "Ambient", + "Baidu", "Amazon Bedrock", "Amazon Nova", "Anthropic", diff --git a/src/openrouter/components/textconfig.py b/src/openrouter/components/textconfig.py deleted file mode 100644 index cf8fa53..0000000 --- a/src/openrouter/components/textconfig.py +++ /dev/null @@ -1,77 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .formats import Formats, FormatsTypedDict -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) -from openrouter.utils import validate_open_enum -import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing import Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict - - -TextConfigVerbosity = Union[ - Literal[ - "high", - "low", - "medium", - ], - UnrecognizedStr, -] - - -class TextConfigTypedDict(TypedDict): - r"""Text output configuration including format and verbosity""" - - format_: NotRequired[FormatsTypedDict] - r"""Text response format configuration""" - verbosity: NotRequired[Nullable[TextConfigVerbosity]] - - -class TextConfig(BaseModel): - r"""Text output configuration including format and verbosity""" - - format_: Annotated[Optional[Formats], pydantic.Field(alias="format")] = None - r"""Text response format configuration""" - - verbosity: Annotated[ - OptionalNullable[TextConfigVerbosity], PlainValidator(validate_open_enum(False)) - ] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["format", "verbosity"] - nullable_fields = ["verbosity"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/openrouter/components/textextendedconfig.py b/src/openrouter/components/textextendedconfig.py index ee561b1..89224c7 100644 --- a/src/openrouter/components/textextendedconfig.py +++ b/src/openrouter/components/textextendedconfig.py @@ -18,11 +18,13 @@ from typing_extensions import Annotated, NotRequired, TypedDict -TextExtendedConfigVerbosity = Union[ +Verbosity = Union[ Literal[ - "high", "low", "medium", + "high", + "xhigh", + "max", ], UnrecognizedStr, ] @@ -33,7 +35,7 @@ class TextExtendedConfigTypedDict(TypedDict): format_: NotRequired[FormatsTypedDict] r"""Text response format configuration""" - verbosity: NotRequired[Nullable[TextExtendedConfigVerbosity]] + verbosity: NotRequired[Nullable[Verbosity]] class TextExtendedConfig(BaseModel): @@ -43,8 +45,7 @@ class TextExtendedConfig(BaseModel): r"""Text response format configuration""" verbosity: Annotated[ - OptionalNullable[TextExtendedConfigVerbosity], - PlainValidator(validate_open_enum(False)), + OptionalNullable[Verbosity], PlainValidator(validate_open_enum(False)) ] = UNSET @model_serializer(mode="wrap") diff --git a/src/openrouter/components/videogenerationrequest.py b/src/openrouter/components/videogenerationrequest.py index db54f12..4efa2a0 100644 --- a/src/openrouter/components/videogenerationrequest.py +++ b/src/openrouter/components/videogenerationrequest.py @@ -44,6 +44,7 @@ class OptionsTypedDict(TypedDict): atoma: NotRequired[Dict[str, Nullable[Any]]] avian: NotRequired[Dict[str, Nullable[Any]]] azure: NotRequired[Dict[str, Nullable[Any]]] + baidu: NotRequired[Dict[str, Nullable[Any]]] baseten: NotRequired[Dict[str, Nullable[Any]]] black_forest_labs: NotRequired[Dict[str, Nullable[Any]]] byteplus: NotRequired[Dict[str, Nullable[Any]]] @@ -182,6 +183,8 @@ class Options(BaseModel): azure: Optional[Dict[str, Nullable[Any]]] = None + baidu: Optional[Dict[str, Nullable[Any]]] = None + baseten: Optional[Dict[str, Nullable[Any]]] = None black_forest_labs: Annotated[ diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index 7d1038d..f80ac69 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -21,6 +21,7 @@ def list( x_open_router_categories: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -39,6 +40,7 @@ def list( :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) + :param workspace_id: Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. :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 @@ -60,6 +62,7 @@ def list( x_open_router_categories=x_open_router_categories, offset=offset, limit=limit, + workspace_id=workspace_id, ) req = self._build_request( @@ -132,6 +135,7 @@ def next_func() -> Optional[operations.ListGuardrailsResponse]: x_open_router_categories=x_open_router_categories, offset=next_offset, limit=limit, + workspace_id=workspace_id, retries=retries, ) @@ -174,6 +178,7 @@ async def list_async( x_open_router_categories: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -192,6 +197,7 @@ async def list_async( :param offset: Number of records to skip for pagination :param limit: Maximum number of records to return (max 100) + :param workspace_id: Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. :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 @@ -213,6 +219,7 @@ async def list_async( x_open_router_categories=x_open_router_categories, offset=offset, limit=limit, + workspace_id=workspace_id, ) req = self._build_request_async( @@ -288,6 +295,7 @@ async def empty_result(): x_open_router_categories=x_open_router_categories, offset=next_offset, limit=limit, + workspace_id=workspace_id, retries=retries, ) @@ -337,6 +345,7 @@ def create( ignored_providers: OptionalNullable[List[str]] = UNSET, limit_usd: OptionalNullable[float] = UNSET, reset_interval: OptionalNullable[components.GuardrailInterval] = UNSET, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -362,6 +371,7 @@ def create( :param ignored_providers: List of provider IDs to exclude from routing :param limit_usd: Spending limit in USD :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) + :param workspace_id: The workspace to create the guardrail in. Defaults to the default workspace if not provided. :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 @@ -391,6 +401,7 @@ def create( limit_usd=limit_usd, name=name, reset_interval=reset_interval, + workspace_id=workspace_id, ), ) @@ -446,7 +457,7 @@ def create( ), ), request=req, - error_status_codes=["400", "401", "4XX", "500", "5XX"], + error_status_codes=["400", "401", "403", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -463,6 +474,11 @@ def create( errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, 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 @@ -496,6 +512,7 @@ async def create_async( ignored_providers: OptionalNullable[List[str]] = UNSET, limit_usd: OptionalNullable[float] = UNSET, reset_interval: OptionalNullable[components.GuardrailInterval] = UNSET, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -521,6 +538,7 @@ async def create_async( :param ignored_providers: List of provider IDs to exclude from routing :param limit_usd: Spending limit in USD :param reset_interval: Interval at which the limit resets (daily, weekly, monthly) + :param workspace_id: The workspace to create the guardrail in. Defaults to the default workspace if not provided. :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 @@ -550,6 +568,7 @@ async def create_async( limit_usd=limit_usd, name=name, reset_interval=reset_interval, + workspace_id=workspace_id, ), ) @@ -605,7 +624,7 @@ async def create_async( ), ), request=req, - error_status_codes=["400", "401", "4XX", "500", "5XX"], + error_status_codes=["400", "401", "403", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -622,6 +641,11 @@ async def create_async( errors.UnauthorizedResponseErrorData, http_res ) raise errors.UnauthorizedResponseError(response_data, 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 diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 8c2b319..1dcc933 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -76,6 +76,8 @@ InputUnionTypedDict, Object, ObjectEmbedding, + PromptTokensDetails, + PromptTokensDetailsTypedDict, TypeImageURL, TypeText, ) @@ -126,6 +128,19 @@ CreateResponsesResponseBodyTypedDict, CreateResponsesResponseTypedDict, ) + from .createtts import ( + CreateTtsGlobals, + CreateTtsGlobalsTypedDict, + CreateTtsRequest, + CreateTtsRequestBody, + CreateTtsRequestBodyTypedDict, + CreateTtsRequestTypedDict, + Options, + OptionsTypedDict, + Provider, + ProviderTypedDict, + ResponseFormat, + ) from .createvideos import ( CreateVideosGlobals, CreateVideosGlobalsTypedDict, @@ -463,6 +478,12 @@ "CreateResponsesResponseBody", "CreateResponsesResponseBodyTypedDict", "CreateResponsesResponseTypedDict", + "CreateTtsGlobals", + "CreateTtsGlobalsTypedDict", + "CreateTtsRequest", + "CreateTtsRequestBody", + "CreateTtsRequestBodyTypedDict", + "CreateTtsRequestTypedDict", "CreateVideosGlobals", "CreateVideosGlobalsTypedDict", "CreateVideosRequest", @@ -639,8 +660,15 @@ "ListVideosModelsRequestTypedDict", "Object", "ObjectEmbedding", + "Options", + "OptionsTypedDict", + "PromptTokensDetails", + "PromptTokensDetailsTypedDict", + "Provider", + "ProviderTypedDict", "RateLimit", "RateLimitTypedDict", + "ResponseFormat", "Result", "ResultTypedDict", "Role", @@ -732,6 +760,8 @@ "InputUnionTypedDict": ".createembeddings", "Object": ".createembeddings", "ObjectEmbedding": ".createembeddings", + "PromptTokensDetails": ".createembeddings", + "PromptTokensDetailsTypedDict": ".createembeddings", "TypeImageURL": ".createembeddings", "TypeText": ".createembeddings", "CreateGuardrailGlobals": ".createguardrail", @@ -773,6 +803,17 @@ "CreateResponsesResponseBody": ".createresponses", "CreateResponsesResponseBodyTypedDict": ".createresponses", "CreateResponsesResponseTypedDict": ".createresponses", + "CreateTtsGlobals": ".createtts", + "CreateTtsGlobalsTypedDict": ".createtts", + "CreateTtsRequest": ".createtts", + "CreateTtsRequestBody": ".createtts", + "CreateTtsRequestBodyTypedDict": ".createtts", + "CreateTtsRequestTypedDict": ".createtts", + "Options": ".createtts", + "OptionsTypedDict": ".createtts", + "Provider": ".createtts", + "ProviderTypedDict": ".createtts", + "ResponseFormat": ".createtts", "CreateVideosGlobals": ".createvideos", "CreateVideosGlobalsTypedDict": ".createvideos", "CreateVideosRequest": ".createvideos", diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index 3872d32..e0efba7 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -323,6 +323,35 @@ class CreateEmbeddingsData(BaseModel): Object = Literal["list",] +class PromptTokensDetailsTypedDict(TypedDict): + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" + + audio_tokens: NotRequired[int] + r"""Number of audio tokens in the input""" + image_tokens: NotRequired[int] + r"""Number of image tokens in the input""" + text_tokens: NotRequired[int] + r"""Number of text tokens in the input""" + video_tokens: NotRequired[int] + r"""Number of video tokens in the input""" + + +class PromptTokensDetails(BaseModel): + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" + + audio_tokens: Optional[int] = None + r"""Number of audio tokens in the input""" + + image_tokens: Optional[int] = None + r"""Number of image tokens in the input""" + + text_tokens: Optional[int] = None + r"""Number of text tokens in the input""" + + video_tokens: Optional[int] = None + r"""Number of video tokens in the input""" + + class CreateEmbeddingsUsageTypedDict(TypedDict): r"""Token usage statistics""" @@ -332,6 +361,8 @@ class CreateEmbeddingsUsageTypedDict(TypedDict): r"""Total number of tokens used""" cost: NotRequired[float] r"""Cost of the request in credits""" + prompt_tokens_details: NotRequired[PromptTokensDetailsTypedDict] + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" class CreateEmbeddingsUsage(BaseModel): @@ -346,6 +377,9 @@ class CreateEmbeddingsUsage(BaseModel): cost: Optional[float] = None r"""Cost of the request in credits""" + prompt_tokens_details: Optional[PromptTokensDetails] = None + r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" + class CreateEmbeddingsResponseBodyTypedDict(TypedDict): r"""Embeddings response containing embedding vectors""" diff --git a/src/openrouter/operations/createkeys.py b/src/openrouter/operations/createkeys.py index 5ed218d..6d18cf7 100644 --- a/src/openrouter/operations/createkeys.py +++ b/src/openrouter/operations/createkeys.py @@ -93,6 +93,8 @@ class CreateKeysRequestBodyTypedDict(TypedDict): r"""Optional spending limit for the API key in USD""" limit_reset: NotRequired[Nullable[CreateKeysLimitReset]] r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.""" + workspace_id: NotRequired[str] + r"""The workspace to create the API key in. Defaults to the default workspace if not provided.""" class CreateKeysRequestBody(BaseModel): @@ -117,6 +119,9 @@ class CreateKeysRequestBody(BaseModel): ] = UNSET r"""Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.""" + workspace_id: Optional[str] = None + r"""The workspace to create the API key in. Defaults to the default workspace if not provided.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -125,6 +130,7 @@ def serialize_model(self, handler): "include_byok_in_limit", "limit", "limit_reset", + "workspace_id", ] nullable_fields = ["creator_user_id", "expires_at", "limit", "limit_reset"] null_default_fields = [] @@ -247,6 +253,8 @@ class CreateKeysDataTypedDict(TypedDict): r"""OpenRouter credit usage (in USD) for the current UTC month""" usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" expires_at: NotRequired[Nullable[datetime]] r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" @@ -311,6 +319,9 @@ class CreateKeysData(BaseModel): usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" + expires_at: OptionalNullable[datetime] = UNSET r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" diff --git a/src/openrouter/operations/createtts.py b/src/openrouter/operations/createtts.py new file mode 100644 index 0000000..02cc51d --- /dev/null +++ b/src/openrouter/operations/createtts.py @@ -0,0 +1,549 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UnrecognizedStr +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + RequestMetadata, + validate_open_enum, +) +import pydantic +from pydantic.functional_validators import PlainValidator +from typing import Any, Dict, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateTtsGlobalsTypedDict(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 CreateTtsGlobals(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. + + """ + + +class OptionsTypedDict(TypedDict): + r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" + + oneai: NotRequired[Dict[str, Nullable[Any]]] + ai21: NotRequired[Dict[str, Nullable[Any]]] + aion_labs: NotRequired[Dict[str, Nullable[Any]]] + akashml: NotRequired[Dict[str, Nullable[Any]]] + alibaba: NotRequired[Dict[str, Nullable[Any]]] + amazon_bedrock: NotRequired[Dict[str, Nullable[Any]]] + amazon_nova: NotRequired[Dict[str, Nullable[Any]]] + ambient: NotRequired[Dict[str, Nullable[Any]]] + anthropic: NotRequired[Dict[str, Nullable[Any]]] + anyscale: NotRequired[Dict[str, Nullable[Any]]] + arcee_ai: NotRequired[Dict[str, Nullable[Any]]] + atlas_cloud: NotRequired[Dict[str, Nullable[Any]]] + atoma: NotRequired[Dict[str, Nullable[Any]]] + avian: NotRequired[Dict[str, Nullable[Any]]] + azure: NotRequired[Dict[str, Nullable[Any]]] + baidu: NotRequired[Dict[str, Nullable[Any]]] + baseten: NotRequired[Dict[str, Nullable[Any]]] + black_forest_labs: NotRequired[Dict[str, Nullable[Any]]] + byteplus: NotRequired[Dict[str, Nullable[Any]]] + centml: NotRequired[Dict[str, Nullable[Any]]] + cerebras: NotRequired[Dict[str, Nullable[Any]]] + chutes: NotRequired[Dict[str, Nullable[Any]]] + cirrascale: NotRequired[Dict[str, Nullable[Any]]] + clarifai: NotRequired[Dict[str, Nullable[Any]]] + cloudflare: NotRequired[Dict[str, Nullable[Any]]] + cohere: NotRequired[Dict[str, Nullable[Any]]] + crofai: NotRequired[Dict[str, Nullable[Any]]] + crusoe: NotRequired[Dict[str, Nullable[Any]]] + deepinfra: NotRequired[Dict[str, Nullable[Any]]] + deepseek: NotRequired[Dict[str, Nullable[Any]]] + dekallm: NotRequired[Dict[str, Nullable[Any]]] + enfer: NotRequired[Dict[str, Nullable[Any]]] + fake_provider: NotRequired[Dict[str, Nullable[Any]]] + featherless: NotRequired[Dict[str, Nullable[Any]]] + fireworks: NotRequired[Dict[str, Nullable[Any]]] + friendli: NotRequired[Dict[str, Nullable[Any]]] + gmicloud: NotRequired[Dict[str, Nullable[Any]]] + google_ai_studio: NotRequired[Dict[str, Nullable[Any]]] + google_vertex: NotRequired[Dict[str, Nullable[Any]]] + gopomelo: NotRequired[Dict[str, Nullable[Any]]] + groq: NotRequired[Dict[str, Nullable[Any]]] + huggingface: NotRequired[Dict[str, Nullable[Any]]] + hyperbolic: NotRequired[Dict[str, Nullable[Any]]] + hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]] + inception: NotRequired[Dict[str, Nullable[Any]]] + inceptron: NotRequired[Dict[str, Nullable[Any]]] + inference_net: NotRequired[Dict[str, Nullable[Any]]] + infermatic: NotRequired[Dict[str, Nullable[Any]]] + inflection: NotRequired[Dict[str, Nullable[Any]]] + inocloud: NotRequired[Dict[str, Nullable[Any]]] + io_net: NotRequired[Dict[str, Nullable[Any]]] + ionstream: NotRequired[Dict[str, Nullable[Any]]] + klusterai: NotRequired[Dict[str, Nullable[Any]]] + lambda_: NotRequired[Dict[str, Nullable[Any]]] + lepton: NotRequired[Dict[str, Nullable[Any]]] + liquid: NotRequired[Dict[str, Nullable[Any]]] + lynn: NotRequired[Dict[str, Nullable[Any]]] + lynn_private: NotRequired[Dict[str, Nullable[Any]]] + mancer: NotRequired[Dict[str, Nullable[Any]]] + mancer_old: NotRequired[Dict[str, Nullable[Any]]] + mara: NotRequired[Dict[str, Nullable[Any]]] + meta: NotRequired[Dict[str, Nullable[Any]]] + minimax: NotRequired[Dict[str, Nullable[Any]]] + mistral: NotRequired[Dict[str, Nullable[Any]]] + modal: NotRequired[Dict[str, Nullable[Any]]] + modelrun: NotRequired[Dict[str, Nullable[Any]]] + modular: NotRequired[Dict[str, Nullable[Any]]] + moonshotai: NotRequired[Dict[str, Nullable[Any]]] + morph: NotRequired[Dict[str, Nullable[Any]]] + ncompass: NotRequired[Dict[str, Nullable[Any]]] + nebius: NotRequired[Dict[str, Nullable[Any]]] + nextbit: NotRequired[Dict[str, Nullable[Any]]] + nineteen: NotRequired[Dict[str, Nullable[Any]]] + novita: NotRequired[Dict[str, Nullable[Any]]] + nvidia: NotRequired[Dict[str, Nullable[Any]]] + octoai: NotRequired[Dict[str, Nullable[Any]]] + open_inference: NotRequired[Dict[str, Nullable[Any]]] + openai: NotRequired[Dict[str, Nullable[Any]]] + parasail: NotRequired[Dict[str, Nullable[Any]]] + perplexity: NotRequired[Dict[str, Nullable[Any]]] + phala: NotRequired[Dict[str, Nullable[Any]]] + recraft: NotRequired[Dict[str, Nullable[Any]]] + recursal: NotRequired[Dict[str, Nullable[Any]]] + reflection: NotRequired[Dict[str, Nullable[Any]]] + reka: NotRequired[Dict[str, Nullable[Any]]] + relace: NotRequired[Dict[str, Nullable[Any]]] + replicate: NotRequired[Dict[str, Nullable[Any]]] + sambanova: NotRequired[Dict[str, Nullable[Any]]] + sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] + seed: NotRequired[Dict[str, Nullable[Any]]] + sf_compute: NotRequired[Dict[str, Nullable[Any]]] + siliconflow: NotRequired[Dict[str, Nullable[Any]]] + sourceful: NotRequired[Dict[str, Nullable[Any]]] + stealth: NotRequired[Dict[str, Nullable[Any]]] + stepfun: NotRequired[Dict[str, Nullable[Any]]] + streamlake: NotRequired[Dict[str, Nullable[Any]]] + switchpoint: NotRequired[Dict[str, Nullable[Any]]] + targon: NotRequired[Dict[str, Nullable[Any]]] + together: NotRequired[Dict[str, Nullable[Any]]] + together_lite: NotRequired[Dict[str, Nullable[Any]]] + ubicloud: NotRequired[Dict[str, Nullable[Any]]] + upstage: NotRequired[Dict[str, Nullable[Any]]] + venice: NotRequired[Dict[str, Nullable[Any]]] + wandb: NotRequired[Dict[str, Nullable[Any]]] + xai: NotRequired[Dict[str, Nullable[Any]]] + xiaomi: NotRequired[Dict[str, Nullable[Any]]] + z_ai: NotRequired[Dict[str, Nullable[Any]]] + + +class Options(BaseModel): + r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" + + oneai: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai") + ] = None + + ai21: Optional[Dict[str, Nullable[Any]]] = None + + aion_labs: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="aion-labs") + ] = None + + akashml: Optional[Dict[str, Nullable[Any]]] = None + + alibaba: Optional[Dict[str, Nullable[Any]]] = None + + amazon_bedrock: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-bedrock") + ] = None + + amazon_nova: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-nova") + ] = None + + ambient: Optional[Dict[str, Nullable[Any]]] = None + + anthropic: Optional[Dict[str, Nullable[Any]]] = None + + anyscale: Optional[Dict[str, Nullable[Any]]] = None + + arcee_ai: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="arcee-ai") + ] = None + + atlas_cloud: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="atlas-cloud") + ] = None + + atoma: Optional[Dict[str, Nullable[Any]]] = None + + avian: Optional[Dict[str, Nullable[Any]]] = None + + azure: Optional[Dict[str, Nullable[Any]]] = None + + baidu: Optional[Dict[str, Nullable[Any]]] = None + + baseten: Optional[Dict[str, Nullable[Any]]] = None + + black_forest_labs: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="black-forest-labs") + ] = None + + byteplus: Optional[Dict[str, Nullable[Any]]] = None + + centml: Optional[Dict[str, Nullable[Any]]] = None + + cerebras: Optional[Dict[str, Nullable[Any]]] = None + + chutes: Optional[Dict[str, Nullable[Any]]] = None + + cirrascale: Optional[Dict[str, Nullable[Any]]] = None + + clarifai: Optional[Dict[str, Nullable[Any]]] = None + + cloudflare: Optional[Dict[str, Nullable[Any]]] = None + + cohere: Optional[Dict[str, Nullable[Any]]] = None + + crofai: Optional[Dict[str, Nullable[Any]]] = None + + crusoe: Optional[Dict[str, Nullable[Any]]] = None + + deepinfra: Optional[Dict[str, Nullable[Any]]] = None + + deepseek: Optional[Dict[str, Nullable[Any]]] = None + + dekallm: Optional[Dict[str, Nullable[Any]]] = None + + enfer: Optional[Dict[str, Nullable[Any]]] = None + + fake_provider: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="fake-provider") + ] = None + + featherless: Optional[Dict[str, Nullable[Any]]] = None + + fireworks: Optional[Dict[str, Nullable[Any]]] = None + + friendli: Optional[Dict[str, Nullable[Any]]] = None + + gmicloud: Optional[Dict[str, Nullable[Any]]] = None + + google_ai_studio: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-ai-studio") + ] = None + + google_vertex: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-vertex") + ] = None + + gopomelo: Optional[Dict[str, Nullable[Any]]] = None + + groq: Optional[Dict[str, Nullable[Any]]] = None + + huggingface: Optional[Dict[str, Nullable[Any]]] = None + + hyperbolic: Optional[Dict[str, Nullable[Any]]] = None + + hyperbolic_quantized: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="hyperbolic-quantized") + ] = None + + inception: Optional[Dict[str, Nullable[Any]]] = None + + inceptron: Optional[Dict[str, Nullable[Any]]] = None + + inference_net: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net") + ] = None + + infermatic: Optional[Dict[str, Nullable[Any]]] = None + + inflection: Optional[Dict[str, Nullable[Any]]] = None + + inocloud: Optional[Dict[str, Nullable[Any]]] = None + + io_net: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="io-net") + ] = None + + ionstream: Optional[Dict[str, Nullable[Any]]] = None + + klusterai: Optional[Dict[str, Nullable[Any]]] = None + + lambda_: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lambda") + ] = None + + lepton: Optional[Dict[str, Nullable[Any]]] = None + + liquid: Optional[Dict[str, Nullable[Any]]] = None + + lynn: Optional[Dict[str, Nullable[Any]]] = None + + lynn_private: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lynn-private") + ] = None + + mancer: Optional[Dict[str, Nullable[Any]]] = None + + mancer_old: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="mancer-old") + ] = None + + mara: Optional[Dict[str, Nullable[Any]]] = None + + meta: Optional[Dict[str, Nullable[Any]]] = None + + minimax: Optional[Dict[str, Nullable[Any]]] = None + + mistral: Optional[Dict[str, Nullable[Any]]] = None + + modal: Optional[Dict[str, Nullable[Any]]] = None + + modelrun: Optional[Dict[str, Nullable[Any]]] = None + + modular: Optional[Dict[str, Nullable[Any]]] = None + + moonshotai: Optional[Dict[str, Nullable[Any]]] = None + + morph: Optional[Dict[str, Nullable[Any]]] = None + + ncompass: Optional[Dict[str, Nullable[Any]]] = None + + nebius: Optional[Dict[str, Nullable[Any]]] = None + + nextbit: Optional[Dict[str, Nullable[Any]]] = None + + nineteen: Optional[Dict[str, Nullable[Any]]] = None + + novita: Optional[Dict[str, Nullable[Any]]] = None + + nvidia: Optional[Dict[str, Nullable[Any]]] = None + + octoai: Optional[Dict[str, Nullable[Any]]] = None + + open_inference: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="open-inference") + ] = None + + openai: Optional[Dict[str, Nullable[Any]]] = None + + parasail: Optional[Dict[str, Nullable[Any]]] = None + + perplexity: Optional[Dict[str, Nullable[Any]]] = None + + phala: Optional[Dict[str, Nullable[Any]]] = None + + recraft: Optional[Dict[str, Nullable[Any]]] = None + + recursal: Optional[Dict[str, Nullable[Any]]] = None + + reflection: Optional[Dict[str, Nullable[Any]]] = None + + reka: Optional[Dict[str, Nullable[Any]]] = None + + relace: Optional[Dict[str, Nullable[Any]]] = None + + replicate: Optional[Dict[str, Nullable[Any]]] = None + + sambanova: Optional[Dict[str, Nullable[Any]]] = None + + sambanova_cloaked: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sambanova-cloaked") + ] = None + + seed: Optional[Dict[str, Nullable[Any]]] = None + + sf_compute: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sf-compute") + ] = None + + siliconflow: Optional[Dict[str, Nullable[Any]]] = None + + sourceful: Optional[Dict[str, Nullable[Any]]] = None + + stealth: Optional[Dict[str, Nullable[Any]]] = None + + stepfun: Optional[Dict[str, Nullable[Any]]] = None + + streamlake: Optional[Dict[str, Nullable[Any]]] = None + + switchpoint: Optional[Dict[str, Nullable[Any]]] = None + + targon: Optional[Dict[str, Nullable[Any]]] = None + + together: Optional[Dict[str, Nullable[Any]]] = None + + together_lite: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="together-lite") + ] = None + + ubicloud: Optional[Dict[str, Nullable[Any]]] = None + + upstage: Optional[Dict[str, Nullable[Any]]] = None + + venice: Optional[Dict[str, Nullable[Any]]] = None + + wandb: Optional[Dict[str, Nullable[Any]]] = None + + xai: Optional[Dict[str, Nullable[Any]]] = None + + xiaomi: Optional[Dict[str, Nullable[Any]]] = None + + z_ai: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="z-ai") + ] = None + + +class ProviderTypedDict(TypedDict): + r"""Provider-specific passthrough configuration""" + + options: NotRequired[OptionsTypedDict] + r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" + + +class Provider(BaseModel): + r"""Provider-specific passthrough configuration""" + + options: Optional[Options] = None + r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body.""" + + +ResponseFormat = Union[ + Literal[ + "mp3", + "pcm", + ], + UnrecognizedStr, +] +r"""Audio output format""" + + +class CreateTtsRequestBodyTypedDict(TypedDict): + r"""Text-to-speech request input""" + + input: str + r"""Text to synthesize""" + model: str + r"""TTS model identifier""" + voice: str + r"""Voice identifier""" + provider: NotRequired[ProviderTypedDict] + r"""Provider-specific passthrough configuration""" + response_format: NotRequired[ResponseFormat] + r"""Audio output format""" + speed: NotRequired[float] + r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.""" + + +class CreateTtsRequestBody(BaseModel): + r"""Text-to-speech request input""" + + input: str + r"""Text to synthesize""" + + model: str + r"""TTS model identifier""" + + voice: str + r"""Voice identifier""" + + provider: Optional[Provider] = None + r"""Provider-specific passthrough configuration""" + + response_format: Annotated[ + Optional[ResponseFormat], PlainValidator(validate_open_enum(False)) + ] = "pcm" + r"""Audio output format""" + + speed: Optional[float] = None + r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.""" + + +class CreateTtsRequestTypedDict(TypedDict): + request_body: CreateTtsRequestBodyTypedDict + 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 CreateTtsRequest(BaseModel): + request_body: Annotated[ + CreateTtsRequestBody, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + 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. + + """ diff --git a/src/openrouter/operations/getgeneration.py b/src/openrouter/operations/getgeneration.py index 94dfcb7..a7e457e 100644 --- a/src/openrouter/operations/getgeneration.py +++ b/src/openrouter/operations/getgeneration.py @@ -127,6 +127,7 @@ class GetGenerationRequest(BaseModel): "completions", "embeddings", "rerank", + "tts", "video", ], UnrecognizedStr, @@ -211,6 +212,8 @@ class GetGenerationDataTypedDict(TypedDict): r"""Usage amount in USD""" user_agent: Nullable[str] r"""User-Agent header from the request""" + web_search_engine: Nullable[str] + r"""The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel)""" request_id: NotRequired[Nullable[str]] r"""Unique identifier grouping all generations from a single API request""" session_id: NotRequired[Nullable[str]] @@ -328,6 +331,9 @@ class GetGenerationData(BaseModel): user_agent: Nullable[str] r"""User-Agent header from the request""" + web_search_engine: Nullable[str] + r"""The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel)""" + request_id: OptionalNullable[str] = UNSET r"""Unique identifier grouping all generations from a single API request""" @@ -369,6 +375,7 @@ def serialize_model(self, handler): "upstream_id", "upstream_inference_cost", "user_agent", + "web_search_engine", ] null_default_fields = [] diff --git a/src/openrouter/operations/getkey.py b/src/openrouter/operations/getkey.py index ec3948b..d2370a9 100644 --- a/src/openrouter/operations/getkey.py +++ b/src/openrouter/operations/getkey.py @@ -156,6 +156,8 @@ class GetKeyDataTypedDict(TypedDict): r"""OpenRouter credit usage (in USD) for the current UTC month""" usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" expires_at: NotRequired[Nullable[datetime]] r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" @@ -220,6 +222,9 @@ class GetKeyData(BaseModel): usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" + expires_at: OptionalNullable[datetime] = UNSET r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" diff --git a/src/openrouter/operations/list.py b/src/openrouter/operations/list.py index e1d703c..bf9965a 100644 --- a/src/openrouter/operations/list.py +++ b/src/openrouter/operations/list.py @@ -80,6 +80,8 @@ class ListRequestTypedDict(TypedDict): r"""Whether to include disabled API keys in the response""" offset: NotRequired[int] r"""Number of API keys to skip for pagination""" + workspace_id: NotRequired[str] + r"""Filter API keys by workspace ID. By default, keys in the default workspace are returned.""" class ListRequest(BaseModel): @@ -123,6 +125,12 @@ class ListRequest(BaseModel): ] = None r"""Number of API keys to skip for pagination""" + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter API keys by workspace ID. By default, keys in the default workspace are returned.""" + class ListDataTypedDict(TypedDict): byok_usage: float @@ -163,6 +171,8 @@ class ListDataTypedDict(TypedDict): r"""OpenRouter credit usage (in USD) for the current UTC month""" usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" expires_at: NotRequired[Nullable[datetime]] r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" @@ -225,6 +235,9 @@ class ListData(BaseModel): usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" + expires_at: OptionalNullable[datetime] = UNSET r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" diff --git a/src/openrouter/operations/listguardrails.py b/src/openrouter/operations/listguardrails.py index 8345e0e..f91db9e 100644 --- a/src/openrouter/operations/listguardrails.py +++ b/src/openrouter/operations/listguardrails.py @@ -75,6 +75,8 @@ class ListGuardrailsRequestTypedDict(TypedDict): r"""Number of records to skip for pagination""" limit: NotRequired[int] r"""Maximum number of records to return (max 100)""" + workspace_id: NotRequired[str] + r"""Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned.""" class ListGuardrailsRequest(BaseModel): @@ -118,6 +120,12 @@ class ListGuardrailsRequest(BaseModel): ] = None r"""Maximum number of records to return (max 100)""" + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned.""" + class ListGuardrailsResponseTypedDict(TypedDict): result: components_listguardrailsresponse.ListGuardrailsResponseTypedDict diff --git a/src/openrouter/operations/updatekeys.py b/src/openrouter/operations/updatekeys.py index a8d2f86..8ea2365 100644 --- a/src/openrouter/operations/updatekeys.py +++ b/src/openrouter/operations/updatekeys.py @@ -250,6 +250,8 @@ class UpdateKeysDataTypedDict(TypedDict): r"""OpenRouter credit usage (in USD) for the current UTC month""" usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" expires_at: NotRequired[Nullable[datetime]] r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" @@ -314,6 +316,9 @@ class UpdateKeysData(BaseModel): usage_weekly: float r"""OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)""" + workspace_id: str + r"""The workspace ID this API key belongs to.""" + expires_at: OptionalNullable[datetime] = UNSET r"""ISO 8601 UTC timestamp when the API key expires, or null if no expiration""" diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index 43d1636..8b26010 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -30,6 +30,7 @@ from openrouter.organization import Organization from openrouter.providers import Providers from openrouter.rerank import Rerank + from openrouter.tts import Tts from openrouter.video_generation import VideoGeneration @@ -64,6 +65,8 @@ class OpenRouter(BaseSDK): rerank: "Rerank" r"""Rerank endpoints""" beta: "Beta" + tts: "Tts" + r"""Text-to-speech endpoints""" video_generation: "VideoGeneration" r"""Video Generation endpoints""" _sub_sdk_map = { @@ -81,6 +84,7 @@ class OpenRouter(BaseSDK): "providers": ("openrouter.providers", "Providers"), "rerank": ("openrouter.rerank", "Rerank"), "beta": ("openrouter.beta", "Beta"), + "tts": ("openrouter.tts", "Tts"), "video_generation": ("openrouter.video_generation", "VideoGeneration"), } diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py new file mode 100644 index 0000000..f06e5fc --- /dev/null +++ b/src/openrouter/tts.py @@ -0,0 +1,474 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +import httpx +from openrouter import components, errors, operations, utils +from openrouter._hooks import HookContext +from openrouter.types import OptionalNullable, UNSET +from openrouter.utils import get_security_from_env +from openrouter.utils.unmarshal_json_response import unmarshal_json_response +from typing import Any, Mapping, Optional, Union + + +class Tts(BaseSDK): + r"""Text-to-speech endpoints""" + + def create_speech( + self, + *, + input: str, + model: str, + voice: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + provider: Optional[ + Union[operations.Provider, operations.ProviderTypedDict] + ] = None, + response_format: Optional[operations.ResponseFormat] = "pcm", + speed: Optional[float] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + r"""Create speech + + Synthesizes audio from the input text + + :param input: Text to synthesize + :param model: TTS model identifier + :param voice: Voice identifier + :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 provider: Provider-specific passthrough configuration + :param response_format: Audio output format + :param speed: Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. + :param 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.CreateTtsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + request_body=operations.CreateTtsRequestBody( + input=input, + model=model, + provider=utils.get_pydantic_model( + provider, Optional[operations.Provider] + ), + response_format=response_format, + speed=speed, + voice=voice, + ), + ) + + req = self._build_request( + method="POST", + path="/tts", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/octet-stream", + http_headers=http_headers, + _globals=operations.CreateTtsGlobals( + 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, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + False, + "json", + operations.CreateTtsRequestBody, + ), + 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="createTts", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "404", + "429", + "4XX", + "500", + "502", + "503", + "524", + "529", + "5XX", + ], + stream=True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/octet-stream"): + return http_res + if utils.match_response(http_res, "400", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res, http_res_text + ) + raise errors.BadRequestResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "401", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res, http_res_text + ) + raise errors.UnauthorizedResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "402", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res, http_res_text + ) + raise errors.PaymentRequiredResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "404", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res, http_res_text + ) + raise errors.NotFoundResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "429", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res, http_res_text + ) + raise errors.TooManyRequestsResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "500", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res, http_res_text + ) + raise errors.InternalServerResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "502", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res, http_res_text + ) + raise errors.BadGatewayResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "503", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res, http_res_text + ) + raise errors.ServiceUnavailableResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "524", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res, http_res_text + ) + raise errors.EdgeNetworkTimeoutResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "529", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res, http_res_text + ) + raise errors.ProviderOverloadedResponseError( + response_data, http_res, http_res_text + ) + 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 + ) + + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) + + async def create_speech_async( + self, + *, + input: str, + model: str, + voice: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + provider: Optional[ + Union[operations.Provider, operations.ProviderTypedDict] + ] = None, + response_format: Optional[operations.ResponseFormat] = "pcm", + speed: Optional[float] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + r"""Create speech + + Synthesizes audio from the input text + + :param input: Text to synthesize + :param model: TTS model identifier + :param voice: Voice identifier + :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 provider: Provider-specific passthrough configuration + :param response_format: Audio output format + :param speed: Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. + :param 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.CreateTtsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + request_body=operations.CreateTtsRequestBody( + input=input, + model=model, + provider=utils.get_pydantic_model( + provider, Optional[operations.Provider] + ), + response_format=response_format, + speed=speed, + voice=voice, + ), + ) + + req = self._build_request_async( + method="POST", + path="/tts", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/octet-stream", + http_headers=http_headers, + _globals=operations.CreateTtsGlobals( + 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, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + False, + "json", + operations.CreateTtsRequestBody, + ), + 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="createTts", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "404", + "429", + "4XX", + "500", + "502", + "503", + "524", + "529", + "5XX", + ], + stream=True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/octet-stream"): + return http_res + if utils.match_response(http_res, "400", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res, http_res_text + ) + raise errors.BadRequestResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "401", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res, http_res_text + ) + raise errors.UnauthorizedResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "402", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res, http_res_text + ) + raise errors.PaymentRequiredResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "404", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res, http_res_text + ) + raise errors.NotFoundResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "429", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res, http_res_text + ) + raise errors.TooManyRequestsResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "500", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res, http_res_text + ) + raise errors.InternalServerResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "502", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res, http_res_text + ) + raise errors.BadGatewayResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "503", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res, http_res_text + ) + raise errors.ServiceUnavailableResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "524", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res, http_res_text + ) + raise errors.EdgeNetworkTimeoutResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "529", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res, http_res_text + ) + raise errors.ProviderOverloadedResponseError( + response_data, http_res, http_res_text + ) + 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 + ) + + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) diff --git a/uv.lock b/uv.lock index f7af3d4..72f33e0 100644 --- a/uv.lock +++ b/uv.lock @@ -220,7 +220,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.9.1" +version = "0.9.2" source = { editable = "." } dependencies = [ { name = "httpcore" },