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..86544b0 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: a3ffff527d0fe48e5125249de82f2ffd 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: b0de018c-3cd5-4265-9df4-4171082569c2 + pristine_commit_hash: 89ef86ded0c371a4d4aa5f05ef361b3d889ce7d6 + pristine_tree_hash: faa3df338616ad91a18cd9f6298449d3ab477c91 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 @@ -132,6 +134,10 @@ trackedFiles: id: 980004cae93f last_write_checksum: sha1:6f66927f536c351dcfbb940672511bd8a6fdd1a0 pristine_git_object: 32e8fd42002d9379fa207d0867b428c443a63a42 + docs/components/apitype.md: + id: "0e0508573603" + last_write_checksum: sha1:da6482291629866b38facb5b8cb2b65fa42f0246 + pristine_git_object: 2fab7cdc89cd708d30ecf5d3b23f61e115189b71 docs/components/applypatchservertool.md: id: 924a4805520a last_write_checksum: sha1:f87ee16357b393e199bf0a4ba74e02130f1f243b @@ -228,6 +234,14 @@ trackedFiles: id: c161e7a17271 last_write_checksum: sha1:4f3c5e5dda570bb87ec7e2deff31e2372f36b833 pristine_git_object: 031166f6d79ea3ef1781e95468197271da98738f + docs/components/bulkaddworkspacemembersrequest.md: + id: 12cbe93243c4 + last_write_checksum: sha1:5bc0f5067f2fdd1a05409b18ec723b8b2acb4026 + pristine_git_object: 021221840a6dee060a6d38db651561e5cedf5fc5 + docs/components/bulkaddworkspacemembersresponse.md: + id: d3aab5e7eed9 + last_write_checksum: sha1:37171ea7c4582693d05a06f6ebeb19a129cf6a51 + pristine_git_object: 41c1638401d9354a1024e72a47d50110d24b71f5 docs/components/bulkassignkeysrequest.md: id: 66e9231f0c3c last_write_checksum: sha1:7c4564346bbe9f2692053bb1d518972a9db5ad0e @@ -244,6 +258,14 @@ trackedFiles: id: 04b004029650 last_write_checksum: sha1:64d50ed55132163d6d6337f53e7a97f7fbbdacbd pristine_git_object: 2d6897c459041c7d09ec0260ec7fe56efaa4584e + docs/components/bulkremoveworkspacemembersrequest.md: + id: e265be6b6db8 + last_write_checksum: sha1:a72176adae768afd731c2ccbad121c82ea3c163d + pristine_git_object: 370a7447730e57693615aa1dd96d48cef546117a + docs/components/bulkremoveworkspacemembersresponse.md: + id: 36a1e8be9e5c + last_write_checksum: sha1:994efa56174f14f87605bb3e19eefcdad0aea8b7 + pristine_git_object: 3769f7b5f970db9324d32ec681a30dcee2b0a6ad docs/components/bulkunassignkeysrequest.md: id: 6d254be079fd last_write_checksum: sha1:c61da3563e04a493e6b1b72e0f8e5f3f6f6075e8 @@ -718,20 +740,24 @@ 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/createworkspacerequest.md: + id: c81e27cca23b + last_write_checksum: sha1:9895786b65ad4195a260f2fc7a04090a240463e1 + pristine_git_object: d43defe1fc5d1037b75c60c910cdd6a43e286977 + docs/components/createworkspaceresponse.md: + id: 32307c6ed876 + last_write_checksum: sha1:42397009de7a6e3189fc86ba6b6350f1338b09fe + pristine_git_object: 5f467ec57a3ba214e27340588fee0d303688bd21 docs/components/customtool.md: id: ff0ec1b8ea8b last_write_checksum: sha1:1da938f1452f026020f8f3c617e2ee3fd11b78e5 pristine_git_object: 6cc1ff6a2b47a8fa754fa22f63506126b9b9d0a3 - docs/components/data.md: - id: 097aebaf54b6 - last_write_checksum: sha1:b2407ba7d2f14428d780fc4196d96622d2d4dc07 - pristine_git_object: 386321b1fbeae16dfa3fc07c073b7f1dd8844c1d docs/components/datacollection.md: id: cacd95d2ebf9 last_write_checksum: sha1:1d9eb4c12467860d5ef9edceb6456a4b9d6de643 @@ -756,6 +782,10 @@ trackedFiles: id: 78770374c8ed last_write_checksum: sha1:1ceae5a23d706b158b011b234d968a0fd495d2fc pristine_git_object: 7e0a483e6690842ba12d2a9349a9e2f0c79df8c9 + docs/components/deleteworkspaceresponse.md: + id: df0fb6410027 + last_write_checksum: sha1:e5eebf42ba059f27a266fee18c032e193fa382e6 + pristine_git_object: ba3c2bfda961110864cb08434398c94c698415f5 docs/components/easyinputmessage.md: id: a4927c37a92c last_write_checksum: sha1:9da1d4db9cd27f00a6b95f2bfd770e3e1f3755f0 @@ -1012,14 +1042,38 @@ trackedFiles: id: 88a512c5f9ce last_write_checksum: sha1:611201e2dbd2c8fe1c501b5365bc06367bc5370c pristine_git_object: 2f4629220306ced5674a9ef70dbcbce1f908b93a + docs/components/generationcontentdata.md: + id: 1085c488fd3a + last_write_checksum: sha1:186d3e8118f6d393d524a91e2ac06772a7eaf818 + pristine_git_object: 8bad571af50a9bc78e4ccc4b3f1d1911aac8c3b4 + docs/components/generationcontentdataoutput.md: + id: e4651dfa179c + last_write_checksum: sha1:3cedede3c273cc7bdd2971e7cd252f487729770b + pristine_git_object: 6847cf3f3a47d2911badcc90a5723a96f22f106d + docs/components/generationcontentresponse.md: + id: b2bded35fce6 + last_write_checksum: sha1:4f347840c969a60a734230601882eb01b4d64aaf + pristine_git_object: fb8acc9bc1fcee02384155f50ab24ac160d35af6 + docs/components/generationresponse.md: + id: ba81b6e0c164 + last_write_checksum: sha1:e7362ecc7f743d516fbb13fb0045739cb6e33eec + pristine_git_object: 20c523d806b2dae5c3c425f2020a5e5ab6079774 + docs/components/generationresponsedata.md: + id: 1059d258bbf8 + last_write_checksum: sha1:8d369352ae0ad3a68b17923320e959c872dde2f8 + pristine_git_object: a34a6ff5d0b2bea5c3134c951087004d83d05afe 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/getworkspaceresponse.md: + id: b65ac2b42215 + last_write_checksum: sha1:620b73e08c2b9fcd533b9106d392893cf6b16939 + pristine_git_object: b2f30b6a00e10002ae838d96747bc653fc219594 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 +1124,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 @@ -1096,6 +1150,14 @@ trackedFiles: id: 4ce388faaac0 last_write_checksum: sha1:3aad9a98e1bb15a540b9f8307a1c9524432e7959 pristine_git_object: 1e12f5f39649bbc28907eb579d26b1dedcd634d9 + docs/components/input1.md: + id: 8f1c3029546b + last_write_checksum: sha1:d663edec52736ced26235eef64a7cad9e2d9f321 + pristine_git_object: a6a125b4880fdc36a4a48a71d81d1d85a81390f5 + docs/components/input2.md: + id: 950f7afb714f + last_write_checksum: sha1:0f7308af83357715e138b0027cd723278d28b256 + pristine_git_object: 18930bf394330c4853277ad0d38622adfcef1229 docs/components/inputaudio.md: id: 3bad9d0f3bfb last_write_checksum: sha1:911ae8d63fb5a0fd4b27d922aa2547cc6e973523 @@ -1272,6 +1334,10 @@ trackedFiles: id: 331af539199a last_write_checksum: sha1:136d08c7846075581f141aa89c74743a4684585e pristine_git_object: 7b6d8235fbeb431c27cec3d689c6d5aa558d8d40 + docs/components/inputunion.md: + id: e92a20448613 + last_write_checksum: sha1:6caa00eb5847278d7fa4033f863a9719fece403f + pristine_git_object: 3667170c054053b09d2a34627f2cc1b1ed9cc01f docs/components/inputvideo.md: id: 5775df94513a last_write_checksum: sha1:9096278894b57ece97edefbfcfbbbae5f91fb259 @@ -1324,6 +1390,10 @@ trackedFiles: id: b34008c23794 last_write_checksum: sha1:a80fc686dfb13c7179c1a49808ca9d10fbca0cec pristine_git_object: 16092238affd61950df82d45bc46ae0be98df7b3 + docs/components/listworkspacesresponse.md: + id: 8cc6fbfc9dfb + last_write_checksum: sha1:ad9f94ea6eafd3cbd5d2c2dca61b3ac6f0403a1f + pristine_git_object: c4b9ff0e4cc402706ad28c35f75189aa2478470a docs/components/logprob.md: id: 351b5c050527 last_write_checksum: sha1:fce93846d1c33a013a40764c5e00e6191982bdbf @@ -1386,8 +1456,12 @@ trackedFiles: pristine_git_object: 317190772f743d2aba63c4dad770827b46688f6a docs/components/modelscountresponse.md: id: abdad0c1a02a - last_write_checksum: sha1:6c32f935021d24ff9eeae39f903f71b9ddaedf3d - pristine_git_object: 84bbce80ebf7ce2a93ad853bfe2f2a80a8395077 + last_write_checksum: sha1:50ae205604eddcbdced268b8cd3e1ac06f0dd7c0 + pristine_git_object: 4ad6e6a692b19b29789b7a505fae3df72b3fc19d + docs/components/modelscountresponsedata.md: + id: 98e05b6bdddd + last_write_checksum: sha1:62caa9966f2730ed93eba332041916903d279228 + pristine_git_object: d661997290e487a9d0920293830a81afb8b4a853 docs/components/modelslistresponse.md: id: 37e791d4f265 last_write_checksum: sha1:fb8fe5748b0c7a5e1e515233cad4d9524cd342bd @@ -1550,8 +1624,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 +1652,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 +1776,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 +1796,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 +1908,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 +1938,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 +2088,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 +2104,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 +2494,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 +2512,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 +2604,16 @@ 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/updateworkspacerequest.md: + id: 0fa61bf22fc1 + last_write_checksum: sha1:5dd78e26e38451ff3dc8fb69a3210a42b7725b94 + pristine_git_object: 67df9c0c21ff7fac081bf9605c6f2b0c9c61e048 + docs/components/updateworkspaceresponse.md: + id: c8e4b8fbf004 + last_write_checksum: sha1:39db19593561aba4e4de2750d9b40a5ed39e7433 + pristine_git_object: dd0c048e521e4f2653a2c97621ba6278374efa97 docs/components/urlcitation.md: id: 02c4f88e5f51 last_write_checksum: sha1:5d5a717a552b86279bfe20c6125cb0561d2052dd @@ -2560,6 +2638,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 @@ -2676,6 +2758,18 @@ trackedFiles: id: ac432a0db67a last_write_checksum: sha1:6b322242229459f409a83243db53ff8069fe1a3f pristine_git_object: 8213d86aa4dea092924605829dce95a1f31b0897 + docs/components/workspace.md: + id: 0a15ff43e01c + last_write_checksum: sha1:34fabbb9d6362a84aaeef3f8f92ff024097830ed + pristine_git_object: 591977e28a5f319d0722b111d7f8fed7eebf7a77 + docs/components/workspacemember.md: + id: 250baf73019f + last_write_checksum: sha1:d0079b9edc10857c5d2fd55b8122851e235dec21 + pristine_git_object: 31e122462373cfbb603a4e35d88810743e9e585b + docs/components/workspacememberrole.md: + id: b6a965f120c4 + last_write_checksum: sha1:3315f44ee8ccfccabfcf89f32cb7d585864593be + pristine_git_object: 00592d06a5c490ccce759f0b259f756f3f11c104 docs/errors/badgatewayresponseerror.md: id: 32126b40d635 last_write_checksum: sha1:86b3a24f2523bb4df0972bf2fca93dceb7a190a2 @@ -2744,10 +2838,14 @@ trackedFiles: id: 4343ac43161c last_write_checksum: sha1:562c0f21e308ad10c27f85f75704c15592c6929d pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf - docs/operations/apitype.md: - id: e271bff20dc7 - last_write_checksum: sha1:589d9ed0a91014cf2b66f83a118259aafb78983f - pristine_git_object: ffff0b9ea5cb410b51798b848ccf40a763edc216 + docs/operations/bulkaddworkspacemembersglobals.md: + id: 6cff183f93a1 + last_write_checksum: sha1:39941ebc9a51b0189aed03680e2168e25b7c9692 + pristine_git_object: f4a5325dcf71a943b6b1d01679587f2b0b291fd3 + docs/operations/bulkaddworkspacemembersrequest.md: + id: d8246fdf3e0b + last_write_checksum: sha1:156694bd17ba999b2ce0886da7153e7d349beea7 + pristine_git_object: df933fdfe35d136462f083cd40afb3d997171024 docs/operations/bulkassignkeystoguardrailglobals.md: id: 10cab63c9a95 last_write_checksum: sha1:5c7983931ef784a72f7dfec732eb7809d352c313 @@ -2764,6 +2862,14 @@ trackedFiles: id: 6d6c7e9ae12f last_write_checksum: sha1:8aa5702d46c01c87db1df7624b5125ee9bbc8edc pristine_git_object: f15474f24f02a38716f8c83f74a501a3dadef26a + docs/operations/bulkremoveworkspacemembersglobals.md: + id: eca056a05e51 + last_write_checksum: sha1:eb2295ca61d2b6f430119c3e42a3cda4958b2fea + pristine_git_object: e2a1edc52f0035b6d0f55403fc5ead2e351f2499 + docs/operations/bulkremoveworkspacemembersrequest.md: + id: ac8eba8ae2ab + last_write_checksum: sha1:ca7f3d49baa41f7996bff82eb7a6cae01fb3275b + pristine_git_object: ee134f45349379dd00569354b8aaa2a6d1aed373 docs/operations/bulkunassignkeysfromguardrailglobals.md: id: "491635767122" last_write_checksum: sha1:06e7a6b0f052e73e5cacd480e3bff8ab7756d0b0 @@ -2796,6 +2902,18 @@ trackedFiles: id: 01cceb61d42f last_write_checksum: sha1:7e1d73bd30584d55f4b116737c15d7c73cdf6a3a pristine_git_object: 522f4978a3c4e1d1c0d197b541fc57e745b7d4e7 + docs/operations/createaudiospeechglobals.md: + id: c67d64f11ad7 + last_write_checksum: sha1:a0026b1caf2268dd4a79177fa2bb630eca1498b4 + pristine_git_object: 0fbd4f1ad17604e5e31b457c0e3073d5389539c8 + docs/operations/createaudiospeechrequest.md: + id: d3139a0713f5 + last_write_checksum: sha1:3fc0c48cb8bc3d011116784e33ebe8492fe690fe + pristine_git_object: d207aee7fccc064b1d89a46ff480fdb968d69496 + docs/operations/createaudiospeechrequestbody.md: + id: 2732c72616d3 + last_write_checksum: sha1:d9cd36265595629ac2bce8a014863ef64a151c40 + pristine_git_object: e99309366dc94307c3e1fcc4415fc0e4751c4e4f docs/operations/createauthkeyscodecodechallengemethod.md: id: d598c7da9363 last_write_checksum: sha1:3b81340adcf218991f7829e692e64f484763de2b @@ -2846,8 +2964,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 +2976,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 +2992,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 @@ -2928,6 +3046,14 @@ trackedFiles: id: b8190b2b48e4 last_write_checksum: sha1:ccf223bd7e2958b01032fffc328ba43f0e6bf260 pristine_git_object: c9ce4f85e23827bdd48ebb8bf00525343eac73ce + docs/operations/createworkspaceglobals.md: + id: bb43600a84d0 + last_write_checksum: sha1:431ed0e1519765d8b94d50ac991a64f6e6241513 + pristine_git_object: 1f46dbb7552fe39db8fdf7209d9d5287f808bfa4 + docs/operations/createworkspacerequest.md: + id: 9aebad99652f + last_write_checksum: sha1:26e3648e75871274c27e60ed42715d7434223819 + pristine_git_object: ac92a748a5524ccb683ffb32dce19de3714a0e37 docs/operations/datacenter.md: id: b08a21cce65c last_write_checksum: sha1:9f399d250c42bff63295881990961f871a36b8a9 @@ -2952,6 +3078,14 @@ trackedFiles: id: 843ae03c4c33 last_write_checksum: sha1:3e34ea65b5397e4d1203306e4a08f12023ebfba2 pristine_git_object: cc7cddbdde6e0f31ddbec25b8a01e7ece0b8e04c + docs/operations/deleteworkspaceglobals.md: + id: c9f40cc89b0e + last_write_checksum: sha1:4131177651ca5ad33b7160b2f4b8ff74e2233152 + pristine_git_object: ef29294eda583f20fa40d5a544537cb72f1e98d8 + docs/operations/deleteworkspacerequest.md: + id: bd62f5b93ebd + last_write_checksum: sha1:8bd64edf9b0684036c34ab258b95914d46cf8520 + pristine_git_object: 980bab8fc4db27e0e7ef13f8799e0abd3ce8054e docs/operations/document.md: id: 640b715eb2a4 last_write_checksum: sha1:18b3bcf786efa0cf41dd10ba4c3a3a58c65cd134 @@ -3016,10 +3150,6 @@ trackedFiles: id: 37af8951de4d last_write_checksum: sha1:1e62836ec19a8aad8b0dcafd7799b71250a5c6f7 pristine_git_object: 2855d5b95d41a494bc7ffa9f85c74ff27a46ca96 - docs/operations/getgenerationdata.md: - id: 89a3aab8da20 - last_write_checksum: sha1:a535e1604ef9524eb8fb752711abd36dbe7219c6 - pristine_git_object: 7be5766a6c6a5f065834bdbbec761795c255689f docs/operations/getgenerationglobals.md: id: 0d6e856c5861 last_write_checksum: sha1:b5236815132dedf2b595fd520f1753d5ec8bb6e0 @@ -3028,10 +3158,6 @@ trackedFiles: id: c830d67c6a95 last_write_checksum: sha1:508adc1d9d3a03a5b6d12515ae9dd8f0b5b1c2e4 pristine_git_object: 8c54a7a47635c68bb980670de08a748d076a401a - docs/operations/getgenerationresponse.md: - id: ab03c2c610cc - last_write_checksum: sha1:419e7fafd845db9c63545b55bf6ab1ecd6a04371 - pristine_git_object: 989c19a3997fe21716eea833ef30eef8a980b733 docs/operations/getguardrailglobals.md: id: 6cf14d555b8f last_write_checksum: sha1:025d0a3b53ce5603d5d262a5db3ac54b5ce981d0 @@ -3042,8 +3168,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 +3180,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 @@ -3080,6 +3206,14 @@ trackedFiles: id: 2eeac3b6576d last_write_checksum: sha1:9f6eec582ec3a568a6e14f57a687f0d360fc9748 pristine_git_object: db40577d2526f81edbcc38cef6517c598a98bc7b + docs/operations/getworkspaceglobals.md: + id: c0101897f893 + last_write_checksum: sha1:5ac92be2d4cd79c39bad1ed47a4e689ed44f3769 + pristine_git_object: 1bd5e0856557b36ea222bd2b685557bb0c75a7f3 + docs/operations/getworkspacerequest.md: + id: 6443ed4f7ead + last_write_checksum: sha1:c2ada6583e276f2a6c553b24053453853207b302 + pristine_git_object: 8b59d2daf235f8af09bf4664c8080ea7a0e5b3e2 docs/operations/headquarters.md: id: 3ccf7adf2542 last_write_checksum: sha1:24ca86fa6e2ebabf4cb034f6e368901e5041ccc7 @@ -3098,8 +3232,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 @@ -3132,6 +3266,14 @@ trackedFiles: id: 37a957da8f54 last_write_checksum: sha1:6892fe1fc31da14493b937171caec5f0fabb8daf pristine_git_object: 54cf662af701995f7c04272d932f9a2e2731beeb + docs/operations/listgenerationcontentglobals.md: + id: 86c60d8ee820 + last_write_checksum: sha1:6bb5e89777b8f25572237af5065a15ff5abea244 + pristine_git_object: eb76ee2d7e2516c9942be0fb3a1fe38177741f71 + docs/operations/listgenerationcontentrequest.md: + id: 2fd43266dedb + last_write_checksum: sha1:e9831ae9536176f944df36910bcbcde652545a6d + pristine_git_object: a025996eecd9ddf89a1eb10a5931becdc58983bc docs/operations/listglobals.md: id: 32d30e56f680 last_write_checksum: sha1:6b2661b1a208354794ee9f591c7581526d4641be @@ -3166,12 +3308,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 +3396,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 @@ -3276,6 +3418,18 @@ trackedFiles: id: e0e776f67adb last_write_checksum: sha1:0d590826439a800f340367b6721265535827aede pristine_git_object: cbd65ef6238a8b9bb2c36bc37cbdb5a5e181d3ad + docs/operations/listworkspacesglobals.md: + id: 4ccdc202de01 + last_write_checksum: sha1:3eade1075e3b0f917a9afee3da18cfebbc4ac886 + pristine_git_object: c5967dd23490646d0a10ffa24df8aa0bab712c9f + docs/operations/listworkspacesrequest.md: + id: 93bf2ba40fbd + last_write_checksum: sha1:c0d073a290e63ae12c5099d38abc89f87d6ca525 + pristine_git_object: f46ba571e6e7cefe535e9a429ed811978fe697a8 + docs/operations/listworkspacesresponse.md: + id: 54505a70bba7 + last_write_checksum: sha1:90d3fcda91c48f1d0fdcda4f25854a2cb0957259 + pristine_git_object: 2b69f1d3a2517a84d2b98db1ba9c3224b1e475cf docs/operations/object.md: id: baee3544844d last_write_checksum: sha1:2fba5ecf3f93c90460a972666d6acdfb597cafad @@ -3284,10 +3438,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 +3500,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 +3520,16 @@ 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/updateworkspaceglobals.md: + id: 1f2cac8a13a4 + last_write_checksum: sha1:aeffb26e2ce0ddfe37f1ccee67035ebe9041c673 + pristine_git_object: 5835a41ee1c7a0e557a7282271e8d31230b54e82 + docs/operations/updateworkspacerequest.md: + id: 719c33978f4d + last_write_checksum: sha1:3ea95e60674f4d0380f532123c75579855ac00fe + pristine_git_object: d5bd345f6faefd5e2448b7e6c6c15ae58df7d0d2 docs/operations/usagelimittype.md: id: f83f3fcb36f8 last_write_checksum: sha1:9c272d9908a57fdbd2b376e13c8fd226e7d4ce65 @@ -3362,8 +3540,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 @@ -3382,12 +3560,12 @@ trackedFiles: pristine_git_object: 2ce96e9a6eedf3a64256cd848615e9c4fd76c0af docs/sdks/generations/README.md: id: a7d12ae95fb1 - last_write_checksum: sha1:5846217fd9616824edcf5f41d6c54bc727f07195 - pristine_git_object: 332b5683cfe8c07ce4cae93b3247cd56f545f535 + last_write_checksum: sha1:70dbb18cfaff95cf5e398fed34ef969a683964d5 + pristine_git_object: 7fd647d02bfd29a3c7a5da0487761e89f308f224 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,22 +3590,34 @@ trackedFiles: id: e717bad14f63 last_write_checksum: sha1:02f29159f69cbc264437745e1d7cd54ed7e30ced pristine_git_object: a38d2b1b819d977c739f6a7b6f55344514c5447c + docs/sdks/tts/README.md: + id: 0c425074d09f + last_write_checksum: sha1:4bf1638fd6ea12b94e82b99809ebb8e92e323e2f + pristine_git_object: c673b9eecca076f013d6a6f6ea32d5a8c32b7e41 docs/sdks/videogeneration/README.md: id: b6dbf7b0729c last_write_checksum: sha1:594c4bbe8b2396d28e4a5fe664e21de4d2dc8444 pristine_git_object: b2f26971f1f28f4614f021ffdb87fe958522d029 + docs/sdks/workspaces/README.md: + id: 1f5b051a6380 + last_write_checksum: sha1:5191434ffb3d51b2ae8961b0920952ef08442c88 + pristine_git_object: 8abe8b06bf5f2c7df0e514b7fb2dfeeab8a516b3 py.typed: id: 258c3ed47ae4 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 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 +3636,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 +3660,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:7d684ae6755d097bcefe6b56db09e7b392cf3573 + pristine_git_object: f3c7aa77875b81168712c5bc748f45dfdc586bd6 src/openrouter/components/activityitem.py: id: 3bbe7d35f459 last_write_checksum: sha1:32b873ba5c0a9dbf5f0cf32c0217ce17395ae69e @@ -3516,6 +3706,14 @@ trackedFiles: id: 8bd09a7e873a last_write_checksum: sha1:c7c812629a7fc46f8064bc874b77424b30df9226 pristine_git_object: 22bd982575db23648faceab9dbedf75fa1f1cb38 + src/openrouter/components/bulkaddworkspacemembersrequest.py: + id: c042d4bce938 + last_write_checksum: sha1:dd5b69cce65985231a77351be04aadeecc85c46c + pristine_git_object: c7927258bba10e237972eb9ba2fdefc51c255c78 + src/openrouter/components/bulkaddworkspacemembersresponse.py: + id: 2b00519587ec + last_write_checksum: sha1:0a06047ed1719ecae11bd563513eb1f4b7527c19 + pristine_git_object: f46030f3a99672a57495047392e286d48cd1d4ad src/openrouter/components/bulkassignkeysrequest.py: id: f801d53f55d5 last_write_checksum: sha1:20f64607c61683eb2438b5b7411643e1340b2db6 @@ -3532,6 +3730,14 @@ trackedFiles: id: 6c7ce2235489 last_write_checksum: sha1:c708637e9d6aaf9eef90747b3da1af97c1b73e92 pristine_git_object: 2435b0dc46cc7e26a961eafde84ca68ad52a0a95 + src/openrouter/components/bulkremoveworkspacemembersrequest.py: + id: b420f0c56b0f + last_write_checksum: sha1:9564d3caa2da67db04624ffa5ada84fcdf31a610 + pristine_git_object: a02c46cd5ea87dc00f6db01f1be72f36b90b05ad + src/openrouter/components/bulkremoveworkspacemembersresponse.py: + id: 5c4c7d603c5a + last_write_checksum: sha1:e64c15f3c75ca08aad6b32a7555ce3812c59a520 + pristine_git_object: 69082ffbbb380c690ca659819bab53869b82f273 src/openrouter/components/bulkunassignkeysrequest.py: id: f7ef88765f9b last_write_checksum: sha1:a46b022e4264377b2d8c137f9d0df34824aa2100 @@ -3754,12 +3960,20 @@ 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 pristine_git_object: d6c4a4dc73222668daddc2a1788d314ff30e8fe6 + src/openrouter/components/createworkspacerequest.py: + id: 3785d9b207c2 + last_write_checksum: sha1:f92859f4b9d641652e8faf004ce78c04bd9a9dfe + pristine_git_object: ff5d50610b7b198a27641fc56f021331d4ab0ec5 + src/openrouter/components/createworkspaceresponse.py: + id: 986d9ff993c1 + last_write_checksum: sha1:7e9028b437a9e33a7541ba222cf01e6629f5c74d + pristine_git_object: 54c7b43902b4c72a43cf4ea1fa965edbdecb5304 src/openrouter/components/customtool.py: id: e83b0c530680 last_write_checksum: sha1:4ac260beeb9cb5b2bd21156d23315263ebe7f891 @@ -3780,6 +3994,10 @@ trackedFiles: id: c3ac908331ef last_write_checksum: sha1:8984f78ae6a2b3ee8b16d7f0018622ba725c1583 pristine_git_object: f31843cfe4e36f3f6371837221b6966fabaa563a + src/openrouter/components/deleteworkspaceresponse.py: + id: 5e45e8064f69 + last_write_checksum: sha1:4e326914693c0d0caf901651cf214f73df624f64 + pristine_git_object: bed459583970617979bb6aec394bfeb161274514 src/openrouter/components/easyinputmessage.py: id: 72619a312585 last_write_checksum: sha1:154ba5f3afee09526acdc5d6291584e01c54f6ed @@ -3852,14 +4070,30 @@ trackedFiles: id: bf659aa04e7d last_write_checksum: sha1:0beae7f5475531ffd58d6b8bcceb5e9ea987387f pristine_git_object: 239f67dc3d0b8bd82e81c1f510afb7df96397401 + src/openrouter/components/generationcontentdata.py: + id: 0140215b5b46 + last_write_checksum: sha1:09e15ae2acc4f44084e2206ea51e6a06f4c5ee11 + pristine_git_object: 065679a3408bbfd07e86646a6b3aa135cd573973 + src/openrouter/components/generationcontentresponse.py: + id: c3f3f745a193 + last_write_checksum: sha1:0a87a329f4b565c773d730ddc74595c6a0d64ddc + pristine_git_object: b762f6507fe7c7456df88a9400f82587fd6d63c9 + src/openrouter/components/generationresponse.py: + id: 84d4e3e7da8b + last_write_checksum: sha1:00c33b54f88c0596ad0155891d6f5ac64d39ccce + pristine_git_object: 2c8546cbfbaec3285c68c5f6d35a34614bcf49e5 src/openrouter/components/getguardrailresponse.py: id: 6f9054fab3d9 last_write_checksum: sha1:f20a0be686991d8f7ed0eb884612586052efc5c1 pristine_git_object: 6cdeb99e76ab6ad2e22b13164efbdb68cf8f328d + src/openrouter/components/getworkspaceresponse.py: + id: d993d0c4c3da + last_write_checksum: sha1:918535730d1c352bcc8fd2342e1c4cea89bc357f + pristine_git_object: acda534cb0ced2a391479b720434cf0f57f46276 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 +4128,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 @@ -3976,6 +4210,10 @@ trackedFiles: id: 78ca80afcc6f last_write_checksum: sha1:3edda0c8ff111abaf5332475d89a87e84f4f5d78 pristine_git_object: 1497ba3814f2f058c1332d8bcf92a2e2bbed0fe5 + src/openrouter/components/listworkspacesresponse.py: + id: 0c5f98eddbf5 + last_write_checksum: sha1:53b10630a44ccc43fa86a34e9a3f5a64f08488c4 + pristine_git_object: b70d4bbc7e84bc0f9ae3beedb8784bbc46aae9c0 src/openrouter/components/mcpservertool.py: id: bb8aeb03a111 last_write_checksum: sha1:014b01dd6253437640d2b3fbd084cfddb2399073 @@ -4002,8 +4240,8 @@ trackedFiles: pristine_git_object: c197cb2c527296adff2c3cfd9e49bcbc48087ce7 src/openrouter/components/modelscountresponse.py: id: c08f960ac611 - last_write_checksum: sha1:e53d3191d1edd6e289a90fe22c69ab1f02ec73ed - pristine_git_object: 86bb27c9ce62c148a54ec7a61796154a2ca18c76 + last_write_checksum: sha1:82669f5aa9379f6c90393ea0b78f2bafdce545df + pristine_git_object: 8d68ee4aa093ba2754a65f28e46a23a1848fd99b src/openrouter/components/modelslistresponse.py: id: c2d4bb2cac89 last_write_checksum: sha1:54bc618bea7ddcaa4e49082d601065c634fb2ea1 @@ -4058,8 +4296,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 +4348,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 +4376,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 +4386,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 +4468,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 +4480,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 +4662,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 +4672,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 @@ -4476,6 +4714,14 @@ trackedFiles: id: 7b068d26ce31 last_write_checksum: sha1:2b63cbb90747f07f775d9a22e80f74c67221fea8 pristine_git_object: df833960211cc7ed2a2a42fddbeafda0092e1c0c + src/openrouter/components/updateworkspacerequest.py: + id: 78d86b3b0a63 + last_write_checksum: sha1:38588bb58f96787042b61632e385a1caa8284d48 + pristine_git_object: a0ed36488f27be8420843c6fd1b102919dfc629e + src/openrouter/components/updateworkspaceresponse.py: + id: 46253fa9690a + last_write_checksum: sha1:4708e7e4cbfddc34ffc9ed4808a88bb5b4a61ebf + pristine_git_object: 35d7ad3f80af77356a5478b386be29773f31db69 src/openrouter/components/urlcitation.py: id: fe4578e64ea3 last_write_checksum: sha1:c63b25e9b3162a543d7e4a8bb88f8a10b2d8d8d9 @@ -4486,8 +4732,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 @@ -4560,6 +4806,14 @@ trackedFiles: id: 34efd6600d16 last_write_checksum: sha1:cb3ea048d0ba10bb8fe943c8e1330e677f598a2f pristine_git_object: a716b872c7c00c57fc27733362d5e78120c89c3e + src/openrouter/components/workspace.py: + id: 682282304bd8 + last_write_checksum: sha1:517e8b4540a5aea467e7da4f947a3ebb8b6125fd + pristine_git_object: a097f389c54954c983e9dc5f94f1956d95747ef2 + src/openrouter/components/workspacemember.py: + id: b510f727fe9c + last_write_checksum: sha1:63595d8ce7e9df050f1bc97f7cf70b4215da09d0 + pristine_git_object: 9ece87803cfa8b3ab38c0dffdfbd8de176eaaed5 src/openrouter/credits.py: id: cdc961937101 last_write_checksum: sha1:2d49b088f5895c7d1b3167d6d99d304221812fb6 @@ -4654,12 +4908,12 @@ trackedFiles: pristine_git_object: 7304f75b9e8f3bef2d1c918f875420b26a15f8d7 src/openrouter/generations.py: id: 70e1c21042bc - last_write_checksum: sha1:a8dcb94d3809b0b837398caca08dabd3c0481d21 - pristine_git_object: fddcce7468125b281b22f520928ee5d31f027fc5 + last_write_checksum: sha1:f7df8719bf188b05a29b8694e6c2db7adb262bd3 + pristine_git_object: 409e169fc5f43a0eea65b7568588c25c82abb46a 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 +4940,12 @@ 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:ca44c6691ddf2770581533c100735cf9adcb3acf + pristine_git_object: cdb9571d481e21aa590599e6289d482a3d534c25 + src/openrouter/operations/bulkaddworkspacemembers.py: + id: e0ed56117619 + last_write_checksum: sha1:2b9c73dd8a24d6c479d50118a309e4e0969ca7ea + pristine_git_object: 32dcfea12b195a499c91c55aee78aaa0144e60e0 src/openrouter/operations/bulkassignkeystoguardrail.py: id: 6d8435d51d9d last_write_checksum: sha1:2136b0223191e5d8159c77cff06845958930184e @@ -4696,6 +4954,10 @@ trackedFiles: id: 079706f81038 last_write_checksum: sha1:7c8fb1abae40f33c8d467f73b3779503469cad1c pristine_git_object: 80a1cb770eb34221c7691abb44849bb6db23322d + src/openrouter/operations/bulkremoveworkspacemembers.py: + id: b5f68d465d4d + last_write_checksum: sha1:1fbd3d2660a4261d12c97b464bc445f4dc24c891 + pristine_git_object: fe0ebfd7d6f5e748ba7105c848c94fe3ed6598ea src/openrouter/operations/bulkunassignkeysfromguardrail.py: id: 006249615b0e last_write_checksum: sha1:88df9d073f73c7d1f0fb70e46a109b17f84f04e8 @@ -4704,22 +4966,26 @@ trackedFiles: id: 8127aafae1ef last_write_checksum: sha1:a4c24a2e84c611856ed0ea45168b31cd5b8e1dd0 pristine_git_object: 3613dcf6d85a45e916983f238cd807695433b401 + src/openrouter/operations/createaudiospeech.py: + id: af9df6195878 + last_write_checksum: sha1:4909447a6e1f0a66bbf78962e24d65d514e5fc61 + pristine_git_object: 511f57c6e2b0cf123b8be97ca7cdbd86e01185ac src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 last_write_checksum: sha1:de809cb9a55efb7b22d033bace50344bf53696f4 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 @@ -4732,6 +4998,10 @@ trackedFiles: id: d52f6a4a3fe4 last_write_checksum: sha1:12507b8087961d8efe67590e8c5b93f47a9d1a23 pristine_git_object: 3892fc759bd022cdbbaf830f5f20f655131a6d90 + src/openrouter/operations/createworkspace.py: + id: 690a809c4592 + last_write_checksum: sha1:897268bff3352aff34ba62f6622ee3ba17406752 + pristine_git_object: 1757be8d72bad9c0076d5492babb798eba2b5582 src/openrouter/operations/deleteguardrail.py: id: 1fbdb98bbb85 last_write_checksum: sha1:e245a5061592daf839d38caace9cc38abbce879d @@ -4740,6 +5010,10 @@ trackedFiles: id: 0bd72d53b0a0 last_write_checksum: sha1:de3ec2a557ba007482a9d7ecaecef00cb6ead537 pristine_git_object: 51d48818bce022ab5e9514ea48429e3aca75e997 + src/openrouter/operations/deleteworkspace.py: + id: f92017ce65e8 + last_write_checksum: sha1:ac9aa22002cf938a69643dac44c38ab7d702c31c + pristine_git_object: fbfef8826b9993d95d355ec0335f943e97a75bda src/openrouter/operations/exchangeauthcodeforapikey.py: id: 37bdd1517a07 last_write_checksum: sha1:963c95a165a35ae235d9b03d31c4e029de0246d4 @@ -4754,16 +5028,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:7c919236caf0943f145d584024a85bb663f0e911 + pristine_git_object: bf21d05e955bbfc62ed484b566555bafe0049e10 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 @@ -4776,10 +5050,14 @@ trackedFiles: id: a5f626467a69 last_write_checksum: sha1:00f000b3fab29247f632c12bcdfe71a579a2ee6a pristine_git_object: 3a120ed0aacd7ac94b3421fc1439e1308d53f83f + src/openrouter/operations/getworkspace.py: + id: 2ead327ab15e + last_write_checksum: sha1:d9c6371c14333537e74d326634bc2ed2dbbeb76a + pristine_git_object: f4d279e42c326dbda828b4a875cd152cfa0ae14a 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 @@ -4792,6 +5070,10 @@ trackedFiles: id: 588bf206e92f last_write_checksum: sha1:6d8e90c542ae6344e403767a3a4f8ec5d1d4dc75 pristine_git_object: 23e735db74e27dc35e80b2f72cf386b0eeeb116d + src/openrouter/operations/listgenerationcontent.py: + id: 2f086d74631c + last_write_checksum: sha1:922e30991bb7b3ef69e2672a2b969d74ce0b838d + pristine_git_object: 8d195009671fdd52cc86795bc1612fa3ddb79364 src/openrouter/operations/listguardrailkeyassignments.py: id: ee9d33f4de6b last_write_checksum: sha1:51cdc972a09b21dc3610b634bd0837a8d3b5b249 @@ -4802,8 +5084,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 @@ -4836,6 +5118,10 @@ trackedFiles: id: 77ba4890284b last_write_checksum: sha1:9bb93fb1d1d71effb5f4dc58cef9d7b2265a92b7 pristine_git_object: d1497b8429e19d06cc674940e2641b3ed2222ca7 + src/openrouter/operations/listworkspaces.py: + id: fe94c6f61835 + last_write_checksum: sha1:d8845cc07779359b6d9b29ff4a2367e8c8eeb942 + pristine_git_object: 236dc188826db184deca4a749dab47e58c3dd637 src/openrouter/operations/sendchatcompletionrequest.py: id: d9fee71bb577 last_write_checksum: sha1:35f707844223de94c0ddcb0d7d67abb50dc0fa26 @@ -4846,8 +5132,12 @@ 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/operations/updateworkspace.py: + id: 2e9960985cbc + last_write_checksum: sha1:88c11ee7a31bc5e2267981d882a01a2a71aafe55 + pristine_git_object: 4ab7929896a5dede1fa4cf9ce6acfaedd99160aa src/openrouter/organization.py: id: 6f4c63c416e8 last_write_checksum: sha1:4ca00158cd6a4971e7a4cf6da1ef084da25630d9 @@ -4870,12 +5160,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:9030d3ea5c154aab3a2534588c05054fd1f8ed2e + pristine_git_object: 580ff52d4a8a33bb3301ce7d4e2a4ede4f407c05 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:f3d4f004f4481e44e9f159e8495ce22858be0d6c + pristine_git_object: 4a8f39debf6dc2ccf8e97dac41d49519f37aa453 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:140ebdd01a46f92ffc710c52c958c4eba3cf68ed @@ -4956,6 +5250,10 @@ trackedFiles: id: d0a90c1b8efe last_write_checksum: sha1:e71109a7ac4215c56e5fa3d0e843d532278d681c pristine_git_object: 238bbcc92885086a6faaf351dbfdc095b8c6d8d8 + src/openrouter/workspaces.py: + id: cd6c533b1802 + last_write_checksum: sha1:0fd13cd2b072d5ae2e95812c4103408f3cc604d7 + pristine_git_object: 5d6e6ce57547701328c3afc3430a91b2acbbb175 examples: createResponses: speakeasy-default-create-responses: @@ -5098,7 +5396,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": null, "cancelled": false, "created_at": "2024-07-15T23:33:19.433273+00:00", "external_user": "user-123", "finish_reason": "stop", "generation_time": 1200, "http_referer": "https://openrouter.ai/", "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": null, "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": "Mozilla/5.0", "web_search_engine": "exa"}} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "402": @@ -5175,7 +5473,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 +5486,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 +5495,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 +5506,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 +5540,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 +5562,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 +5573,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 +5589,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 +5605,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 +5875,172 @@ examples: application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createAudioSpeech: + speakeasy-default-create-audio-speech: + 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"}} + listGenerationContent: + speakeasy-default-list-generation-content: + parameters: + query: + id: "gen-1234567890" + responses: + "200": + application/json: {"data": {"input": {"messages": [{"content": "What is the meaning of life?", "role": "user"}]}, "output": {"completion": "The meaning of life is a philosophical question...", "reasoning": null}}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "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"}} + "524": + application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} + "529": + application/json: {"error": {"code": 529, "message": "Provider returned error"}} + listWorkspaces: + speakeasy-default-list-workspaces: + responses: + "200": + application/json: {"data": [{"created_at": "2025-08-24T10:30:00Z", "created_by": "user_abc123", "default_image_model": "openai/dall-e-3", "default_provider_sort": "price", "default_text_model": "openai/gpt-4o", "description": "Production environment workspace", "id": "550e8400-e29b-41d4-a716-446655440000", "is_data_discount_logging_enabled": true, "is_observability_broadcast_enabled": false, "is_observability_io_logging_enabled": false, "name": "Production", "slug": "production", "updated_at": "2025-08-24T15:45:00Z"}], "total_count": 1} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + createWorkspace: + speakeasy-default-create-workspace: + requestBody: + application/json: {"name": "Production", "slug": "production"} + responses: + "201": + application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "created_by": "user_abc123", "default_image_model": "openai/dall-e-3", "default_provider_sort": "price", "default_text_model": "openai/gpt-4o", "description": "Production environment workspace", "id": "550e8400-e29b-41d4-a716-446655440000", "is_data_discount_logging_enabled": true, "is_observability_broadcast_enabled": false, "is_observability_io_logging_enabled": false, "name": "Production", "slug": "production", "updated_at": null}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteWorkspace: + speakeasy-default-delete-workspace: + parameters: + path: + id: "production" + responses: + "200": + application/json: {"deleted": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getWorkspace: + speakeasy-default-get-workspace: + parameters: + path: + id: "production" + responses: + "200": + application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "created_by": "user_abc123", "default_image_model": "openai/dall-e-3", "default_provider_sort": "price", "default_text_model": "openai/gpt-4o", "description": "Production environment workspace", "id": "550e8400-e29b-41d4-a716-446655440000", "is_data_discount_logging_enabled": true, "is_observability_broadcast_enabled": false, "is_observability_io_logging_enabled": false, "name": "Production", "slug": "production", "updated_at": "2025-08-24T15:45:00Z"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + updateWorkspace: + speakeasy-default-update-workspace: + parameters: + path: + id: "production" + requestBody: + application/json: {} + responses: + "200": + application/json: {"data": {"created_at": "2025-08-24T10:30:00Z", "created_by": "user_abc123", "default_image_model": "openai/dall-e-3", "default_provider_sort": "price", "default_text_model": "openai/gpt-4o", "description": "Production environment workspace", "id": "550e8400-e29b-41d4-a716-446655440000", "is_data_discount_logging_enabled": true, "is_observability_broadcast_enabled": false, "is_observability_io_logging_enabled": false, "name": "Updated Workspace", "slug": "updated-workspace", "updated_at": "2025-08-25T10:00:00Z"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + bulkAddWorkspaceMembers: + speakeasy-default-bulk-add-workspace-members: + parameters: + path: + id: "production" + requestBody: + application/json: {"user_ids": ["user_abc123", "user_def456"]} + responses: + "200": + application/json: {"added_count": 1, "data": [{"created_at": "2025-08-24T10:30:00Z", "id": "660e8400-e29b-41d4-a716-446655440000", "role": "member", "user_id": "user_abc123", "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}]} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + bulkRemoveWorkspaceMembers: + speakeasy-default-bulk-remove-workspace-members: + parameters: + path: + id: "production" + requestBody: + application/json: {"user_ids": ["user_abc123", "user_def456"]} + responses: + "200": + application/json: {"removed_count": 2} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: `response` **Changed** **Breaking** :warning:\n* `open_router.generations.get_generation()`: `response.data.web_search_engine` **Added**\n* `open_router.workspaces.list()`: **Added**\n* `open_router.workspaces.create()`: **Added**\n* `open_router.workspaces.delete()`: **Added**\n* `open_router.workspaces.get()`: **Added**\n* `open_router.workspaces.update()`: **Added**\n* `open_router.workspaces.bulk_add_members()`: **Added**\n* `open_router.workspaces.bulk_remove_members()`: **Added**\n* `open_router.tts.create_speech()`: **Added**\n* `open_router.embeddings.generate()`: `response.usage.prompt_tokens_details` **Added**\n* `open_router.guardrails.get()`: `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.list()`: \n * `request.workspace_id` **Added**\n * `response.data.[].workspace_id` **Added**\n* `open_router.guardrails.update()`: `response.data.workspace_id` **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.generations.list_generation_content()`: **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..003f7bc 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 @@ -2983,6 +2992,48 @@ components: description: Price per million prompt tokens example: 1000 type: string + BulkAddWorkspaceMembersRequest: + example: + user_ids: + - user_abc123 + - user_def456 + properties: + user_ids: + description: List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization. + example: + - user_abc123 + - user_def456 + items: + type: string + maxItems: 100 + minItems: 1 + type: array + required: + - user_ids + type: object + BulkAddWorkspaceMembersResponse: + example: + added_count: 1 + data: + - created_at: '2025-08-24T10:30:00Z' + id: 660e8400-e29b-41d4-a716-446655440000 + role: member + user_id: user_abc123 + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + properties: + added_count: + description: Number of workspace memberships created or updated + example: 2 + type: integer + data: + description: List of added workspace memberships + items: + $ref: '#/components/schemas/WorkspaceMember' + type: array + required: + - data + - added_count + type: object BulkAssignKeysRequest: example: key_hashes: @@ -3041,6 +3092,36 @@ components: required: - assigned_count type: object + BulkRemoveWorkspaceMembersRequest: + example: + user_ids: + - user_abc123 + - user_def456 + properties: + user_ids: + description: List of user IDs to remove from the workspace + example: + - user_abc123 + - user_def456 + items: + type: string + maxItems: 100 + minItems: 1 + type: array + required: + - user_ids + type: object + BulkRemoveWorkspaceMembersResponse: + example: + removed_count: 2 + properties: + removed_count: + description: Number of members removed + example: 2 + type: integer + required: + - removed_count + type: object BulkUnassignKeysRequest: example: key_hashes: @@ -4955,6 +5036,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 +5062,7 @@ components: name: My New Guardrail reset_interval: monthly updated_at: null + workspace_id: 0df9e665-d932-5740-b2c7-b52af166bc11 properties: data: allOf: @@ -4984,6 +5071,89 @@ components: required: - data type: object + CreateWorkspaceRequest: + example: + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + name: Production + slug: production + properties: + default_image_model: + description: Default image model for this workspace + example: openai/dall-e-3 + nullable: true + type: string + default_provider_sort: + description: Default provider sort preference (price, throughput, latency, exacto) + example: price + nullable: true + type: string + default_text_model: + description: Default text model for this workspace + example: openai/gpt-4o + nullable: true + type: string + description: + description: Description of the workspace + example: Production environment workspace + maxLength: 500 + nullable: true + type: string + is_data_discount_logging_enabled: + description: Whether data discount logging is enabled + example: true + type: boolean + is_observability_broadcast_enabled: + description: Whether broadcast is enabled + example: false + type: boolean + is_observability_io_logging_enabled: + description: Whether private logging is enabled + example: false + type: boolean + name: + description: Name for the new workspace + example: Production + maxLength: 100 + minLength: 1 + type: string + slug: + description: URL-friendly slug (lowercase alphanumeric and hyphens only) + example: production + maxLength: 50 + minLength: 1 + pattern: ^[a-z0-9-]+$ + type: string + required: + - name + - slug + type: object + CreateWorkspaceResponse: + example: + data: + created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Production + slug: production + updated_at: null + properties: + data: + allOf: + - $ref: '#/components/schemas/Workspace' + - description: The created workspace + required: + - data + type: object CustomTool: description: Custom tool configuration example: @@ -5104,6 +5274,18 @@ components: required: - deleted type: object + DeleteWorkspaceResponse: + example: + deleted: true + properties: + deleted: + const: true + description: Confirmation that the workspace was deleted + example: true + type: boolean + required: + - deleted + type: object DeprecatedRoute: deprecated: true description: >- @@ -5631,6 +5813,364 @@ components: - name - parameters type: object + GenerationContentData: + description: Stored prompt and completion content + example: + input: + messages: + - content: What is the meaning of life? + role: user + output: + completion: The meaning of life is a philosophical question... + reasoning: null + properties: + input: + anyOf: + - properties: + prompt: + example: What is the meaning of life? + type: string + required: + - prompt + type: object + - properties: + messages: + example: + - content: What is the meaning of life? + role: user + items: + nullable: true + type: array + required: + - messages + type: object + description: The input to the generation — either a prompt string or an array of messages + output: + description: The output from the generation + properties: + completion: + description: The completion output + example: The meaning of life is a philosophical question... + nullable: true + type: string + reasoning: + description: Reasoning/thinking output, if any + example: null + nullable: true + type: string + required: + - reasoning + - completion + type: object + required: + - input + - output + type: object + GenerationContentResponse: + description: Stored prompt and completion content for a generation + example: + data: + input: + messages: + - content: What is the meaning of life? + role: user + output: + completion: The meaning of life is a philosophical question... + reasoning: null + properties: + data: + $ref: '#/components/schemas/GenerationContentData' + required: + - data + type: object + GenerationResponse: + description: Generation response + example: + data: + api_type: completions + app_id: 12345 + cache_discount: null + cancelled: false + created_at: '2024-07-15T23:33:19.433273+00:00' + external_user: user-123 + finish_reason: stop + generation_time: 1200 + http_referer: https://openrouter.ai/ + 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: null + request_id: req-1727282430-aBcDeFgHiJkLmNoPqRsT + router: openrouter/auto + session_id: null + 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: Mozilla/5.0 + properties: + data: + description: Generation data + properties: + api_type: + description: Type of API used for the generation + enum: + - completions + - embeddings + - rerank + - tts + - video + - null + nullable: true + type: string + x-speakeasy-unknown-values: allow + app_id: + description: ID of the app that made the request + example: 12345 + nullable: true + type: integer + cache_discount: + description: Discount applied due to caching + example: 0.0002 + format: double + nullable: true + type: number + cancelled: + description: Whether the generation was cancelled + example: false + nullable: true + type: boolean + created_at: + description: ISO 8601 timestamp of when the generation was created + example: '2024-07-15T23:33:19.433273+00:00' + type: string + external_user: + description: External user identifier + example: user-123 + nullable: true + type: string + finish_reason: + description: Reason the generation finished + example: stop + nullable: true + type: string + generation_time: + description: Time taken for generation in milliseconds + example: 1200 + format: double + nullable: true + type: number + http_referer: + description: Referer header from the request + nullable: true + type: string + id: + description: Unique identifier for the generation + example: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + type: string + is_byok: + description: Whether this used bring-your-own-key + example: false + type: boolean + latency: + description: Total latency in milliseconds + example: 1250 + format: double + nullable: true + type: number + model: + description: Model used for the generation + example: sao10k/l3-stheno-8b + type: string + moderation_latency: + description: Moderation latency in milliseconds + example: 50 + format: double + nullable: true + type: number + native_finish_reason: + description: Native finish reason as reported by provider + example: stop + nullable: true + type: string + native_tokens_cached: + description: Native cached tokens as reported by provider + example: 3 + nullable: true + type: integer + native_tokens_completion: + description: Native completion tokens as reported by provider + example: 25 + nullable: true + type: integer + native_tokens_completion_images: + description: Native completion image tokens as reported by provider + example: 0 + nullable: true + type: integer + native_tokens_prompt: + description: Native prompt tokens as reported by provider + example: 10 + nullable: true + type: integer + native_tokens_reasoning: + description: Native reasoning tokens as reported by provider + example: 5 + nullable: true + type: integer + num_input_audio_prompt: + description: Number of audio inputs in the prompt + example: 0 + nullable: true + type: integer + num_media_completion: + description: Number of media items in the completion + example: 0 + nullable: true + type: integer + num_media_prompt: + description: Number of media items in the prompt + example: 1 + nullable: true + type: integer + num_search_results: + description: Number of search results included + example: 5 + nullable: true + type: integer + origin: + description: Origin URL of the request + example: https://openrouter.ai/ + type: string + provider_name: + description: Name of the provider that served the request + example: Infermatic + nullable: true + type: string + provider_responses: + description: List of provider responses for this generation, including fallback attempts + items: + $ref: '#/components/schemas/ProviderResponse' + nullable: true + type: array + request_id: + description: Unique identifier grouping all generations from a single API request + example: req-1727282430-aBcDeFgHiJkLmNoPqRsT + nullable: true + type: string + router: + description: Router used for the request (e.g., openrouter/auto) + example: openrouter/auto + nullable: true + type: string + session_id: + description: Session identifier grouping multiple generations in the same session + nullable: true + type: string + streamed: + description: Whether the response was streamed + example: true + nullable: true + type: boolean + tokens_completion: + description: Number of tokens in the completion + example: 25 + nullable: true + type: integer + tokens_prompt: + description: Number of tokens in the prompt + example: 10 + nullable: true + type: integer + total_cost: + description: Total cost of the generation in USD + example: 0.0015 + format: double + type: number + upstream_id: + description: Upstream provider's identifier for this generation + example: chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 + nullable: true + type: string + upstream_inference_cost: + description: Cost charged by the upstream provider + example: 0.0012 + format: double + nullable: true + type: number + usage: + description: Usage amount in USD + example: 0.0015 + format: double + type: number + user_agent: + 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 + - total_cost + - cache_discount + - upstream_inference_cost + - created_at + - model + - app_id + - streamed + - cancelled + - provider_name + - latency + - moderation_latency + - generation_time + - finish_reason + - tokens_prompt + - tokens_completion + - native_tokens_prompt + - native_tokens_completion + - native_tokens_completion_images + - native_tokens_reasoning + - native_tokens_cached + - num_media_prompt + - num_input_audio_prompt + - num_media_completion + - num_search_results + - web_search_engine + - origin + - usage + - is_byok + - native_finish_reason + - external_user + - api_type + - router + - provider_responses + - user_agent + - http_referer + type: object + required: + - data + type: object GetGuardrailResponse: example: data: @@ -5649,6 +6189,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: @@ -5657,6 +6198,30 @@ components: required: - data type: object + GetWorkspaceResponse: + example: + data: + created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Production + slug: production + updated_at: '2025-08-24T15:45:00Z' + properties: + data: + allOf: + - $ref: '#/components/schemas/Workspace' + - description: The workspace + required: + - data + type: object GoneResponse: description: Gone - Endpoint has been permanently removed or deprecated example: @@ -5710,6 +6275,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 +6349,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 +6536,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 +7165,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: @@ -6658,10 +7230,41 @@ components: - data - total_count type: object - McpServerTool: - description: MCP (Model Context Protocol) tool configuration + ListWorkspacesResponse: example: - server_label: my-server + data: + - created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Production + slug: production + updated_at: '2025-08-24T15:45:00Z' + total_count: 1 + properties: + data: + description: List of workspaces + items: + $ref: '#/components/schemas/Workspace' + type: array + total_count: + description: Total number of workspaces + example: 5 + type: integer + required: + - data + - total_count + type: object + McpServerTool: + description: MCP (Model Context Protocol) tool configuration + example: + server_label: my-server server_url: https://example.com/mcp type: mcp properties: @@ -7255,11 +7858,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 +7887,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 +8102,8 @@ components: - properties: budget_tokens: type: integer + display: + $ref: '#/components/schemas/AnthropicThinkingDisplay' type: enum: - enabled @@ -7492,6 +8121,8 @@ components: - type type: object - properties: + display: + $ref: '#/components/schemas/AnthropicThinkingDisplay' type: enum: - adaptive @@ -7699,6 +8330,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 +8483,7 @@ components: - AionLabs - Alibaba - Ambient + - Baidu - Amazon Bedrock - Amazon Nova - Anthropic @@ -8861,6 +9510,8 @@ components: service_tier: nullable: true type: string + text: + $ref: '#/components/schemas/TextExtendedConfig' usage: $ref: '#/components/schemas/Usage' type: object @@ -9248,6 +9899,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 +9909,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 +10160,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 +10202,7 @@ components: - $ref: '#/components/schemas/OutputToolSearchServerToolItem' - $ref: '#/components/schemas/OutputMemoryServerToolItem' - $ref: '#/components/schemas/OutputMcpServerToolItem' + - $ref: '#/components/schemas/OutputSearchModelsServerToolItem' OutputItemWebSearchCall: example: action: @@ -9748,6 +10406,7 @@ components: - audio - video - rerank + - tts example: text type: string x-speakeasy-unknown-values: allow @@ -9788,6 +10447,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 +10913,7 @@ components: - AionLabs - Alibaba - Ambient + - Baidu - Amazon Bedrock - Amazon Nova - Anthropic @@ -10533,6 +11219,7 @@ components: - AionLabs - Alibaba - Ambient + - Baidu - Amazon Bedrock - Amazon Nova - Anthropic @@ -11985,7 +12672,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 +12971,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: @@ -12281,6 +12980,82 @@ components: required: - data type: object + UpdateWorkspaceRequest: + example: + name: Updated Workspace + slug: updated-workspace + properties: + default_image_model: + description: Default image model for this workspace + example: openai/dall-e-3 + nullable: true + type: string + default_provider_sort: + description: Default provider sort preference (price, throughput, latency, exacto) + example: price + nullable: true + type: string + default_text_model: + description: Default text model for this workspace + example: openai/gpt-4o + nullable: true + type: string + description: + description: New description for the workspace + example: Updated description + maxLength: 500 + nullable: true + type: string + is_data_discount_logging_enabled: + description: Whether data discount logging is enabled + example: true + type: boolean + is_observability_broadcast_enabled: + description: Whether broadcast is enabled + example: false + type: boolean + is_observability_io_logging_enabled: + description: Whether private logging is enabled + example: false + type: boolean + name: + description: New name for the workspace + example: Updated Workspace + maxLength: 100 + minLength: 1 + type: string + slug: + description: New URL-friendly slug + example: updated-workspace + maxLength: 50 + minLength: 1 + pattern: ^[a-z0-9-]+$ + type: string + type: object + UpdateWorkspaceResponse: + example: + data: + created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Updated Workspace + slug: updated-workspace + updated_at: '2025-08-25T10:00:00Z' + properties: + data: + allOf: + - $ref: '#/components/schemas/Workspace' + - description: The updated workspace + required: + - data + type: object URLCitation: example: end_index: 42 @@ -12469,6 +13244,10 @@ components: additionalProperties: nullable: true type: object + baidu: + additionalProperties: + nullable: true + type: object baseten: additionalProperties: nullable: true @@ -13385,6 +14164,137 @@ components: - approximate type: string type: object + Workspace: + example: + created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Production + slug: production + updated_at: '2025-08-24T15:45:00Z' + properties: + created_at: + description: ISO 8601 timestamp of when the workspace was created + example: '2025-08-24T10:30:00Z' + type: string + created_by: + description: User ID of the workspace creator + example: user_abc123 + nullable: true + type: string + default_image_model: + description: Default image model for this workspace + example: openai/dall-e-3 + nullable: true + type: string + default_provider_sort: + description: Default provider sort preference (price, throughput, latency, exacto) + example: price + nullable: true + type: string + default_text_model: + description: Default text model for this workspace + example: openai/gpt-4o + nullable: true + type: string + description: + description: Description of the workspace + example: Production environment workspace + nullable: true + type: string + id: + description: Unique identifier for the workspace + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + is_data_discount_logging_enabled: + description: Whether data discount logging is enabled for this workspace + example: true + type: boolean + is_observability_broadcast_enabled: + description: Whether broadcast is enabled for this workspace + example: false + type: boolean + is_observability_io_logging_enabled: + description: Whether private logging is enabled for this workspace + example: false + type: boolean + name: + description: Name of the workspace + example: Production + type: string + slug: + description: URL-friendly slug for the workspace + example: production + type: string + updated_at: + description: ISO 8601 timestamp of when the workspace was last updated + example: '2025-08-24T15:45:00Z' + nullable: true + type: string + required: + - id + - name + - slug + - description + - default_text_model + - default_image_model + - default_provider_sort + - is_observability_io_logging_enabled + - is_observability_broadcast_enabled + - is_data_discount_logging_enabled + - created_at + - updated_at + - created_by + type: object + WorkspaceMember: + example: + created_at: '2025-08-24T10:30:00Z' + id: 660e8400-e29b-41d4-a716-446655440000 + role: member + user_id: user_abc123 + workspace_id: 550e8400-e29b-41d4-a716-446655440000 + properties: + created_at: + description: ISO 8601 timestamp of when the membership was created + example: '2025-08-24T10:30:00Z' + type: string + id: + description: Unique identifier for the workspace membership + example: 660e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + role: + description: Role of the member in the workspace + enum: + - admin + - member + example: member + type: string + x-speakeasy-unknown-values: allow + user_id: + description: Clerk user ID of the member + example: user_abc123 + type: string + workspace_id: + description: ID of the workspace + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + required: + - id + - workspace_id + - user_id + - role + - created_at + type: object securitySchemes: apiKey: description: API key as bearer token in Authorization header @@ -13517,91 +14427,552 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /auth/keys: + /audio/speech: post: - description: Exchange an authorization code from the PKCE flow for a user-controlled API key - operationId: exchangeAuthCodeForAPIKey + description: Synthesizes audio from the input text + operationId: createAudioSpeech requestBody: content: application/json: - example: - code: auth_code_abc123def456 - code_challenge_method: S256 - code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk schema: + description: Text-to-speech request input example: - code: auth_code_abc123def456 - code_challenge_method: S256 - code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk + input: Hello world + model: elevenlabs/eleven-turbo-v2 + response_format: pcm + speed: 1 + voice: alloy properties: - code: - description: The authorization code received from the OAuth redirect - example: auth_code_abc123def456 - type: string - code_challenge_method: - description: The method used to generate the code challenge - enum: - - S256 - - plain - - null - example: S256 - nullable: true + input: + description: Text to synthesize + example: Hello world type: string - x-speakeasy-unknown-values: allow - code_verifier: - description: The code verifier if code_challenge was used in the authorization request - example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk + model: + description: TTS model identifier + example: elevenlabs/eleven-turbo-v2 type: string - required: - - code - type: object - required: true - responses: - '200': - content: - application/json: - example: - key: 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 - user_id: user_2yOPcMpKoQhcd4bVgSMlELRaIah - schema: - example: - key: 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 - user_id: user_2yOPcMpKoQhcd4bVgSMlELRaIah - properties: - key: - description: The API key to use for OpenRouter requests - example: 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 - type: string - user_id: - description: User ID associated with the API key - example: user_2yOPcMpKoQhcd4bVgSMlELRaIah - nullable: true - type: string - required: - - key - - user_id - type: object - description: Successfully exchanged code for an API key - '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 - '403': + 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 (provider-specific). + 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: 403 - message: Only management keys can perform this operation + code: 400 + message: Invalid request parameters schema: - $ref: '#/components/schemas/ForbiddenResponse' - description: Forbidden - Authentication successful but insufficient permissions + $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: @@ -13612,52 +14983,195 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - summary: Exchange authorization code for API key + '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: - - OAuth + - TTS + x-speakeasy-name-override: createSpeech parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /auth/keys/code: + /auth/keys: post: - description: Create an authorization code for the PKCE flow to generate a user-controlled API key - operationId: createAuthKeysCode + description: Exchange an authorization code from the PKCE flow for a user-controlled API key + operationId: exchangeAuthCodeForAPIKey requestBody: content: application/json: example: - callback_url: https://myapp.com/auth/callback - code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code: auth_code_abc123def456 code_challenge_method: S256 - limit: 100 + code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk schema: example: - callback_url: https://myapp.com/auth/callback - code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code: auth_code_abc123def456 code_challenge_method: S256 - limit: 100 + code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk properties: - callback_url: - description: >- - The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. - example: https://myapp.com/auth/callback - format: uri - type: string - code_challenge: - description: PKCE code challenge for enhanced security - example: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code: + description: The authorization code received from the OAuth redirect + example: auth_code_abc123def456 type: string code_challenge_method: description: The method used to generate the code challenge enum: - S256 - plain + - null example: S256 + nullable: true type: string x-speakeasy-unknown-values: allow - expires_at: - description: Optional expiration time for the API key to be created + code_verifier: + description: The code verifier if code_challenge was used in the authorization request + example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk + type: string + required: + - code + type: object + required: true + responses: + '200': + content: + application/json: + example: + key: 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 + user_id: user_2yOPcMpKoQhcd4bVgSMlELRaIah + schema: + example: + key: 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 + user_id: user_2yOPcMpKoQhcd4bVgSMlELRaIah + properties: + key: + description: The API key to use for OpenRouter requests + example: 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 + type: string + user_id: + description: User ID associated with the API key + example: user_2yOPcMpKoQhcd4bVgSMlELRaIah + nullable: true + type: string + required: + - key + - user_id + type: object + description: Successfully exchanged code for an API key + '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 + '403': + content: + application/json: + example: + error: + code: 403 + message: Only management keys can perform this operation + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: Forbidden - Authentication successful but insufficient permissions + '500': + content: + application/json: + example: + error: + code: 500 + message: Internal Server Error + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: Exchange authorization code for API key + tags: + - OAuth + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /auth/keys/code: + post: + description: Create an authorization code for the PKCE flow to generate a user-controlled API key + operationId: createAuthKeysCode + requestBody: + content: + application/json: + example: + callback_url: https://myapp.com/auth/callback + code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code_challenge_method: S256 + limit: 100 + schema: + example: + callback_url: https://myapp.com/auth/callback + code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + code_challenge_method: S256 + limit: 100 + properties: + callback_url: + description: >- + The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + example: https://myapp.com/auth/callback + format: uri + type: string + code_challenge: + description: PKCE code challenge for enhanced security + example: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM + type: string + code_challenge_method: + description: The method used to generate the code challenge + enum: + - S256 + - plain + example: S256 + type: string + x-speakeasy-unknown-values: allow + expires_at: + description: Optional expiration time for the API key to be created example: '2027-12-31T23:59:59Z' format: date-time nullable: true @@ -14295,6 +15809,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 @@ -14618,15 +16151,15 @@ paths: application/json: example: data: - api_type: null + api_type: completions app_id: 12345 - cache_discount: 0.0002 + cache_discount: null cancelled: false created_at: '2024-07-15T23:33:19.433273+00:00' external_user: user-123 finish_reason: stop generation_time: 1200 - http_referer: null + http_referer: https://openrouter.ai/ id: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG is_byok: false latency: 1250 @@ -14646,7 +16179,8 @@ paths: provider_name: Infermatic provider_responses: null request_id: req-1727282430-aBcDeFgHiJkLmNoPqRsT - router: null + router: openrouter/auto + session_id: null streamed: true tokens_completion: 25 tokens_prompt: 10 @@ -14654,248 +16188,9 @@ paths: upstream_id: chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 upstream_inference_cost: 0.0012 usage: 0.0015 - user_agent: null + user_agent: Mozilla/5.0 schema: - description: Generation response - properties: - data: - description: Generation data - properties: - api_type: - description: Type of API used for the generation - enum: - - completions - - embeddings - - rerank - - video - - null - nullable: true - type: string - x-speakeasy-unknown-values: allow - app_id: - description: ID of the app that made the request - example: 12345 - nullable: true - type: integer - cache_discount: - description: Discount applied due to caching - example: 0.0002 - format: double - nullable: true - type: number - cancelled: - description: Whether the generation was cancelled - example: false - nullable: true - type: boolean - created_at: - description: ISO 8601 timestamp of when the generation was created - example: '2024-07-15T23:33:19.433273+00:00' - type: string - external_user: - description: External user identifier - example: user-123 - nullable: true - type: string - finish_reason: - description: Reason the generation finished - example: stop - nullable: true - type: string - generation_time: - description: Time taken for generation in milliseconds - example: 1200 - format: double - nullable: true - type: number - http_referer: - description: Referer header from the request - nullable: true - type: string - id: - description: Unique identifier for the generation - example: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG - type: string - is_byok: - description: Whether this used bring-your-own-key - example: false - type: boolean - latency: - description: Total latency in milliseconds - example: 1250 - format: double - nullable: true - type: number - model: - description: Model used for the generation - example: sao10k/l3-stheno-8b - type: string - moderation_latency: - description: Moderation latency in milliseconds - example: 50 - format: double - nullable: true - type: number - native_finish_reason: - description: Native finish reason as reported by provider - example: stop - nullable: true - type: string - native_tokens_cached: - description: Native cached tokens as reported by provider - example: 3 - nullable: true - type: integer - native_tokens_completion: - description: Native completion tokens as reported by provider - example: 25 - nullable: true - type: integer - native_tokens_completion_images: - description: Native completion image tokens as reported by provider - example: 0 - nullable: true - type: integer - native_tokens_prompt: - description: Native prompt tokens as reported by provider - example: 10 - nullable: true - type: integer - native_tokens_reasoning: - description: Native reasoning tokens as reported by provider - example: 5 - nullable: true - type: integer - num_input_audio_prompt: - description: Number of audio inputs in the prompt - example: 0 - nullable: true - type: integer - num_media_completion: - description: Number of media items in the completion - example: 0 - nullable: true - type: integer - num_media_prompt: - description: Number of media items in the prompt - example: 1 - nullable: true - type: integer - num_search_results: - description: Number of search results included - example: 5 - nullable: true - type: integer - origin: - description: Origin URL of the request - example: https://openrouter.ai/ - type: string - provider_name: - description: Name of the provider that served the request - example: Infermatic - nullable: true - type: string - provider_responses: - description: List of provider responses for this generation, including fallback attempts - items: - $ref: '#/components/schemas/ProviderResponse' - nullable: true - type: array - request_id: - description: Unique identifier grouping all generations from a single API request - example: req-1727282430-aBcDeFgHiJkLmNoPqRsT - nullable: true - type: string - router: - description: Router used for the request (e.g., openrouter/auto) - example: openrouter/auto - nullable: true - type: string - session_id: - description: Session identifier grouping multiple generations in the same session - nullable: true - type: string - streamed: - description: Whether the response was streamed - example: true - nullable: true - type: boolean - tokens_completion: - description: Number of tokens in the completion - example: 25 - nullable: true - type: integer - tokens_prompt: - description: Number of tokens in the prompt - example: 10 - nullable: true - type: integer - total_cost: - description: Total cost of the generation in USD - example: 0.0015 - format: double - type: number - upstream_id: - description: Upstream provider's identifier for this generation - example: chatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946 - nullable: true - type: string - upstream_inference_cost: - description: Cost charged by the upstream provider - example: 0.0012 - format: double - nullable: true - type: number - usage: - description: Usage amount in USD - example: 0.0015 - format: double - type: number - user_agent: - description: User-Agent header from the request - nullable: true - type: string - required: - - id - - upstream_id - - total_cost - - cache_discount - - upstream_inference_cost - - created_at - - model - - app_id - - streamed - - cancelled - - provider_name - - latency - - moderation_latency - - generation_time - - finish_reason - - tokens_prompt - - tokens_completion - - native_tokens_prompt - - native_tokens_completion - - native_tokens_completion_images - - native_tokens_reasoning - - native_tokens_cached - - num_media_prompt - - num_input_audio_prompt - - num_media_completion - - num_search_results - - origin - - usage - - is_byok - - native_finish_reason - - external_user - - api_type - - router - - provider_responses - - user_agent - - http_referer - type: object - required: - - data - type: object + $ref: '#/components/schemas/GenerationResponse' description: Returns the request metadata for this generation '401': content: @@ -14984,53 +16279,179 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /guardrails: + /generation/content: get: - description: >- - List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. - operationId: listGuardrails + operationId: listGenerationContent parameters: - - description: Number of records to skip for pagination - in: query - name: offset - required: false - schema: - description: Number of records to skip for pagination - example: 0 - minimum: 0 - nullable: false - type: integer - - description: Maximum number of records to return (max 100) + - description: The generation ID in: query - name: limit - required: false + name: id + required: true schema: - description: Maximum number of records to return (max 100) - example: 50 - maximum: 100 - minimum: 1 - type: integer + description: The generation ID + example: gen-1234567890 + minLength: 1 + type: string responses: '200': content: application/json: example: 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 + input: + messages: + - content: What is the meaning of life? + role: user + output: + completion: The meaning of life is a philosophical question... + reasoning: null + schema: + $ref: '#/components/schemas/GenerationContentResponse' + description: Returns the stored prompt and completion content + '401': + content: + application/json: + example: + error: + code: 401 + message: Missing Authentication header + 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 + '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 + '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: Get stored prompt and completion content for a generation + tags: + - Generations + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails: + get: + description: >- + List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: listGuardrails + parameters: + - description: Number of records to skip for pagination + in: query + name: offset + required: false + schema: + description: Number of records to skip for pagination + example: 0 + minimum: 0 + nullable: false + type: integer + - description: Maximum number of records to return (max 100) + in: query + name: limit + required: false + schema: + description: Maximum number of records to return (max 100) + example: 50 + 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: + application/json: + example: + 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 schema: $ref: '#/components/schemas/ListGuardrailsResponse' @@ -15114,6 +16535,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 +16559,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 +16678,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 +16759,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 +17767,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 +17802,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 +17826,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 +17852,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 +17952,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 +17976,7 @@ paths: - created_at - updated_at - creator_user_id + - workspace_id type: object type: array required: @@ -16628,6 +18079,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 +18114,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 +18139,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 +18165,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 +18265,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 +18289,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 +18320,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 +18472,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 +18496,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 +18521,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 +18621,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 +18645,7 @@ paths: - created_at - updated_at - creator_user_id + - workspace_id type: object required: - data @@ -17300,6 +18782,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 +18806,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 +18831,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 +18931,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 +18955,7 @@ paths: - created_at - updated_at - creator_user_id + - workspace_id type: object required: - data @@ -18799,163 +20289,651 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - summary: List all providers + summary: List all providers + tags: + - Providers + x-speakeasy-name-override: list + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /rerank: + post: + description: Submits a rerank request to the rerank router + operationId: createRerank + requestBody: + content: + application/json: + schema: + description: Rerank request input + example: + documents: + - Paris is the capital of France. + - Berlin is the capital of Germany. + model: cohere/rerank-v3.5 + query: What is the capital of France? + top_n: 3 + properties: + documents: + description: The list of documents to rerank + example: + - Paris is the capital of France. + - Berlin is the capital of Germany. + items: + type: string + type: array + model: + description: The rerank model to use + example: cohere/rerank-v3.5 + type: string + provider: + allOf: + - $ref: '#/components/schemas/ProviderPreferences' + - description: Provider routing preferences for the request. + query: + description: The search query to rerank documents against + example: What is the capital of France? + type: string + top_n: + description: Number of most relevant documents to return + example: 3 + minimum: 1 + type: integer + required: + - model + - query + - documents + type: object + required: true + responses: + '200': + content: + application/json: + schema: + description: Rerank response containing ranked results + example: + id: gen-rerank-1234567890-abc + model: cohere/rerank-v3.5 + results: + - document: + text: Paris is the capital of France. + index: 0 + relevance_score: 0.98 + usage: + search_units: 1 + total_tokens: 150 + properties: + id: + description: Unique identifier for the rerank response (ORID format) + example: gen-rerank-1234567890-abc + type: string + model: + description: The model used for reranking + example: cohere/rerank-v3.5 + type: string + provider: + description: The provider that served the rerank request + example: Cohere + type: string + results: + description: List of rerank results sorted by relevance + example: + - document: + text: Paris is the capital of France. + index: 0 + relevance_score: 0.98 + items: + description: A single rerank result + example: + document: + text: Paris is the capital of France. + index: 0 + relevance_score: 0.98 + properties: + document: + description: The document object containing the original text + properties: + text: + description: The document text + example: Paris is the capital of France. + type: string + required: + - text + type: object + index: + description: Index of the document in the original input list + example: 0 + type: integer + relevance_score: + description: Relevance score of the document to the query + example: 0.98 + format: double + type: number + required: + - index + - relevance_score + - document + type: object + type: array + usage: + description: Usage statistics + example: + search_units: 1 + total_tokens: 150 + properties: + cost: + description: Cost of the request in credits + example: 0.001 + format: double + type: number + search_units: + description: Number of search units consumed (Cohere billing) + example: 1 + type: integer + total_tokens: + description: Total number of tokens used + example: 150 + type: integer + type: object + required: + - model + - results + type: object + text/event-stream: + example: 'data: [DONE]' + schema: + description: Not used for rerank - rerank does not support streaming + type: string + x-speakeasy-sse-sentinel: '[DONE]' + description: Rerank response + '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: Submit a rerank request + tags: + - Rerank + x-speakeasy-name-override: rerank + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /responses: + post: + description: Creates a streaming or non-streaming response using OpenResponses API format + operationId: createResponses + requestBody: + content: + application/json: + example: + input: Tell me a joke + model: openai/gpt-4o + schema: + $ref: '#/components/schemas/ResponsesRequest' + required: true + responses: + '200': + content: + application/json: + example: + created_at: 1700000000 + id: resp_abc123 + model: openai/gpt-4o + object: response + output: + - content: + - text: Why did the chicken cross the road? To get to the other side! + type: output_text + role: assistant + type: message + status: completed + usage: + completion_tokens: 20 + prompt_tokens: 10 + total_tokens: 30 + schema: + $ref: '#/components/schemas/OpenResponsesResult' + text/event-stream: + example: + data: + delta: Hello + type: response.output_text.delta + schema: + properties: + data: + $ref: '#/components/schemas/StreamEvents' + required: + - data + type: object + x-speakeasy-sse-sentinel: '[DONE]' + description: Successful response + '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 + '408': + content: + application/json: + example: + error: + code: 408 + message: Operation timed out. Please try again later. + schema: + $ref: '#/components/schemas/RequestTimeoutResponse' + description: Request Timeout - Operation exceeded time limit + '413': + content: + application/json: + example: + error: + code: 413 + message: Request payload too large + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + description: Payload Too Large - Request payload exceeds size limits + '422': + content: + application/json: + example: + error: + code: 422 + message: Invalid argument + schema: + $ref: '#/components/schemas/UnprocessableEntityResponse' + description: Unprocessable Entity - Semantic validation failure + '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 a response + tags: + - beta.responses + x-speakeasy-name-override: send + x-speakeasy-stream-request-field: stream + 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 + operationId: createVideos + requestBody: + content: + application/json: + example: + aspect_ratio: '16:9' + duration: 8 + model: google/veo-3.1 + prompt: A serene mountain landscape at sunset + resolution: 720p + schema: + $ref: '#/components/schemas/VideoGenerationRequest' + required: true + responses: + '202': + content: + application/json: + example: + generation_id: gen-xyz789 + id: job-abc123 + polling_url: /api/v1/videos/job-abc123 + status: pending + schema: + $ref: '#/components/schemas/VideoGenerationResponse' + description: Video generation request accepted + '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 + summary: Submit a video generation request + tags: + - Video Generation + x-speakeasy-name-override: generate + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /videos/{jobId}: + get: + description: Returns job status and content URLs when completed + operationId: getVideos + parameters: + - in: path + name: jobId + required: true + schema: + example: job-abc123 + minLength: 1 + type: string + responses: + '200': + content: + application/json: + example: + generation_id: gen-xyz789 + id: job-abc123 + polling_url: /api/v1/videos/job-abc123 + status: complete + unsigned_urls: + - https://storage.example.com/video.mp4 + usage: + cost: 0.5 + schema: + $ref: '#/components/schemas/VideoGenerationResponse' + description: Video generation status + '401': + content: + application/json: + example: + error: + code: 401 + message: Missing Authentication header + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '404': + content: + application/json: + example: + error: + code: 404 + message: Resource not found + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist + '500': + content: + application/json: + example: + error: + code: 500 + message: Internal Server Error + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: Poll video generation status tags: - - Providers - x-speakeasy-name-override: list + - Video Generation + x-speakeasy-name-override: getGeneration parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /rerank: - post: - description: Submits a rerank request to the rerank router - operationId: createRerank - requestBody: - content: - application/json: - schema: - description: Rerank request input - example: - documents: - - Paris is the capital of France. - - Berlin is the capital of Germany. - model: cohere/rerank-v3.5 - query: What is the capital of France? - top_n: 3 - properties: - documents: - description: The list of documents to rerank - example: - - Paris is the capital of France. - - Berlin is the capital of Germany. - items: - type: string - type: array - model: - description: The rerank model to use - example: cohere/rerank-v3.5 - type: string - provider: - allOf: - - $ref: '#/components/schemas/ProviderPreferences' - - description: Provider routing preferences for the request. - query: - description: The search query to rerank documents against - example: What is the capital of France? - type: string - top_n: - description: Number of most relevant documents to return - example: 3 - minimum: 1 - type: integer - required: - - model - - query - - documents - type: object - required: true + /videos/{jobId}/content: + get: + description: Streams the generated video content from the upstream provider + operationId: listVideosContent + parameters: + - in: path + name: jobId + required: true + schema: + example: job-abc123 + minLength: 1 + type: string + - in: query + name: index + required: false + schema: + default: 0 + example: 0 + minimum: 0 + nullable: true + type: integer responses: '200': content: - application/json: - schema: - description: Rerank response containing ranked results - example: - id: gen-rerank-1234567890-abc - model: cohere/rerank-v3.5 - results: - - document: - text: Paris is the capital of France. - index: 0 - relevance_score: 0.98 - usage: - search_units: 1 - total_tokens: 150 - properties: - id: - description: Unique identifier for the rerank response (ORID format) - example: gen-rerank-1234567890-abc - type: string - model: - description: The model used for reranking - example: cohere/rerank-v3.5 - type: string - provider: - description: The provider that served the rerank request - example: Cohere - type: string - results: - description: List of rerank results sorted by relevance - example: - - document: - text: Paris is the capital of France. - index: 0 - relevance_score: 0.98 - items: - description: A single rerank result - example: - document: - text: Paris is the capital of France. - index: 0 - relevance_score: 0.98 - properties: - document: - description: The document object containing the original text - properties: - text: - description: The document text - example: Paris is the capital of France. - type: string - required: - - text - type: object - index: - description: Index of the document in the original input list - example: 0 - type: integer - relevance_score: - description: Relevance score of the document to the query - example: 0.98 - format: double - type: number - required: - - index - - relevance_score - - document - type: object - type: array - usage: - description: Usage statistics - example: - search_units: 1 - total_tokens: 150 - properties: - cost: - description: Cost of the request in credits - example: 0.001 - format: double - type: number - search_units: - description: Number of search units consumed (Cohere billing) - example: 1 - type: integer - total_tokens: - description: Total number of tokens used - example: 150 - type: integer - type: object - required: - - model - - results - type: object - text/event-stream: - example: 'data: [DONE]' + application/octet-stream: + example: schema: - description: Not used for rerank - rerank does not support streaming + format: binary type: string - x-speakeasy-sse-sentinel: '[DONE]' - description: Rerank response + description: Video content stream '400': content: application/json: @@ -18976,16 +20954,6 @@ paths: 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: @@ -18996,16 +20964,78 @@ paths: schema: $ref: '#/components/schemas/NotFoundResponse' description: Not Found - Resource does not exist - '429': + '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 + summary: Download generated video content + tags: + - Video Generation + x-speakeasy-name-override: getVideoContent + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /videos/models: + get: + description: Returns a list of all available video generation models and their properties + operationId: listVideosModels + responses: + '200': + content: + application/json: + example: + data: + - allowed_passthrough_parameters: [] + canonical_slug: google/veo-3.1 + created: 1700000000 + description: Google video generation model + generate_audio: true + id: google/veo-3.1 + name: Veo 3.1 + pricing_skus: + generate: '0.50' + seed: null + supported_aspect_ratios: + - '16:9' + supported_durations: + - 5 + - 8 + supported_frame_images: + - first_frame + - last_frame + supported_resolutions: + - 720p + supported_sizes: null + schema: + $ref: '#/components/schemas/VideoModelsListResponse' + description: Returns a list of video generation models + '400': content: application/json: example: error: - code: 429 - message: Rate limit exceeded + code: 400 + message: Invalid request parameters schema: - $ref: '#/components/schemas/TooManyRequestsResponse' - description: Too Many Requests - Rate limit exceeded + $ref: '#/components/schemas/BadRequestResponse' + description: Bad Request - Invalid request parameters or malformed input '500': content: application/json: @@ -19016,103 +21046,136 @@ paths: 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': + summary: List all video generation models + tags: + - Video Generation + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /workspaces: + get: + description: >- + List all workspaces for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: listWorkspaces + parameters: + - description: Number of records to skip for pagination + in: query + name: offset + required: false + schema: + description: Number of records to skip for pagination + example: 0 + minimum: 0 + nullable: false + type: integer + - description: Maximum number of records to return (max 100) + in: query + name: limit + required: false + schema: + description: Maximum number of records to return (max 100) + example: 50 + maximum: 100 + minimum: 1 + type: integer + responses: + '200': content: application/json: example: - error: - code: 503 - message: Service temporarily unavailable + data: + - created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Production + slug: production + updated_at: '2025-08-24T15:45:00Z' + total_count: 1 schema: - $ref: '#/components/schemas/ServiceUnavailableResponse' - description: Service Unavailable - Service temporarily unavailable - '524': + $ref: '#/components/schemas/ListWorkspacesResponse' + description: List of workspaces + '401': content: application/json: example: error: - code: 524 - message: Request timed out. Please try again later. + code: 401 + message: Missing Authentication header schema: - $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' - description: Infrastructure Timeout - Provider request timed out at edge network - '529': + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '500': content: application/json: example: error: - code: 529 - message: Provider returned error + code: 500 + message: Internal Server Error schema: - $ref: '#/components/schemas/ProviderOverloadedResponse' - description: Provider Overloaded - Provider is temporarily overloaded - summary: Submit a rerank request + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: List workspaces tags: - - Rerank - x-speakeasy-name-override: rerank - parameters: - - $ref: "#/components/parameters/AppIdentifier" - - $ref: "#/components/parameters/AppDisplayName" - - $ref: "#/components/parameters/AppCategories" - /responses: + - Workspaces + x-speakeasy-name-override: list + x-speakeasy-pagination: + inputs: + - in: parameters + name: offset + type: offset + - in: parameters + name: limit + type: limit + outputs: + results: $.data + type: offsetLimit post: - description: Creates a streaming or non-streaming response using OpenResponses API format - operationId: createResponses + description: >- + Create a new workspace for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: createWorkspace requestBody: content: application/json: example: - input: Tell me a joke - model: openai/gpt-4o + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + name: Production + slug: production schema: - $ref: '#/components/schemas/ResponsesRequest' + $ref: '#/components/schemas/CreateWorkspaceRequest' required: true responses: - '200': + '201': content: application/json: - example: - created_at: 1700000000 - id: resp_abc123 - model: openai/gpt-4o - object: response - output: - - content: - - text: Why did the chicken cross the road? To get to the other side! - type: output_text - role: assistant - type: message - status: completed - usage: - completion_tokens: 20 - prompt_tokens: 10 - total_tokens: 30 - schema: - $ref: '#/components/schemas/OpenResponsesResult' - text/event-stream: example: data: - delta: Hello - type: response.output_text.delta + created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Production + slug: production + updated_at: null schema: - properties: - data: - $ref: '#/components/schemas/StreamEvents' - required: - - data - type: object - x-speakeasy-sse-sentinel: '[DONE]' - description: Successful response + $ref: '#/components/schemas/CreateWorkspaceResponse' + description: Workspace created successfully '400': content: application/json: @@ -19133,66 +21196,98 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' description: Unauthorized - Authentication required or invalid credentials - '402': + '403': content: application/json: example: error: - code: 402 - message: Insufficient credits. Add more using https://openrouter.ai/credits + code: 403 + message: Only management keys can perform this operation schema: - $ref: '#/components/schemas/PaymentRequiredResponse' - description: Payment Required - Insufficient credits or quota to complete request - '404': + $ref: '#/components/schemas/ForbiddenResponse' + description: Forbidden - Authentication successful but insufficient permissions + '500': content: application/json: example: error: - code: 404 - message: Resource not found + code: 500 + message: Internal Server Error schema: - $ref: '#/components/schemas/NotFoundResponse' - description: Not Found - Resource does not exist - '408': + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: Create a workspace + tags: + - Workspaces + x-speakeasy-name-override: create + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /workspaces/{id}: + delete: + description: >- + Delete an existing workspace. The default workspace cannot be deleted. Workspaces with active API keys cannot be deleted. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: deleteWorkspace + parameters: + - description: The workspace ID (UUID) or slug + in: path + name: id + required: true + schema: + description: The workspace ID (UUID) or slug + example: production + minLength: 1 + type: string + responses: + '200': + content: + application/json: + example: + deleted: true + schema: + $ref: '#/components/schemas/DeleteWorkspaceResponse' + description: Workspace deleted successfully + '400': content: application/json: example: error: - code: 408 - message: Operation timed out. Please try again later. + code: 400 + message: Invalid request parameters schema: - $ref: '#/components/schemas/RequestTimeoutResponse' - description: Request Timeout - Operation exceeded time limit - '413': + $ref: '#/components/schemas/BadRequestResponse' + description: Bad Request - Invalid request parameters or malformed input + '401': content: application/json: example: error: - code: 413 - message: Request payload too large + code: 401 + message: Missing Authentication header schema: - $ref: '#/components/schemas/PayloadTooLargeResponse' - description: Payload Too Large - Request payload exceeds size limits - '422': + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '403': content: application/json: example: error: - code: 422 - message: Invalid argument + code: 403 + message: Only management keys can perform this operation schema: - $ref: '#/components/schemas/UnprocessableEntityResponse' - description: Unprocessable Entity - Semantic validation failure - '429': + $ref: '#/components/schemas/ForbiddenResponse' + description: Forbidden - Authentication successful but insufficient permissions + '404': content: application/json: example: error: - code: 429 - message: Rate limit exceeded + code: 404 + message: Resource not found schema: - $ref: '#/components/schemas/TooManyRequestsResponse' - description: Too Many Requests - Rate limit exceeded + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist '500': content: application/json: @@ -19203,83 +21298,124 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - '502': + summary: Delete a workspace + tags: + - Workspaces + x-speakeasy-name-override: delete + get: + description: Get a single workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: getWorkspace + parameters: + - description: The workspace ID (UUID) or slug + in: path + name: id + required: true + schema: + description: The workspace ID (UUID) or slug + example: production + minLength: 1 + type: string + responses: + '200': content: application/json: example: - error: - code: 502 - message: Provider returned error + data: + created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Production + slug: production + updated_at: '2025-08-24T15:45:00Z' schema: - $ref: '#/components/schemas/BadGatewayResponse' - description: Bad Gateway - Provider/upstream API failure - '503': + $ref: '#/components/schemas/GetWorkspaceResponse' + description: Workspace details + '401': content: application/json: example: error: - code: 503 - message: Service temporarily unavailable + code: 401 + message: Missing Authentication header schema: - $ref: '#/components/schemas/ServiceUnavailableResponse' - description: Service Unavailable - Service temporarily unavailable - '524': + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '404': content: application/json: example: error: - code: 524 - message: Request timed out. Please try again later. + code: 404 + message: Resource not found schema: - $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' - description: Infrastructure Timeout - Provider request timed out at edge network - '529': + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist + '500': content: application/json: example: error: - code: 529 - message: Provider returned error + code: 500 + message: Internal Server Error schema: - $ref: '#/components/schemas/ProviderOverloadedResponse' - description: Provider Overloaded - Provider is temporarily overloaded - summary: Create a response + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: Get a workspace tags: - - beta.responses - x-speakeasy-name-override: send - x-speakeasy-stream-request-field: stream - 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 - operationId: createVideos + - Workspaces + x-speakeasy-name-override: get + patch: + description: >- + Update an existing workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: updateWorkspace + parameters: + - description: The workspace ID (UUID) or slug + in: path + name: id + required: true + schema: + description: The workspace ID (UUID) or slug + example: production + minLength: 1 + type: string requestBody: content: application/json: example: - aspect_ratio: '16:9' - duration: 8 - model: google/veo-3.1 - prompt: A serene mountain landscape at sunset - resolution: 720p + name: Updated Workspace + slug: updated-workspace schema: - $ref: '#/components/schemas/VideoGenerationRequest' + $ref: '#/components/schemas/UpdateWorkspaceRequest' required: true responses: - '202': + '200': content: application/json: example: - generation_id: gen-xyz789 - id: job-abc123 - polling_url: /api/v1/videos/job-abc123 - status: pending + data: + created_at: '2025-08-24T10:30:00Z' + created_by: user_abc123 + default_image_model: openai/dall-e-3 + default_provider_sort: price + default_text_model: openai/gpt-4o + description: Production environment workspace + id: 550e8400-e29b-41d4-a716-446655440000 + is_data_discount_logging_enabled: true + is_observability_broadcast_enabled: false + is_observability_io_logging_enabled: false + name: Updated Workspace + slug: updated-workspace + updated_at: '2025-08-25T10:00:00Z' schema: - $ref: '#/components/schemas/VideoGenerationResponse' - description: Video generation request accepted + $ref: '#/components/schemas/UpdateWorkspaceResponse' + description: Workspace updated successfully '400': content: application/json: @@ -19300,16 +21436,16 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' description: Unauthorized - Authentication required or invalid credentials - '402': + '403': content: application/json: example: error: - code: 402 - message: Insufficient credits. Add more using https://openrouter.ai/credits + code: 403 + message: Only management keys can perform this operation schema: - $ref: '#/components/schemas/PaymentRequiredResponse' - description: Payment Required - Insufficient credits or quota to complete request + $ref: '#/components/schemas/ForbiddenResponse' + description: Forbidden - Authentication successful but insufficient permissions '404': content: application/json: @@ -19320,16 +21456,6 @@ paths: 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: @@ -19340,42 +21466,64 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - summary: Submit a video generation request + summary: Update a workspace tags: - - Video Generation - x-speakeasy-name-override: generate + - Workspaces + x-speakeasy-name-override: update parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /videos/{jobId}: - get: - description: Returns job status and content URLs when completed - operationId: getVideos + /workspaces/{id}/members/add: + post: + description: >- + Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: bulkAddWorkspaceMembers parameters: - - in: path - name: jobId + - description: The workspace ID (UUID) or slug + in: path + name: id required: true schema: - example: job-abc123 + description: The workspace ID (UUID) or slug + example: production minLength: 1 type: string + requestBody: + content: + application/json: + example: + user_ids: + - user_abc123 + - user_def456 + schema: + $ref: '#/components/schemas/BulkAddWorkspaceMembersRequest' + required: true responses: '200': content: application/json: example: - generation_id: gen-xyz789 - id: job-abc123 - polling_url: /api/v1/videos/job-abc123 - status: complete - unsigned_urls: - - https://storage.example.com/video.mp4 - usage: - cost: 0.5 + added_count: 1 + data: + - created_at: '2025-08-24T10:30:00Z' + id: 660e8400-e29b-41d4-a716-446655440000 + role: member + user_id: user_abc123 + workspace_id: 550e8400-e29b-41d4-a716-446655440000 schema: - $ref: '#/components/schemas/VideoGenerationResponse' - description: Video generation status + $ref: '#/components/schemas/BulkAddWorkspaceMembersResponse' + description: Members added successfully + '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: @@ -19386,6 +21534,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 '404': content: application/json: @@ -19406,44 +21564,48 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - summary: Poll video generation status + summary: Bulk add members to a workspace tags: - - Video Generation - x-speakeasy-name-override: getGeneration + - Workspaces + x-speakeasy-name-override: bulkAddMembers parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /videos/{jobId}/content: - get: - description: Streams the generated video content from the upstream provider - operationId: listVideosContent + /workspaces/{id}/members/remove: + post: + description: >- + Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: bulkRemoveWorkspaceMembers parameters: - - in: path - name: jobId + - description: The workspace ID (UUID) or slug + in: path + name: id required: true schema: - example: job-abc123 + description: The workspace ID (UUID) or slug + example: production minLength: 1 type: string - - in: query - name: index - required: false - schema: - default: 0 - example: 0 - minimum: 0 - nullable: true - type: integer + requestBody: + content: + application/json: + example: + user_ids: + - user_abc123 + - user_def456 + schema: + $ref: '#/components/schemas/BulkRemoveWorkspaceMembersRequest' + required: true responses: '200': content: - application/octet-stream: - example: + application/json: + example: + removed_count: 2 schema: - format: binary - type: string - description: Video content stream + $ref: '#/components/schemas/BulkRemoveWorkspaceMembersResponse' + description: Members removed successfully '400': content: application/json: @@ -19464,88 +21626,26 @@ paths: schema: $ref: '#/components/schemas/UnauthorizedResponse' description: Unauthorized - Authentication required or invalid credentials - '404': - content: - application/json: - example: - error: - code: 404 - message: Resource not found - schema: - $ref: '#/components/schemas/NotFoundResponse' - description: Not Found - Resource does not exist - '500': - content: - application/json: - example: - error: - code: 500 - message: Internal Server Error - schema: - $ref: '#/components/schemas/InternalServerResponse' - description: Internal Server Error - Unexpected server error - '502': + '403': content: application/json: example: error: - code: 502 - message: Provider returned error - schema: - $ref: '#/components/schemas/BadGatewayResponse' - description: Bad Gateway - Provider/upstream API failure - summary: Download generated video content - tags: - - Video Generation - x-speakeasy-name-override: getVideoContent - parameters: - - $ref: "#/components/parameters/AppIdentifier" - - $ref: "#/components/parameters/AppDisplayName" - - $ref: "#/components/parameters/AppCategories" - /videos/models: - get: - description: Returns a list of all available video generation models and their properties - operationId: listVideosModels - responses: - '200': - content: - application/json: - example: - data: - - allowed_passthrough_parameters: [] - canonical_slug: google/veo-3.1 - created: 1700000000 - description: Google video generation model - generate_audio: true - id: google/veo-3.1 - name: Veo 3.1 - pricing_skus: - generate: '0.50' - seed: null - supported_aspect_ratios: - - '16:9' - supported_durations: - - 5 - - 8 - supported_frame_images: - - first_frame - - last_frame - supported_resolutions: - - 720p - supported_sizes: null + code: 403 + message: Only management keys can perform this operation schema: - $ref: '#/components/schemas/VideoModelsListResponse' - description: Returns a list of video generation models - '400': + $ref: '#/components/schemas/ForbiddenResponse' + description: Forbidden - Authentication successful but insufficient permissions + '404': content: application/json: example: error: - code: 400 - message: Invalid request parameters + code: 404 + message: Resource not found schema: - $ref: '#/components/schemas/BadRequestResponse' - description: Bad Request - Invalid request parameters or malformed input + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist '500': content: application/json: @@ -19556,9 +21656,10 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - summary: List all video generation models + summary: Bulk remove members from a workspace tags: - - Video Generation + - Workspaces + x-speakeasy-name-override: bulkRemoveMembers parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" @@ -19598,8 +21699,12 @@ tags: name: Providers - description: Rerank endpoints name: Rerank + - description: Text-to-speech endpoints + name: TTS - description: Video Generation endpoints name: Video Generation + - description: Workspaces endpoints + name: Workspaces - description: beta.responses endpoints name: beta.responses x-fern-base-path: / diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d4e0269..f5976c7 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:f09d22021635268b6721c41e7f5817bbca9b855b1085496ef01b6e5aca113ab4 + sourceBlobDigest: sha256:9ab07c3aca4d73f89065abae9fb7c79cc092227f4a3c607e9cdaf6a4e0250364 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:f09d22021635268b6721c41e7f5817bbca9b855b1085496ef01b6e5aca113ab4 + sourceBlobDigest: sha256:9ab07c3aca4d73f89065abae9fb7c79cc092227f4a3c607e9cdaf6a4e0250364 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:db86aed74d199f265e2e20442ef652dac0911c8a657ccb3e6614d56a26b8b44e + codeSamplesRevisionDigest: sha256:5861848419ae8bac43d8a1e56e563a2f5e533bf3f29da9b77500617ab09689d4 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..a6989e4 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-21 00:39:07 +### 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/data.md b/docs/components/data.md deleted file mode 100644 index 386321b..0000000 --- a/docs/components/data.md +++ /dev/null @@ -1,10 +0,0 @@ -# Data - -Model count data - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -| `count` | *int* | :heavy_check_mark: | Total number of available models | 150 | \ No newline at end of file diff --git a/docs/components/modelscountresponse.md b/docs/components/modelscountresponse.md index 84bbce8..4ad6e6a 100644 --- a/docs/components/modelscountresponse.md +++ b/docs/components/modelscountresponse.md @@ -5,6 +5,6 @@ Model count data ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `data` | [components.Data](../components/data.md) | :heavy_check_mark: | Model count data | {
"count": 150
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `data` | [components.ModelsCountResponseData](../components/modelscountresponsedata.md) | :heavy_check_mark: | Model count data | {
"count": 150
} | \ 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 deleted file mode 100644 index ffff0b9..0000000 --- a/docs/operations/apitype.md +++ /dev/null @@ -1,13 +0,0 @@ -# APIType - -Type of API used for the generation - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `COMPLETIONS` | completions | -| `EMBEDDINGS` | embeddings | -| `RERANK` | rerank | -| `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 deleted file mode 100644 index 7be5766..0000000 --- a/docs/operations/getgenerationdata.md +++ /dev/null @@ -1,47 +0,0 @@ -# GetGenerationData - -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 diff --git a/docs/operations/getgenerationresponse.md b/docs/operations/getgenerationresponse.md deleted file mode 100644 index 989c19a..0000000 --- a/docs/operations/getgenerationresponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetGenerationResponse - -Generation response - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `data` | [operations.GetGenerationData](../operations/getgenerationdata.md) | :heavy_check_mark: | Generation data | \ 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/generations/README.md b/docs/sdks/generations/README.md index 332b568..7fd647d 100644 --- a/docs/sdks/generations/README.md +++ b/docs/sdks/generations/README.md @@ -7,6 +7,7 @@ Generation history endpoints ### Available Operations * [get_generation](#get_generation) - Get request & usage metadata for a generation +* [list_generation_content](#list_generation_content) - Get stored prompt and completion content for a generation ## get_generation @@ -46,7 +47,7 @@ with OpenRouter( ### Response -**[operations.GetGenerationResponse](../../operations/getgenerationresponse.md)** +**[components.GenerationResponse](../../components/generationresponse.md)** ### Errors @@ -60,4 +61,58 @@ with OpenRouter( | errors.BadGatewayResponseError | 502 | application/json | | errors.EdgeNetworkTimeoutResponseError | 524 | application/json | | errors.ProviderOverloadedResponseError | 529 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_generation_content + +Get stored prompt and completion content for a generation + +### Example Usage + + +```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.generations.list_generation_content(id="gen-1234567890") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The generation ID | gen-1234567890 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.GenerationContentResponse](../../components/generationcontentresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.BadGatewayResponseError | 502 | application/json | +| errors.EdgeNetworkTimeoutResponseError | 524 | application/json | +| errors.ProviderOverloadedResponseError | 529 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file 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..f3c7aa7 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -61,6 +61,14 @@ BaseInputsUnionTypedDict, ) from .basereasoningconfig import BaseReasoningConfig, BaseReasoningConfigTypedDict + from .bulkaddworkspacemembersrequest import ( + BulkAddWorkspaceMembersRequest, + BulkAddWorkspaceMembersRequestTypedDict, + ) + from .bulkaddworkspacemembersresponse import ( + BulkAddWorkspaceMembersResponse, + BulkAddWorkspaceMembersResponseTypedDict, + ) from .bulkassignkeysrequest import ( BulkAssignKeysRequest, BulkAssignKeysRequestTypedDict, @@ -77,6 +85,14 @@ BulkAssignMembersResponse, BulkAssignMembersResponseTypedDict, ) + from .bulkremoveworkspacemembersrequest import ( + BulkRemoveWorkspaceMembersRequest, + BulkRemoveWorkspaceMembersRequestTypedDict, + ) + from .bulkremoveworkspacemembersresponse import ( + BulkRemoveWorkspaceMembersResponse, + BulkRemoveWorkspaceMembersResponseTypedDict, + ) from .bulkunassignkeysrequest import ( BulkUnassignKeysRequest, BulkUnassignKeysRequestTypedDict, @@ -364,6 +380,14 @@ CreateGuardrailResponse, CreateGuardrailResponseTypedDict, ) + from .createworkspacerequest import ( + CreateWorkspaceRequest, + CreateWorkspaceRequestTypedDict, + ) + from .createworkspaceresponse import ( + CreateWorkspaceResponse, + CreateWorkspaceResponseTypedDict, + ) from .customtool import ( CustomTool, CustomToolTypedDict, @@ -392,6 +416,10 @@ DeleteGuardrailResponse, DeleteGuardrailResponseTypedDict, ) + from .deleteworkspaceresponse import ( + DeleteWorkspaceResponse, + DeleteWorkspaceResponseTypedDict, + ) from .easyinputmessage import ( EasyInputMessage, EasyInputMessageContentInputImage, @@ -502,10 +530,37 @@ OutputInputImage, OutputInputImageTypedDict, ) + from .generationcontentdata import ( + GenerationContentData, + GenerationContentDataOutput, + GenerationContentDataOutputTypedDict, + GenerationContentDataTypedDict, + Input1, + Input1TypedDict, + Input2, + Input2TypedDict, + InputUnion, + InputUnionTypedDict, + ) + from .generationcontentresponse import ( + GenerationContentResponse, + GenerationContentResponseTypedDict, + ) + from .generationresponse import ( + APIType, + GenerationResponse, + GenerationResponseData, + GenerationResponseDataTypedDict, + GenerationResponseTypedDict, + ) from .getguardrailresponse import ( GetGuardrailResponse, GetGuardrailResponseTypedDict, ) + from .getworkspaceresponse import ( + GetWorkspaceResponse, + GetWorkspaceResponseTypedDict, + ) from .guardrail import Guardrail, GuardrailTypedDict from .guardrailinterval import GuardrailInterval from .imageconfig import ImageConfig, ImageConfigTypedDict @@ -658,6 +713,10 @@ ListMemberAssignmentsResponse, ListMemberAssignmentsResponseTypedDict, ) + from .listworkspacesresponse import ( + ListWorkspacesResponse, + ListWorkspacesResponseTypedDict, + ) from .mcpservertool import ( AllowedTools, AllowedToolsTypedDict, @@ -688,9 +747,9 @@ from .modelgroup import ModelGroup from .modellinks import ModelLinks, ModelLinksTypedDict from .modelscountresponse import ( - Data, - DataTypedDict, ModelsCountResponse, + ModelsCountResponseData, + ModelsCountResponseDataTypedDict, ModelsCountResponseTypedDict, ) from .modelslistresponse import ModelsListResponse, ModelsListResponseTypedDict @@ -921,6 +980,11 @@ OutputReasoningItemType, OutputReasoningItemTypedDict, ) + from .outputsearchmodelsservertoolitem import ( + OutputSearchModelsServerToolItem, + OutputSearchModelsServerToolItemType, + OutputSearchModelsServerToolItemTypedDict, + ) from .outputtexteditorservertoolitem import ( Command, OutputTextEditorServerToolItem, @@ -1217,7 +1281,6 @@ StreamLogprobTopLogprob, StreamLogprobTopLogprobTypedDict, ) - from .textconfig import TextConfig, TextConfigTypedDict, TextConfigVerbosity from .textdeltaevent import ( TextDeltaEvent, TextDeltaEventType, @@ -1227,7 +1290,7 @@ from .textextendedconfig import ( TextExtendedConfig, TextExtendedConfigTypedDict, - TextExtendedConfigVerbosity, + Verbosity, ) from .toolcallstatus import ToolCallStatus from .toolchoiceallowed import ( @@ -1262,6 +1325,14 @@ UpdateGuardrailResponse, UpdateGuardrailResponseTypedDict, ) + from .updateworkspacerequest import ( + UpdateWorkspaceRequest, + UpdateWorkspaceRequestTypedDict, + ) + from .updateworkspaceresponse import ( + UpdateWorkspaceResponse, + UpdateWorkspaceResponseTypedDict, + ) from .urlcitation import URLCitation, URLCitationType, URLCitationTypedDict from .usage import ( CostDetails, @@ -1359,8 +1430,15 @@ WebSearchUserLocationServerToolType, WebSearchUserLocationServerToolTypedDict, ) + from .workspace import Workspace, WorkspaceTypedDict + from .workspacemember import ( + WorkspaceMember, + WorkspaceMemberRole, + WorkspaceMemberTypedDict, + ) __all__ = [ + "APIType", "Action", "ActionEnum", "ActionFindInPage", @@ -1424,6 +1502,10 @@ "BaseInputsUnionTypedDict", "BaseReasoningConfig", "BaseReasoningConfigTypedDict", + "BulkAddWorkspaceMembersRequest", + "BulkAddWorkspaceMembersRequestTypedDict", + "BulkAddWorkspaceMembersResponse", + "BulkAddWorkspaceMembersResponseTypedDict", "BulkAssignKeysRequest", "BulkAssignKeysRequestTypedDict", "BulkAssignKeysResponse", @@ -1432,6 +1514,10 @@ "BulkAssignMembersRequestTypedDict", "BulkAssignMembersResponse", "BulkAssignMembersResponseTypedDict", + "BulkRemoveWorkspaceMembersRequest", + "BulkRemoveWorkspaceMembersRequestTypedDict", + "BulkRemoveWorkspaceMembersResponse", + "BulkRemoveWorkspaceMembersResponseTypedDict", "BulkUnassignKeysRequest", "BulkUnassignKeysRequestTypedDict", "BulkUnassignKeysResponse", @@ -1628,11 +1714,13 @@ "CreateGuardrailRequestTypedDict", "CreateGuardrailResponse", "CreateGuardrailResponseTypedDict", + "CreateWorkspaceRequest", + "CreateWorkspaceRequestTypedDict", + "CreateWorkspaceResponse", + "CreateWorkspaceResponseTypedDict", "CustomTool", "CustomToolTypedDict", - "Data", "DataCollection", - "DataTypedDict", "DatetimeServerTool", "DatetimeServerToolConfig", "DatetimeServerToolConfigTypedDict", @@ -1642,6 +1730,8 @@ "DefaultParametersTypedDict", "DeleteGuardrailResponse", "DeleteGuardrailResponseTypedDict", + "DeleteWorkspaceResponse", + "DeleteWorkspaceResponseTypedDict", "EasyInputMessage", "EasyInputMessageContentInputImage", "EasyInputMessageContentInputImageTypedDict", @@ -1738,8 +1828,20 @@ "FunctionCallOutputItemStatus", "FunctionCallOutputItemTypeFunctionCallOutput", "FunctionCallOutputItemTypedDict", + "GenerationContentData", + "GenerationContentDataOutput", + "GenerationContentDataOutputTypedDict", + "GenerationContentDataTypedDict", + "GenerationContentResponse", + "GenerationContentResponseTypedDict", + "GenerationResponse", + "GenerationResponseData", + "GenerationResponseDataTypedDict", + "GenerationResponseTypedDict", "GetGuardrailResponse", "GetGuardrailResponseTypedDict", + "GetWorkspaceResponse", + "GetWorkspaceResponseTypedDict", "Guardrail", "GuardrailInterval", "GuardrailTypedDict", @@ -1772,6 +1874,10 @@ "ImageGenerationStatus", "IncompleteDetails", "IncompleteDetailsTypedDict", + "Input1", + "Input1TypedDict", + "Input2", + "Input2TypedDict", "InputAudio", "InputAudioInputAudio", "InputAudioInputAudioTypedDict", @@ -1807,6 +1913,8 @@ "InputTextTypedDict", "InputTokensDetails", "InputTokensDetailsTypedDict", + "InputUnion", + "InputUnionTypedDict", "InputVideo", "InputVideoType", "InputVideoTypedDict", @@ -1858,6 +1966,8 @@ "ListKeyAssignmentsResponseTypedDict", "ListMemberAssignmentsResponse", "ListMemberAssignmentsResponseTypedDict", + "ListWorkspacesResponse", + "ListWorkspacesResponseTypedDict", "Logprob", "LogprobTypedDict", "MaxPrice", @@ -1883,6 +1993,8 @@ "ModelLinksTypedDict", "ModelTypedDict", "ModelsCountResponse", + "ModelsCountResponseData", + "ModelsCountResponseDataTypedDict", "ModelsCountResponseTypedDict", "ModelsListResponse", "ModelsListResponseTypedDict", @@ -2058,6 +2170,9 @@ "OutputReasoningItemStatusUnionTypedDict", "OutputReasoningItemType", "OutputReasoningItemTypedDict", + "OutputSearchModelsServerToolItem", + "OutputSearchModelsServerToolItemType", + "OutputSearchModelsServerToolItemTypedDict", "OutputTextEditorServerToolItem", "OutputTextEditorServerToolItemType", "OutputTextEditorServerToolItemTypedDict", @@ -2271,9 +2386,6 @@ "SupportedResolution", "SupportedSize", "Syntax", - "TextConfig", - "TextConfigTypedDict", - "TextConfigVerbosity", "TextDeltaEvent", "TextDeltaEventType", "TextDeltaEventTypedDict", @@ -2282,7 +2394,6 @@ "TextDoneEventTypedDict", "TextExtendedConfig", "TextExtendedConfigTypedDict", - "TextExtendedConfigVerbosity", "Tokenizer", "TooManyRequestsResponseErrorData", "TooManyRequestsResponseErrorDataTypedDict", @@ -2318,6 +2429,10 @@ "UpdateGuardrailRequestTypedDict", "UpdateGuardrailResponse", "UpdateGuardrailResponseTypedDict", + "UpdateWorkspaceRequest", + "UpdateWorkspaceRequestTypedDict", + "UpdateWorkspaceResponse", + "UpdateWorkspaceResponseTypedDict", "Usage", "UsageTypedDict", "Value1", @@ -2326,6 +2441,7 @@ "Value2TypedDict", "Variables", "VariablesTypedDict", + "Verbosity", "VideoGenerationRequest", "VideoGenerationRequestTypedDict", "VideoGenerationResponse", @@ -2371,6 +2487,11 @@ "WebSearchUserLocationServerToolTypedDict", "WebSearchUserLocationType", "WebSearchUserLocationTypedDict", + "Workspace", + "WorkspaceMember", + "WorkspaceMemberRole", + "WorkspaceMemberTypedDict", + "WorkspaceTypedDict", ] _dynamic_imports: dict[str, str] = { @@ -2418,6 +2539,10 @@ "BaseInputsUnionTypedDict": ".baseinputs_union", "BaseReasoningConfig": ".basereasoningconfig", "BaseReasoningConfigTypedDict": ".basereasoningconfig", + "BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest", + "BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest", + "BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse", + "BulkAddWorkspaceMembersResponseTypedDict": ".bulkaddworkspacemembersresponse", "BulkAssignKeysRequest": ".bulkassignkeysrequest", "BulkAssignKeysRequestTypedDict": ".bulkassignkeysrequest", "BulkAssignKeysResponse": ".bulkassignkeysresponse", @@ -2426,6 +2551,10 @@ "BulkAssignMembersRequestTypedDict": ".bulkassignmembersrequest", "BulkAssignMembersResponse": ".bulkassignmembersresponse", "BulkAssignMembersResponseTypedDict": ".bulkassignmembersresponse", + "BulkRemoveWorkspaceMembersRequest": ".bulkremoveworkspacemembersrequest", + "BulkRemoveWorkspaceMembersRequestTypedDict": ".bulkremoveworkspacemembersrequest", + "BulkRemoveWorkspaceMembersResponse": ".bulkremoveworkspacemembersresponse", + "BulkRemoveWorkspaceMembersResponseTypedDict": ".bulkremoveworkspacemembersresponse", "BulkUnassignKeysRequest": ".bulkunassignkeysrequest", "BulkUnassignKeysRequestTypedDict": ".bulkunassignkeysrequest", "BulkUnassignKeysResponse": ".bulkunassignkeysresponse", @@ -2633,6 +2762,10 @@ "CreateGuardrailRequestTypedDict": ".createguardrailrequest", "CreateGuardrailResponse": ".createguardrailresponse", "CreateGuardrailResponseTypedDict": ".createguardrailresponse", + "CreateWorkspaceRequest": ".createworkspacerequest", + "CreateWorkspaceRequestTypedDict": ".createworkspacerequest", + "CreateWorkspaceResponse": ".createworkspaceresponse", + "CreateWorkspaceResponseTypedDict": ".createworkspaceresponse", "CustomTool": ".customtool", "CustomToolTypedDict": ".customtool", "Format": ".customtool", @@ -2654,6 +2787,8 @@ "DefaultParametersTypedDict": ".defaultparameters", "DeleteGuardrailResponse": ".deleteguardrailresponse", "DeleteGuardrailResponseTypedDict": ".deleteguardrailresponse", + "DeleteWorkspaceResponse": ".deleteworkspaceresponse", + "DeleteWorkspaceResponseTypedDict": ".deleteworkspaceresponse", "EasyInputMessage": ".easyinputmessage", "EasyInputMessageContentInputImage": ".easyinputmessage", "EasyInputMessageContentInputImageTypedDict": ".easyinputmessage", @@ -2745,8 +2880,27 @@ "FunctionCallOutputItemTypedDict": ".functioncalloutputitem", "OutputInputImage": ".functioncalloutputitem", "OutputInputImageTypedDict": ".functioncalloutputitem", + "GenerationContentData": ".generationcontentdata", + "GenerationContentDataOutput": ".generationcontentdata", + "GenerationContentDataOutputTypedDict": ".generationcontentdata", + "GenerationContentDataTypedDict": ".generationcontentdata", + "Input1": ".generationcontentdata", + "Input1TypedDict": ".generationcontentdata", + "Input2": ".generationcontentdata", + "Input2TypedDict": ".generationcontentdata", + "InputUnion": ".generationcontentdata", + "InputUnionTypedDict": ".generationcontentdata", + "GenerationContentResponse": ".generationcontentresponse", + "GenerationContentResponseTypedDict": ".generationcontentresponse", + "APIType": ".generationresponse", + "GenerationResponse": ".generationresponse", + "GenerationResponseData": ".generationresponse", + "GenerationResponseDataTypedDict": ".generationresponse", + "GenerationResponseTypedDict": ".generationresponse", "GetGuardrailResponse": ".getguardrailresponse", "GetGuardrailResponseTypedDict": ".getguardrailresponse", + "GetWorkspaceResponse": ".getworkspaceresponse", + "GetWorkspaceResponseTypedDict": ".getworkspaceresponse", "Guardrail": ".guardrail", "GuardrailTypedDict": ".guardrail", "GuardrailInterval": ".guardrailinterval", @@ -2872,6 +3026,8 @@ "ListKeyAssignmentsResponseTypedDict": ".listkeyassignmentsresponse", "ListMemberAssignmentsResponse": ".listmemberassignmentsresponse", "ListMemberAssignmentsResponseTypedDict": ".listmemberassignmentsresponse", + "ListWorkspacesResponse": ".listworkspacesresponse", + "ListWorkspacesResponseTypedDict": ".listworkspacesresponse", "AllowedTools": ".mcpservertool", "AllowedToolsTypedDict": ".mcpservertool", "AllowedToolsUnion": ".mcpservertool", @@ -2900,9 +3056,9 @@ "ModelGroup": ".modelgroup", "ModelLinks": ".modellinks", "ModelLinksTypedDict": ".modellinks", - "Data": ".modelscountresponse", - "DataTypedDict": ".modelscountresponse", "ModelsCountResponse": ".modelscountresponse", + "ModelsCountResponseData": ".modelscountresponse", + "ModelsCountResponseDataTypedDict": ".modelscountresponse", "ModelsCountResponseTypedDict": ".modelscountresponse", "ModelsListResponse": ".modelslistresponse", "ModelsListResponseTypedDict": ".modelslistresponse", @@ -3074,6 +3230,9 @@ "OutputReasoningItemStatusUnionTypedDict": ".outputreasoningitem", "OutputReasoningItemType": ".outputreasoningitem", "OutputReasoningItemTypedDict": ".outputreasoningitem", + "OutputSearchModelsServerToolItem": ".outputsearchmodelsservertoolitem", + "OutputSearchModelsServerToolItemType": ".outputsearchmodelsservertoolitem", + "OutputSearchModelsServerToolItemTypedDict": ".outputsearchmodelsservertoolitem", "Command": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItem": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItemType": ".outputtexteditorservertoolitem", @@ -3281,9 +3440,6 @@ "StreamLogprobTypedDict": ".streamlogprob", "StreamLogprobTopLogprob": ".streamlogprobtoplogprob", "StreamLogprobTopLogprobTypedDict": ".streamlogprobtoplogprob", - "TextConfig": ".textconfig", - "TextConfigTypedDict": ".textconfig", - "TextConfigVerbosity": ".textconfig", "TextDeltaEvent": ".textdeltaevent", "TextDeltaEventType": ".textdeltaevent", "TextDeltaEventTypedDict": ".textdeltaevent", @@ -3292,7 +3448,7 @@ "TextDoneEventTypedDict": ".textdoneevent", "TextExtendedConfig": ".textextendedconfig", "TextExtendedConfigTypedDict": ".textextendedconfig", - "TextExtendedConfigVerbosity": ".textextendedconfig", + "Verbosity": ".textextendedconfig", "ToolCallStatus": ".toolcallstatus", "Mode": ".toolchoiceallowed", "ModeAuto": ".toolchoiceallowed", @@ -3316,6 +3472,10 @@ "UpdateGuardrailRequestTypedDict": ".updateguardrailrequest", "UpdateGuardrailResponse": ".updateguardrailresponse", "UpdateGuardrailResponseTypedDict": ".updateguardrailresponse", + "UpdateWorkspaceRequest": ".updateworkspacerequest", + "UpdateWorkspaceRequestTypedDict": ".updateworkspacerequest", + "UpdateWorkspaceResponse": ".updateworkspaceresponse", + "UpdateWorkspaceResponseTypedDict": ".updateworkspaceresponse", "URLCitation": ".urlcitation", "URLCitationType": ".urlcitation", "URLCitationTypedDict": ".urlcitation", @@ -3384,6 +3544,11 @@ "WebSearchUserLocationServerTool": ".websearchuserlocationservertool", "WebSearchUserLocationServerToolType": ".websearchuserlocationservertool", "WebSearchUserLocationServerToolTypedDict": ".websearchuserlocationservertool", + "Workspace": ".workspace", + "WorkspaceTypedDict": ".workspace", + "WorkspaceMember": ".workspacemember", + "WorkspaceMemberRole": ".workspacemember", + "WorkspaceMemberTypedDict": ".workspacemember", } diff --git a/src/openrouter/components/bulkaddworkspacemembersrequest.py b/src/openrouter/components/bulkaddworkspacemembersrequest.py new file mode 100644 index 0000000..c792725 --- /dev/null +++ b/src/openrouter/components/bulkaddworkspacemembersrequest.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class BulkAddWorkspaceMembersRequestTypedDict(TypedDict): + user_ids: List[str] + r"""List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization.""" + + +class BulkAddWorkspaceMembersRequest(BaseModel): + user_ids: List[str] + r"""List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization.""" diff --git a/src/openrouter/components/bulkaddworkspacemembersresponse.py b/src/openrouter/components/bulkaddworkspacemembersresponse.py new file mode 100644 index 0000000..f46030f --- /dev/null +++ b/src/openrouter/components/bulkaddworkspacemembersresponse.py @@ -0,0 +1,22 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .workspacemember import WorkspaceMember, WorkspaceMemberTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class BulkAddWorkspaceMembersResponseTypedDict(TypedDict): + added_count: int + r"""Number of workspace memberships created or updated""" + data: List[WorkspaceMemberTypedDict] + r"""List of added workspace memberships""" + + +class BulkAddWorkspaceMembersResponse(BaseModel): + added_count: int + r"""Number of workspace memberships created or updated""" + + data: List[WorkspaceMember] + r"""List of added workspace memberships""" diff --git a/src/openrouter/components/bulkremoveworkspacemembersrequest.py b/src/openrouter/components/bulkremoveworkspacemembersrequest.py new file mode 100644 index 0000000..a02c46c --- /dev/null +++ b/src/openrouter/components/bulkremoveworkspacemembersrequest.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class BulkRemoveWorkspaceMembersRequestTypedDict(TypedDict): + user_ids: List[str] + r"""List of user IDs to remove from the workspace""" + + +class BulkRemoveWorkspaceMembersRequest(BaseModel): + user_ids: List[str] + r"""List of user IDs to remove from the workspace""" diff --git a/src/openrouter/components/bulkremoveworkspacemembersresponse.py b/src/openrouter/components/bulkremoveworkspacemembersresponse.py new file mode 100644 index 0000000..69082ff --- /dev/null +++ b/src/openrouter/components/bulkremoveworkspacemembersresponse.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class BulkRemoveWorkspaceMembersResponseTypedDict(TypedDict): + removed_count: int + r"""Number of members removed""" + + +class BulkRemoveWorkspaceMembersResponse(BaseModel): + removed_count: int + r"""Number of members removed""" 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/createworkspacerequest.py b/src/openrouter/components/createworkspacerequest.py new file mode 100644 index 0000000..ff5d506 --- /dev/null +++ b/src/openrouter/components/createworkspacerequest.py @@ -0,0 +1,106 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class CreateWorkspaceRequestTypedDict(TypedDict): + name: str + r"""Name for the new workspace""" + slug: str + r"""URL-friendly slug (lowercase alphanumeric and hyphens only)""" + default_image_model: NotRequired[Nullable[str]] + r"""Default image model for this workspace""" + default_provider_sort: NotRequired[Nullable[str]] + r"""Default provider sort preference (price, throughput, latency, exacto)""" + default_text_model: NotRequired[Nullable[str]] + r"""Default text model for this workspace""" + description: NotRequired[Nullable[str]] + r"""Description of the workspace""" + is_data_discount_logging_enabled: NotRequired[bool] + r"""Whether data discount logging is enabled""" + is_observability_broadcast_enabled: NotRequired[bool] + r"""Whether broadcast is enabled""" + is_observability_io_logging_enabled: NotRequired[bool] + r"""Whether private logging is enabled""" + + +class CreateWorkspaceRequest(BaseModel): + name: str + r"""Name for the new workspace""" + + slug: str + r"""URL-friendly slug (lowercase alphanumeric and hyphens only)""" + + default_image_model: OptionalNullable[str] = UNSET + r"""Default image model for this workspace""" + + default_provider_sort: OptionalNullable[str] = UNSET + r"""Default provider sort preference (price, throughput, latency, exacto)""" + + default_text_model: OptionalNullable[str] = UNSET + r"""Default text model for this workspace""" + + description: OptionalNullable[str] = UNSET + r"""Description of the workspace""" + + is_data_discount_logging_enabled: Optional[bool] = None + r"""Whether data discount logging is enabled""" + + is_observability_broadcast_enabled: Optional[bool] = None + r"""Whether broadcast is enabled""" + + is_observability_io_logging_enabled: Optional[bool] = None + r"""Whether private logging is enabled""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "default_image_model", + "default_provider_sort", + "default_text_model", + "description", + "is_data_discount_logging_enabled", + "is_observability_broadcast_enabled", + "is_observability_io_logging_enabled", + ] + nullable_fields = [ + "default_image_model", + "default_provider_sort", + "default_text_model", + "description", + ] + 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/createworkspaceresponse.py b/src/openrouter/components/createworkspaceresponse.py new file mode 100644 index 0000000..54c7b43 --- /dev/null +++ b/src/openrouter/components/createworkspaceresponse.py @@ -0,0 +1,14 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .workspace import Workspace, WorkspaceTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class CreateWorkspaceResponseTypedDict(TypedDict): + data: WorkspaceTypedDict + + +class CreateWorkspaceResponse(BaseModel): + data: Workspace diff --git a/src/openrouter/components/deleteworkspaceresponse.py b/src/openrouter/components/deleteworkspaceresponse.py new file mode 100644 index 0000000..bed4595 --- /dev/null +++ b/src/openrouter/components/deleteworkspaceresponse.py @@ -0,0 +1,22 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class DeleteWorkspaceResponseTypedDict(TypedDict): + deleted: Literal[True] + r"""Confirmation that the workspace was deleted""" + + +class DeleteWorkspaceResponse(BaseModel): + DELETED: Annotated[ + Annotated[Literal[True], AfterValidator(validate_const(True))], + pydantic.Field(alias="deleted"), + ] = True + r"""Confirmation that the workspace was deleted""" diff --git a/src/openrouter/components/generationcontentdata.py b/src/openrouter/components/generationcontentdata.py new file mode 100644 index 0000000..065679a --- /dev/null +++ b/src/openrouter/components/generationcontentdata.py @@ -0,0 +1,101 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Any, List, Union +from typing_extensions import TypeAliasType, TypedDict + + +class Input2TypedDict(TypedDict): + messages: List[Nullable[Any]] + + +class Input2(BaseModel): + messages: List[Nullable[Any]] + + +class Input1TypedDict(TypedDict): + prompt: str + + +class Input1(BaseModel): + prompt: str + + +InputUnionTypedDict = TypeAliasType( + "InputUnionTypedDict", Union[Input1TypedDict, Input2TypedDict] +) +r"""The input to the generation — either a prompt string or an array of messages""" + + +InputUnion = TypeAliasType("InputUnion", Union[Input1, Input2]) +r"""The input to the generation — either a prompt string or an array of messages""" + + +class GenerationContentDataOutputTypedDict(TypedDict): + r"""The output from the generation""" + + completion: Nullable[str] + r"""The completion output""" + reasoning: Nullable[str] + r"""Reasoning/thinking output, if any""" + + +class GenerationContentDataOutput(BaseModel): + r"""The output from the generation""" + + completion: Nullable[str] + r"""The completion output""" + + reasoning: Nullable[str] + r"""Reasoning/thinking output, if any""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["completion", "reasoning"] + 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 + + +class GenerationContentDataTypedDict(TypedDict): + r"""Stored prompt and completion content""" + + input: InputUnionTypedDict + r"""The input to the generation — either a prompt string or an array of messages""" + output: GenerationContentDataOutputTypedDict + r"""The output from the generation""" + + +class GenerationContentData(BaseModel): + r"""Stored prompt and completion content""" + + input: InputUnion + r"""The input to the generation — either a prompt string or an array of messages""" + + output: GenerationContentDataOutput + r"""The output from the generation""" diff --git a/src/openrouter/components/generationcontentresponse.py b/src/openrouter/components/generationcontentresponse.py new file mode 100644 index 0000000..b762f65 --- /dev/null +++ b/src/openrouter/components/generationcontentresponse.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .generationcontentdata import GenerationContentData, GenerationContentDataTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class GenerationContentResponseTypedDict(TypedDict): + r"""Stored prompt and completion content for a generation""" + + data: GenerationContentDataTypedDict + r"""Stored prompt and completion content""" + + +class GenerationContentResponse(BaseModel): + r"""Stored prompt and completion content for a generation""" + + data: GenerationContentData + r"""Stored prompt and completion content""" diff --git a/src/openrouter/components/generationresponse.py b/src/openrouter/components/generationresponse.py new file mode 100644 index 0000000..2c8546c --- /dev/null +++ b/src/openrouter/components/generationresponse.py @@ -0,0 +1,311 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .providerresponse import ProviderResponse, ProviderResponseTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import validate_open_enum +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import List, Literal, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +APIType = Union[ + Literal[ + "completions", + "embeddings", + "rerank", + "tts", + "video", + ], + UnrecognizedStr, +] +r"""Type of API used for the generation""" + + +class GenerationResponseDataTypedDict(TypedDict): + r"""Generation data""" + + api_type: Nullable[APIType] + r"""Type of API used for the generation""" + app_id: Nullable[int] + r"""ID of the app that made the request""" + cache_discount: Nullable[float] + r"""Discount applied due to caching""" + cancelled: Nullable[bool] + r"""Whether the generation was cancelled""" + created_at: str + r"""ISO 8601 timestamp of when the generation was created""" + external_user: Nullable[str] + r"""External user identifier""" + finish_reason: Nullable[str] + r"""Reason the generation finished""" + generation_time: Nullable[float] + r"""Time taken for generation in milliseconds""" + http_referer: Nullable[str] + r"""Referer header from the request""" + id: str + r"""Unique identifier for the generation""" + is_byok: bool + r"""Whether this used bring-your-own-key""" + latency: Nullable[float] + r"""Total latency in milliseconds""" + model: str + r"""Model used for the generation""" + moderation_latency: Nullable[float] + r"""Moderation latency in milliseconds""" + native_finish_reason: Nullable[str] + r"""Native finish reason as reported by provider""" + native_tokens_cached: Nullable[int] + r"""Native cached tokens as reported by provider""" + native_tokens_completion: Nullable[int] + r"""Native completion tokens as reported by provider""" + native_tokens_completion_images: Nullable[int] + r"""Native completion image tokens as reported by provider""" + native_tokens_prompt: Nullable[int] + r"""Native prompt tokens as reported by provider""" + native_tokens_reasoning: Nullable[int] + r"""Native reasoning tokens as reported by provider""" + num_input_audio_prompt: Nullable[int] + r"""Number of audio inputs in the prompt""" + num_media_completion: Nullable[int] + r"""Number of media items in the completion""" + num_media_prompt: Nullable[int] + r"""Number of media items in the prompt""" + num_search_results: Nullable[int] + r"""Number of search results included""" + origin: str + r"""Origin URL of the request""" + provider_name: Nullable[str] + r"""Name of the provider that served the request""" + provider_responses: Nullable[List[ProviderResponseTypedDict]] + r"""List of provider responses for this generation, including fallback attempts""" + router: Nullable[str] + r"""Router used for the request (e.g., openrouter/auto)""" + streamed: Nullable[bool] + r"""Whether the response was streamed""" + tokens_completion: Nullable[int] + r"""Number of tokens in the completion""" + tokens_prompt: Nullable[int] + r"""Number of tokens in the prompt""" + total_cost: float + r"""Total cost of the generation in USD""" + upstream_id: Nullable[str] + r"""Upstream provider's identifier for this generation""" + upstream_inference_cost: Nullable[float] + r"""Cost charged by the upstream provider""" + usage: float + 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]] + r"""Session identifier grouping multiple generations in the same session""" + + +class GenerationResponseData(BaseModel): + r"""Generation data""" + + api_type: Annotated[Nullable[APIType], PlainValidator(validate_open_enum(False))] + r"""Type of API used for the generation""" + + app_id: Nullable[int] + r"""ID of the app that made the request""" + + cache_discount: Nullable[float] + r"""Discount applied due to caching""" + + cancelled: Nullable[bool] + r"""Whether the generation was cancelled""" + + created_at: str + r"""ISO 8601 timestamp of when the generation was created""" + + external_user: Nullable[str] + r"""External user identifier""" + + finish_reason: Nullable[str] + r"""Reason the generation finished""" + + generation_time: Nullable[float] + r"""Time taken for generation in milliseconds""" + + http_referer: Nullable[str] + r"""Referer header from the request""" + + id: str + r"""Unique identifier for the generation""" + + is_byok: bool + r"""Whether this used bring-your-own-key""" + + latency: Nullable[float] + r"""Total latency in milliseconds""" + + model: str + r"""Model used for the generation""" + + moderation_latency: Nullable[float] + r"""Moderation latency in milliseconds""" + + native_finish_reason: Nullable[str] + r"""Native finish reason as reported by provider""" + + native_tokens_cached: Nullable[int] + r"""Native cached tokens as reported by provider""" + + native_tokens_completion: Nullable[int] + r"""Native completion tokens as reported by provider""" + + native_tokens_completion_images: Nullable[int] + r"""Native completion image tokens as reported by provider""" + + native_tokens_prompt: Nullable[int] + r"""Native prompt tokens as reported by provider""" + + native_tokens_reasoning: Nullable[int] + r"""Native reasoning tokens as reported by provider""" + + num_input_audio_prompt: Nullable[int] + r"""Number of audio inputs in the prompt""" + + num_media_completion: Nullable[int] + r"""Number of media items in the completion""" + + num_media_prompt: Nullable[int] + r"""Number of media items in the prompt""" + + num_search_results: Nullable[int] + r"""Number of search results included""" + + origin: str + r"""Origin URL of the request""" + + provider_name: Nullable[str] + r"""Name of the provider that served the request""" + + provider_responses: Nullable[List[ProviderResponse]] + r"""List of provider responses for this generation, including fallback attempts""" + + router: Nullable[str] + r"""Router used for the request (e.g., openrouter/auto)""" + + streamed: Nullable[bool] + r"""Whether the response was streamed""" + + tokens_completion: Nullable[int] + r"""Number of tokens in the completion""" + + tokens_prompt: Nullable[int] + r"""Number of tokens in the prompt""" + + total_cost: float + r"""Total cost of the generation in USD""" + + upstream_id: Nullable[str] + r"""Upstream provider's identifier for this generation""" + + upstream_inference_cost: Nullable[float] + r"""Cost charged by the upstream provider""" + + usage: float + 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: OptionalNullable[str] = UNSET + r"""Unique identifier grouping all generations from a single API request""" + + session_id: OptionalNullable[str] = UNSET + r"""Session identifier grouping multiple generations in the same session""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["request_id", "session_id"] + nullable_fields = [ + "api_type", + "app_id", + "cache_discount", + "cancelled", + "external_user", + "finish_reason", + "generation_time", + "http_referer", + "latency", + "moderation_latency", + "native_finish_reason", + "native_tokens_cached", + "native_tokens_completion", + "native_tokens_completion_images", + "native_tokens_prompt", + "native_tokens_reasoning", + "num_input_audio_prompt", + "num_media_completion", + "num_media_prompt", + "num_search_results", + "provider_name", + "provider_responses", + "request_id", + "router", + "session_id", + "streamed", + "tokens_completion", + "tokens_prompt", + "upstream_id", + "upstream_inference_cost", + "user_agent", + "web_search_engine", + ] + 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 + + +class GenerationResponseTypedDict(TypedDict): + r"""Generation response""" + + data: GenerationResponseDataTypedDict + r"""Generation data""" + + +class GenerationResponse(BaseModel): + r"""Generation response""" + + data: GenerationResponseData + r"""Generation data""" diff --git a/src/openrouter/components/getworkspaceresponse.py b/src/openrouter/components/getworkspaceresponse.py new file mode 100644 index 0000000..acda534 --- /dev/null +++ b/src/openrouter/components/getworkspaceresponse.py @@ -0,0 +1,14 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .workspace import Workspace, WorkspaceTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class GetWorkspaceResponseTypedDict(TypedDict): + data: WorkspaceTypedDict + + +class GetWorkspaceResponse(BaseModel): + data: Workspace 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/listworkspacesresponse.py b/src/openrouter/components/listworkspacesresponse.py new file mode 100644 index 0000000..b70d4bb --- /dev/null +++ b/src/openrouter/components/listworkspacesresponse.py @@ -0,0 +1,22 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .workspace import Workspace, WorkspaceTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ListWorkspacesResponseTypedDict(TypedDict): + data: List[WorkspaceTypedDict] + r"""List of workspaces""" + total_count: int + r"""Total number of workspaces""" + + +class ListWorkspacesResponse(BaseModel): + data: List[Workspace] + r"""List of workspaces""" + + total_count: int + r"""Total number of workspaces""" diff --git a/src/openrouter/components/modelscountresponse.py b/src/openrouter/components/modelscountresponse.py index 86bb27c..8d68ee4 100644 --- a/src/openrouter/components/modelscountresponse.py +++ b/src/openrouter/components/modelscountresponse.py @@ -5,14 +5,14 @@ from typing_extensions import TypedDict -class DataTypedDict(TypedDict): +class ModelsCountResponseDataTypedDict(TypedDict): r"""Model count data""" count: int r"""Total number of available models""" -class Data(BaseModel): +class ModelsCountResponseData(BaseModel): r"""Model count data""" count: int @@ -22,12 +22,12 @@ class Data(BaseModel): class ModelsCountResponseTypedDict(TypedDict): r"""Model count data""" - data: DataTypedDict + data: ModelsCountResponseDataTypedDict r"""Model count data""" class ModelsCountResponse(BaseModel): r"""Model count data""" - data: Data + data: ModelsCountResponseData r"""Model count data""" 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/updateworkspacerequest.py b/src/openrouter/components/updateworkspacerequest.py new file mode 100644 index 0000000..a0ed364 --- /dev/null +++ b/src/openrouter/components/updateworkspacerequest.py @@ -0,0 +1,108 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class UpdateWorkspaceRequestTypedDict(TypedDict): + default_image_model: NotRequired[Nullable[str]] + r"""Default image model for this workspace""" + default_provider_sort: NotRequired[Nullable[str]] + r"""Default provider sort preference (price, throughput, latency, exacto)""" + default_text_model: NotRequired[Nullable[str]] + r"""Default text model for this workspace""" + description: NotRequired[Nullable[str]] + r"""New description for the workspace""" + is_data_discount_logging_enabled: NotRequired[bool] + r"""Whether data discount logging is enabled""" + is_observability_broadcast_enabled: NotRequired[bool] + r"""Whether broadcast is enabled""" + is_observability_io_logging_enabled: NotRequired[bool] + r"""Whether private logging is enabled""" + name: NotRequired[str] + r"""New name for the workspace""" + slug: NotRequired[str] + r"""New URL-friendly slug""" + + +class UpdateWorkspaceRequest(BaseModel): + default_image_model: OptionalNullable[str] = UNSET + r"""Default image model for this workspace""" + + default_provider_sort: OptionalNullable[str] = UNSET + r"""Default provider sort preference (price, throughput, latency, exacto)""" + + default_text_model: OptionalNullable[str] = UNSET + r"""Default text model for this workspace""" + + description: OptionalNullable[str] = UNSET + r"""New description for the workspace""" + + is_data_discount_logging_enabled: Optional[bool] = None + r"""Whether data discount logging is enabled""" + + is_observability_broadcast_enabled: Optional[bool] = None + r"""Whether broadcast is enabled""" + + is_observability_io_logging_enabled: Optional[bool] = None + r"""Whether private logging is enabled""" + + name: Optional[str] = None + r"""New name for the workspace""" + + slug: Optional[str] = None + r"""New URL-friendly slug""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "default_image_model", + "default_provider_sort", + "default_text_model", + "description", + "is_data_discount_logging_enabled", + "is_observability_broadcast_enabled", + "is_observability_io_logging_enabled", + "name", + "slug", + ] + nullable_fields = [ + "default_image_model", + "default_provider_sort", + "default_text_model", + "description", + ] + 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/updateworkspaceresponse.py b/src/openrouter/components/updateworkspaceresponse.py new file mode 100644 index 0000000..35d7ad3 --- /dev/null +++ b/src/openrouter/components/updateworkspaceresponse.py @@ -0,0 +1,14 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .workspace import Workspace, WorkspaceTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class UpdateWorkspaceResponseTypedDict(TypedDict): + data: WorkspaceTypedDict + + +class UpdateWorkspaceResponse(BaseModel): + data: Workspace 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/components/workspace.py b/src/openrouter/components/workspace.py new file mode 100644 index 0000000..a097f38 --- /dev/null +++ b/src/openrouter/components/workspace.py @@ -0,0 +1,113 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing_extensions import TypedDict + + +class WorkspaceTypedDict(TypedDict): + created_at: str + r"""ISO 8601 timestamp of when the workspace was created""" + created_by: Nullable[str] + r"""User ID of the workspace creator""" + default_image_model: Nullable[str] + r"""Default image model for this workspace""" + default_provider_sort: Nullable[str] + r"""Default provider sort preference (price, throughput, latency, exacto)""" + default_text_model: Nullable[str] + r"""Default text model for this workspace""" + description: Nullable[str] + r"""Description of the workspace""" + id: str + r"""Unique identifier for the workspace""" + is_data_discount_logging_enabled: bool + r"""Whether data discount logging is enabled for this workspace""" + is_observability_broadcast_enabled: bool + r"""Whether broadcast is enabled for this workspace""" + is_observability_io_logging_enabled: bool + r"""Whether private logging is enabled for this workspace""" + name: str + r"""Name of the workspace""" + slug: str + r"""URL-friendly slug for the workspace""" + updated_at: Nullable[str] + r"""ISO 8601 timestamp of when the workspace was last updated""" + + +class Workspace(BaseModel): + created_at: str + r"""ISO 8601 timestamp of when the workspace was created""" + + created_by: Nullable[str] + r"""User ID of the workspace creator""" + + default_image_model: Nullable[str] + r"""Default image model for this workspace""" + + default_provider_sort: Nullable[str] + r"""Default provider sort preference (price, throughput, latency, exacto)""" + + default_text_model: Nullable[str] + r"""Default text model for this workspace""" + + description: Nullable[str] + r"""Description of the workspace""" + + id: str + r"""Unique identifier for the workspace""" + + is_data_discount_logging_enabled: bool + r"""Whether data discount logging is enabled for this workspace""" + + is_observability_broadcast_enabled: bool + r"""Whether broadcast is enabled for this workspace""" + + is_observability_io_logging_enabled: bool + r"""Whether private logging is enabled for this workspace""" + + name: str + r"""Name of the workspace""" + + slug: str + r"""URL-friendly slug for the workspace""" + + updated_at: Nullable[str] + r"""ISO 8601 timestamp of when the workspace was last updated""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = [ + "created_by", + "default_image_model", + "default_provider_sort", + "default_text_model", + "description", + "updated_at", + ] + 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/workspacemember.py b/src/openrouter/components/workspacemember.py new file mode 100644 index 0000000..9ece878 --- /dev/null +++ b/src/openrouter/components/workspacemember.py @@ -0,0 +1,48 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from openrouter.utils import validate_open_enum +from pydantic.functional_validators import PlainValidator +from typing import Literal, Union +from typing_extensions import Annotated, TypedDict + + +WorkspaceMemberRole = Union[ + Literal[ + "admin", + "member", + ], + UnrecognizedStr, +] +r"""Role of the member in the workspace""" + + +class WorkspaceMemberTypedDict(TypedDict): + created_at: str + r"""ISO 8601 timestamp of when the membership was created""" + id: str + r"""Unique identifier for the workspace membership""" + role: WorkspaceMemberRole + r"""Role of the member in the workspace""" + user_id: str + r"""Clerk user ID of the member""" + workspace_id: str + r"""ID of the workspace""" + + +class WorkspaceMember(BaseModel): + created_at: str + r"""ISO 8601 timestamp of when the membership was created""" + + id: str + r"""Unique identifier for the workspace membership""" + + role: Annotated[WorkspaceMemberRole, PlainValidator(validate_open_enum(False))] + r"""Role of the member in the workspace""" + + user_id: str + r"""Clerk user ID of the member""" + + workspace_id: str + r"""ID of the workspace""" diff --git a/src/openrouter/generations.py b/src/openrouter/generations.py index fddcce7..409e169 100644 --- a/src/openrouter/generations.py +++ b/src/openrouter/generations.py @@ -23,7 +23,7 @@ def get_generation( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetGenerationResponse: + ) -> components.GenerationResponse: r"""Get request & usage metadata for a generation :param id: The generation ID @@ -118,7 +118,7 @@ def get_generation( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(operations.GetGenerationResponse, http_res) + return unmarshal_json_response(components.GenerationResponse, http_res) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res @@ -183,7 +183,7 @@ async def get_generation_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetGenerationResponse: + ) -> components.GenerationResponse: r"""Get request & usage metadata for a generation :param id: The generation ID @@ -278,7 +278,7 @@ async def get_generation_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(operations.GetGenerationResponse, http_res) + return unmarshal_json_response(components.GenerationResponse, http_res) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res @@ -331,3 +331,327 @@ async def get_generation_async( ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_generation_content( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GenerationContentResponse: + r"""Get stored prompt and completion content for a generation + + :param id: The generation ID + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListGenerationContentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request( + method="GET", + path="/generation/content", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListGenerationContentGlobals( + 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, + 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="listGenerationContent", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=[ + "401", + "403", + "404", + "429", + "4XX", + "500", + "502", + "524", + "529", + "5XX", + ], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.GenerationContentResponse, http_res + ) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "524", "application/json"): + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res + ) + raise errors.EdgeNetworkTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "529", "application/json"): + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res + ) + raise errors.ProviderOverloadedResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_generation_content_async( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GenerationContentResponse: + r"""Get stored prompt and completion content for a generation + + :param id: The generation ID + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.ListGenerationContentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request_async( + method="GET", + path="/generation/content", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListGenerationContentGlobals( + 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, + 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="listGenerationContent", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=[ + "401", + "403", + "404", + "429", + "4XX", + "500", + "502", + "524", + "529", + "5XX", + ], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.GenerationContentResponse, http_res + ) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "524", "application/json"): + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res + ) + raise errors.EdgeNetworkTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "529", "application/json"): + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res + ) + raise errors.ProviderOverloadedResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/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..cdb9571 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -6,6 +6,12 @@ import sys if TYPE_CHECKING: + from .bulkaddworkspacemembers import ( + BulkAddWorkspaceMembersGlobals, + BulkAddWorkspaceMembersGlobalsTypedDict, + BulkAddWorkspaceMembersRequest, + BulkAddWorkspaceMembersRequestTypedDict, + ) from .bulkassignkeystoguardrail import ( BulkAssignKeysToGuardrailGlobals, BulkAssignKeysToGuardrailGlobalsTypedDict, @@ -18,6 +24,12 @@ BulkAssignMembersToGuardrailRequest, BulkAssignMembersToGuardrailRequestTypedDict, ) + from .bulkremoveworkspacemembers import ( + BulkRemoveWorkspaceMembersGlobals, + BulkRemoveWorkspaceMembersGlobalsTypedDict, + BulkRemoveWorkspaceMembersRequest, + BulkRemoveWorkspaceMembersRequestTypedDict, + ) from .bulkunassignkeysfromguardrail import ( BulkUnassignKeysFromGuardrailGlobals, BulkUnassignKeysFromGuardrailGlobalsTypedDict, @@ -30,6 +42,19 @@ BulkUnassignMembersFromGuardrailRequest, BulkUnassignMembersFromGuardrailRequestTypedDict, ) + from .createaudiospeech import ( + CreateAudioSpeechGlobals, + CreateAudioSpeechGlobalsTypedDict, + CreateAudioSpeechRequest, + CreateAudioSpeechRequestBody, + CreateAudioSpeechRequestBodyTypedDict, + CreateAudioSpeechRequestTypedDict, + Options, + OptionsTypedDict, + Provider, + ProviderTypedDict, + ResponseFormat, + ) from .createauthkeyscode import ( CreateAuthKeysCodeCodeChallengeMethod, CreateAuthKeysCodeData, @@ -76,6 +101,8 @@ InputUnionTypedDict, Object, ObjectEmbedding, + PromptTokensDetails, + PromptTokensDetailsTypedDict, TypeImageURL, TypeText, ) @@ -132,6 +159,12 @@ CreateVideosRequest, CreateVideosRequestTypedDict, ) + from .createworkspace import ( + CreateWorkspaceGlobals, + CreateWorkspaceGlobalsTypedDict, + CreateWorkspaceRequest, + CreateWorkspaceRequestTypedDict, + ) from .deleteguardrail import ( DeleteGuardrailGlobals, DeleteGuardrailGlobalsTypedDict, @@ -146,6 +179,12 @@ DeleteKeysResponse, DeleteKeysResponseTypedDict, ) + from .deleteworkspace import ( + DeleteWorkspaceGlobals, + DeleteWorkspaceGlobalsTypedDict, + DeleteWorkspaceRequest, + DeleteWorkspaceRequestTypedDict, + ) from .exchangeauthcodeforapikey import ( ExchangeAuthCodeForAPIKeyCodeChallengeMethod, ExchangeAuthCodeForAPIKeyGlobals, @@ -180,15 +219,10 @@ RateLimitTypedDict, ) from .getgeneration import ( - APIType, - GetGenerationData, - GetGenerationDataTypedDict, GetGenerationGlobals, GetGenerationGlobalsTypedDict, GetGenerationRequest, GetGenerationRequestTypedDict, - GetGenerationResponse, - GetGenerationResponseTypedDict, ) from .getguardrail import ( GetGuardrailGlobals, @@ -225,6 +259,12 @@ GetVideosRequest, GetVideosRequestTypedDict, ) + from .getworkspace import ( + GetWorkspaceGlobals, + GetWorkspaceGlobalsTypedDict, + GetWorkspaceRequest, + GetWorkspaceRequestTypedDict, + ) from .list import ( ListData, ListDataTypedDict, @@ -257,6 +297,12 @@ ListEndpointsZdrResponse, ListEndpointsZdrResponseTypedDict, ) + from .listgenerationcontent import ( + ListGenerationContentGlobals, + ListGenerationContentGlobalsTypedDict, + ListGenerationContentRequest, + ListGenerationContentRequestTypedDict, + ) from .listguardrailkeyassignments import ( ListGuardrailKeyAssignmentsGlobals, ListGuardrailKeyAssignmentsGlobalsTypedDict, @@ -348,6 +394,14 @@ ListVideosModelsRequest, ListVideosModelsRequestTypedDict, ) + from .listworkspaces import ( + ListWorkspacesGlobals, + ListWorkspacesGlobalsTypedDict, + ListWorkspacesRequest, + ListWorkspacesRequestTypedDict, + ListWorkspacesResponse, + ListWorkspacesResponseTypedDict, + ) from .sendchatcompletionrequest import ( SendChatCompletionRequestGlobals, SendChatCompletionRequestGlobalsTypedDict, @@ -377,9 +431,18 @@ UpdateKeysResponse, UpdateKeysResponseTypedDict, ) + from .updateworkspace import ( + UpdateWorkspaceGlobals, + UpdateWorkspaceGlobalsTypedDict, + UpdateWorkspaceRequest, + UpdateWorkspaceRequestTypedDict, + ) __all__ = [ - "APIType", + "BulkAddWorkspaceMembersGlobals", + "BulkAddWorkspaceMembersGlobalsTypedDict", + "BulkAddWorkspaceMembersRequest", + "BulkAddWorkspaceMembersRequestTypedDict", "BulkAssignKeysToGuardrailGlobals", "BulkAssignKeysToGuardrailGlobalsTypedDict", "BulkAssignKeysToGuardrailRequest", @@ -388,6 +451,10 @@ "BulkAssignMembersToGuardrailGlobalsTypedDict", "BulkAssignMembersToGuardrailRequest", "BulkAssignMembersToGuardrailRequestTypedDict", + "BulkRemoveWorkspaceMembersGlobals", + "BulkRemoveWorkspaceMembersGlobalsTypedDict", + "BulkRemoveWorkspaceMembersRequest", + "BulkRemoveWorkspaceMembersRequestTypedDict", "BulkUnassignKeysFromGuardrailGlobals", "BulkUnassignKeysFromGuardrailGlobalsTypedDict", "BulkUnassignKeysFromGuardrailRequest", @@ -403,6 +470,12 @@ "ContentText", "ContentTextTypedDict", "ContentTypedDict", + "CreateAudioSpeechGlobals", + "CreateAudioSpeechGlobalsTypedDict", + "CreateAudioSpeechRequest", + "CreateAudioSpeechRequestBody", + "CreateAudioSpeechRequestBodyTypedDict", + "CreateAudioSpeechRequestTypedDict", "CreateAuthKeysCodeCodeChallengeMethod", "CreateAuthKeysCodeData", "CreateAuthKeysCodeDataTypedDict", @@ -467,6 +540,10 @@ "CreateVideosGlobalsTypedDict", "CreateVideosRequest", "CreateVideosRequestTypedDict", + "CreateWorkspaceGlobals", + "CreateWorkspaceGlobalsTypedDict", + "CreateWorkspaceRequest", + "CreateWorkspaceRequestTypedDict", "Datacenter", "DeleteGuardrailGlobals", "DeleteGuardrailGlobalsTypedDict", @@ -478,6 +555,10 @@ "DeleteKeysRequestTypedDict", "DeleteKeysResponse", "DeleteKeysResponseTypedDict", + "DeleteWorkspaceGlobals", + "DeleteWorkspaceGlobalsTypedDict", + "DeleteWorkspaceRequest", + "DeleteWorkspaceRequestTypedDict", "Document", "DocumentTypedDict", "Embedding", @@ -508,14 +589,10 @@ "GetCurrentKeyRequestTypedDict", "GetCurrentKeyResponse", "GetCurrentKeyResponseTypedDict", - "GetGenerationData", - "GetGenerationDataTypedDict", "GetGenerationGlobals", "GetGenerationGlobalsTypedDict", "GetGenerationRequest", "GetGenerationRequestTypedDict", - "GetGenerationResponse", - "GetGenerationResponseTypedDict", "GetGuardrailGlobals", "GetGuardrailGlobalsTypedDict", "GetGuardrailRequest", @@ -540,6 +617,10 @@ "GetVideosGlobalsTypedDict", "GetVideosRequest", "GetVideosRequestTypedDict", + "GetWorkspaceGlobals", + "GetWorkspaceGlobalsTypedDict", + "GetWorkspaceRequest", + "GetWorkspaceRequestTypedDict", "Headquarters", "ImageURL", "ImageURLTypedDict", @@ -565,6 +646,10 @@ "ListEndpointsZdrRequestTypedDict", "ListEndpointsZdrResponse", "ListEndpointsZdrResponseTypedDict", + "ListGenerationContentGlobals", + "ListGenerationContentGlobalsTypedDict", + "ListGenerationContentRequest", + "ListGenerationContentRequestTypedDict", "ListGlobals", "ListGlobalsTypedDict", "ListGuardrailKeyAssignmentsGlobals", @@ -637,10 +722,23 @@ "ListVideosModelsGlobalsTypedDict", "ListVideosModelsRequest", "ListVideosModelsRequestTypedDict", + "ListWorkspacesGlobals", + "ListWorkspacesGlobalsTypedDict", + "ListWorkspacesRequest", + "ListWorkspacesRequestTypedDict", + "ListWorkspacesResponse", + "ListWorkspacesResponseTypedDict", "Object", "ObjectEmbedding", + "Options", + "OptionsTypedDict", + "PromptTokensDetails", + "PromptTokensDetailsTypedDict", + "Provider", + "ProviderTypedDict", "RateLimit", "RateLimitTypedDict", + "ResponseFormat", "Result", "ResultTypedDict", "Role", @@ -669,10 +767,18 @@ "UpdateKeysRequestTypedDict", "UpdateKeysResponse", "UpdateKeysResponseTypedDict", + "UpdateWorkspaceGlobals", + "UpdateWorkspaceGlobalsTypedDict", + "UpdateWorkspaceRequest", + "UpdateWorkspaceRequestTypedDict", "UsageLimitType", ] _dynamic_imports: dict[str, str] = { + "BulkAddWorkspaceMembersGlobals": ".bulkaddworkspacemembers", + "BulkAddWorkspaceMembersGlobalsTypedDict": ".bulkaddworkspacemembers", + "BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembers", + "BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembers", "BulkAssignKeysToGuardrailGlobals": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailGlobalsTypedDict": ".bulkassignkeystoguardrail", "BulkAssignKeysToGuardrailRequest": ".bulkassignkeystoguardrail", @@ -681,6 +787,10 @@ "BulkAssignMembersToGuardrailGlobalsTypedDict": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailRequest": ".bulkassignmemberstoguardrail", "BulkAssignMembersToGuardrailRequestTypedDict": ".bulkassignmemberstoguardrail", + "BulkRemoveWorkspaceMembersGlobals": ".bulkremoveworkspacemembers", + "BulkRemoveWorkspaceMembersGlobalsTypedDict": ".bulkremoveworkspacemembers", + "BulkRemoveWorkspaceMembersRequest": ".bulkremoveworkspacemembers", + "BulkRemoveWorkspaceMembersRequestTypedDict": ".bulkremoveworkspacemembers", "BulkUnassignKeysFromGuardrailGlobals": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailGlobalsTypedDict": ".bulkunassignkeysfromguardrail", "BulkUnassignKeysFromGuardrailRequest": ".bulkunassignkeysfromguardrail", @@ -689,6 +799,17 @@ "BulkUnassignMembersFromGuardrailGlobalsTypedDict": ".bulkunassignmembersfromguardrail", "BulkUnassignMembersFromGuardrailRequest": ".bulkunassignmembersfromguardrail", "BulkUnassignMembersFromGuardrailRequestTypedDict": ".bulkunassignmembersfromguardrail", + "CreateAudioSpeechGlobals": ".createaudiospeech", + "CreateAudioSpeechGlobalsTypedDict": ".createaudiospeech", + "CreateAudioSpeechRequest": ".createaudiospeech", + "CreateAudioSpeechRequestBody": ".createaudiospeech", + "CreateAudioSpeechRequestBodyTypedDict": ".createaudiospeech", + "CreateAudioSpeechRequestTypedDict": ".createaudiospeech", + "Options": ".createaudiospeech", + "OptionsTypedDict": ".createaudiospeech", + "Provider": ".createaudiospeech", + "ProviderTypedDict": ".createaudiospeech", + "ResponseFormat": ".createaudiospeech", "CreateAuthKeysCodeCodeChallengeMethod": ".createauthkeyscode", "CreateAuthKeysCodeData": ".createauthkeyscode", "CreateAuthKeysCodeDataTypedDict": ".createauthkeyscode", @@ -732,6 +853,8 @@ "InputUnionTypedDict": ".createembeddings", "Object": ".createembeddings", "ObjectEmbedding": ".createembeddings", + "PromptTokensDetails": ".createembeddings", + "PromptTokensDetailsTypedDict": ".createembeddings", "TypeImageURL": ".createembeddings", "TypeText": ".createembeddings", "CreateGuardrailGlobals": ".createguardrail", @@ -777,6 +900,10 @@ "CreateVideosGlobalsTypedDict": ".createvideos", "CreateVideosRequest": ".createvideos", "CreateVideosRequestTypedDict": ".createvideos", + "CreateWorkspaceGlobals": ".createworkspace", + "CreateWorkspaceGlobalsTypedDict": ".createworkspace", + "CreateWorkspaceRequest": ".createworkspace", + "CreateWorkspaceRequestTypedDict": ".createworkspace", "DeleteGuardrailGlobals": ".deleteguardrail", "DeleteGuardrailGlobalsTypedDict": ".deleteguardrail", "DeleteGuardrailRequest": ".deleteguardrail", @@ -787,6 +914,10 @@ "DeleteKeysRequestTypedDict": ".deletekeys", "DeleteKeysResponse": ".deletekeys", "DeleteKeysResponseTypedDict": ".deletekeys", + "DeleteWorkspaceGlobals": ".deleteworkspace", + "DeleteWorkspaceGlobalsTypedDict": ".deleteworkspace", + "DeleteWorkspaceRequest": ".deleteworkspace", + "DeleteWorkspaceRequestTypedDict": ".deleteworkspace", "ExchangeAuthCodeForAPIKeyCodeChallengeMethod": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyGlobals": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyGlobalsTypedDict": ".exchangeauthcodeforapikey", @@ -814,15 +945,10 @@ "GetCurrentKeyResponseTypedDict": ".getcurrentkey", "RateLimit": ".getcurrentkey", "RateLimitTypedDict": ".getcurrentkey", - "APIType": ".getgeneration", - "GetGenerationData": ".getgeneration", - "GetGenerationDataTypedDict": ".getgeneration", "GetGenerationGlobals": ".getgeneration", "GetGenerationGlobalsTypedDict": ".getgeneration", "GetGenerationRequest": ".getgeneration", "GetGenerationRequestTypedDict": ".getgeneration", - "GetGenerationResponse": ".getgeneration", - "GetGenerationResponseTypedDict": ".getgeneration", "GetGuardrailGlobals": ".getguardrail", "GetGuardrailGlobalsTypedDict": ".getguardrail", "GetGuardrailRequest": ".getguardrail", @@ -848,6 +974,10 @@ "GetVideosGlobalsTypedDict": ".getvideos", "GetVideosRequest": ".getvideos", "GetVideosRequestTypedDict": ".getvideos", + "GetWorkspaceGlobals": ".getworkspace", + "GetWorkspaceGlobalsTypedDict": ".getworkspace", + "GetWorkspaceRequest": ".getworkspace", + "GetWorkspaceRequestTypedDict": ".getworkspace", "ListData": ".list", "ListDataTypedDict": ".list", "ListGlobals": ".list", @@ -872,6 +1002,10 @@ "ListEndpointsZdrRequestTypedDict": ".listendpointszdr", "ListEndpointsZdrResponse": ".listendpointszdr", "ListEndpointsZdrResponseTypedDict": ".listendpointszdr", + "ListGenerationContentGlobals": ".listgenerationcontent", + "ListGenerationContentGlobalsTypedDict": ".listgenerationcontent", + "ListGenerationContentRequest": ".listgenerationcontent", + "ListGenerationContentRequestTypedDict": ".listgenerationcontent", "ListGuardrailKeyAssignmentsGlobals": ".listguardrailkeyassignments", "ListGuardrailKeyAssignmentsGlobalsTypedDict": ".listguardrailkeyassignments", "ListGuardrailKeyAssignmentsRequest": ".listguardrailkeyassignments", @@ -941,6 +1075,12 @@ "ListVideosModelsGlobalsTypedDict": ".listvideosmodels", "ListVideosModelsRequest": ".listvideosmodels", "ListVideosModelsRequestTypedDict": ".listvideosmodels", + "ListWorkspacesGlobals": ".listworkspaces", + "ListWorkspacesGlobalsTypedDict": ".listworkspaces", + "ListWorkspacesRequest": ".listworkspaces", + "ListWorkspacesRequestTypedDict": ".listworkspaces", + "ListWorkspacesResponse": ".listworkspaces", + "ListWorkspacesResponseTypedDict": ".listworkspaces", "SendChatCompletionRequestGlobals": ".sendchatcompletionrequest", "SendChatCompletionRequestGlobalsTypedDict": ".sendchatcompletionrequest", "SendChatCompletionRequestRequest": ".sendchatcompletionrequest", @@ -964,6 +1104,10 @@ "UpdateKeysRequestTypedDict": ".updatekeys", "UpdateKeysResponse": ".updatekeys", "UpdateKeysResponseTypedDict": ".updatekeys", + "UpdateWorkspaceGlobals": ".updateworkspace", + "UpdateWorkspaceGlobalsTypedDict": ".updateworkspace", + "UpdateWorkspaceRequest": ".updateworkspace", + "UpdateWorkspaceRequestTypedDict": ".updateworkspace", } diff --git a/src/openrouter/operations/bulkaddworkspacemembers.py b/src/openrouter/operations/bulkaddworkspacemembers.py new file mode 100644 index 0000000..32dcfea --- /dev/null +++ b/src/openrouter/operations/bulkaddworkspacemembers.py @@ -0,0 +1,121 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + bulkaddworkspacemembersrequest as components_bulkaddworkspacemembersrequest, +) +from openrouter.types import BaseModel +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BulkAddWorkspaceMembersGlobalsTypedDict(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 BulkAddWorkspaceMembersGlobals(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 BulkAddWorkspaceMembersRequestTypedDict(TypedDict): + id: str + r"""The workspace ID (UUID) or slug""" + bulk_add_workspace_members_request: components_bulkaddworkspacemembersrequest.BulkAddWorkspaceMembersRequestTypedDict + 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 BulkAddWorkspaceMembersRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The workspace ID (UUID) or slug""" + + bulk_add_workspace_members_request: Annotated[ + components_bulkaddworkspacemembersrequest.BulkAddWorkspaceMembersRequest, + 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/bulkremoveworkspacemembers.py b/src/openrouter/operations/bulkremoveworkspacemembers.py new file mode 100644 index 0000000..fe0ebfd --- /dev/null +++ b/src/openrouter/operations/bulkremoveworkspacemembers.py @@ -0,0 +1,121 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + bulkremoveworkspacemembersrequest as components_bulkremoveworkspacemembersrequest, +) +from openrouter.types import BaseModel +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BulkRemoveWorkspaceMembersGlobalsTypedDict(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 BulkRemoveWorkspaceMembersGlobals(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 BulkRemoveWorkspaceMembersRequestTypedDict(TypedDict): + id: str + r"""The workspace ID (UUID) or slug""" + bulk_remove_workspace_members_request: components_bulkremoveworkspacemembersrequest.BulkRemoveWorkspaceMembersRequestTypedDict + 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 BulkRemoveWorkspaceMembersRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The workspace ID (UUID) or slug""" + + bulk_remove_workspace_members_request: Annotated[ + components_bulkremoveworkspacemembersrequest.BulkRemoveWorkspaceMembersRequest, + 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/createaudiospeech.py b/src/openrouter/operations/createaudiospeech.py new file mode 100644 index 0000000..511f57c --- /dev/null +++ b/src/openrouter/operations/createaudiospeech.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 CreateAudioSpeechGlobalsTypedDict(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 CreateAudioSpeechGlobals(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 CreateAudioSpeechRequestBodyTypedDict(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-specific).""" + 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 CreateAudioSpeechRequestBody(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-specific).""" + + 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 CreateAudioSpeechRequestTypedDict(TypedDict): + request_body: CreateAudioSpeechRequestBodyTypedDict + 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 CreateAudioSpeechRequest(BaseModel): + request_body: Annotated[ + CreateAudioSpeechRequestBody, + 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/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/createworkspace.py b/src/openrouter/operations/createworkspace.py new file mode 100644 index 0000000..1757be8 --- /dev/null +++ b/src/openrouter/operations/createworkspace.py @@ -0,0 +1,111 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + createworkspacerequest as components_createworkspacerequest, +) +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateWorkspaceGlobalsTypedDict(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 CreateWorkspaceGlobals(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 CreateWorkspaceRequestTypedDict(TypedDict): + create_workspace_request: ( + components_createworkspacerequest.CreateWorkspaceRequestTypedDict + ) + 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 CreateWorkspaceRequest(BaseModel): + create_workspace_request: Annotated[ + components_createworkspacerequest.CreateWorkspaceRequest, + 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/deleteworkspace.py b/src/openrouter/operations/deleteworkspace.py new file mode 100644 index 0000000..fbfef88 --- /dev/null +++ b/src/openrouter/operations/deleteworkspace.py @@ -0,0 +1,107 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteWorkspaceGlobalsTypedDict(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 DeleteWorkspaceGlobals(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 DeleteWorkspaceRequestTypedDict(TypedDict): + id: str + r"""The workspace ID (UUID) or slug""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteWorkspaceRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The workspace ID (UUID) or slug""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ diff --git a/src/openrouter/operations/getgeneration.py b/src/openrouter/operations/getgeneration.py index 94dfcb7..bf21d05 100644 --- a/src/openrouter/operations/getgeneration.py +++ b/src/openrouter/operations/getgeneration.py @@ -1,25 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.components import providerresponse as components_providerresponse -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) -from openrouter.utils import ( - FieldMetadata, - HeaderMetadata, - QueryParamMetadata, - validate_open_enum, -) +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata import pydantic -from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing import List, Literal, Optional, Union +from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -120,292 +105,3 @@ class GetGenerationRequest(BaseModel): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ - - -APIType = Union[ - Literal[ - "completions", - "embeddings", - "rerank", - "video", - ], - UnrecognizedStr, -] -r"""Type of API used for the generation""" - - -class GetGenerationDataTypedDict(TypedDict): - r"""Generation data""" - - api_type: Nullable[APIType] - r"""Type of API used for the generation""" - app_id: Nullable[int] - r"""ID of the app that made the request""" - cache_discount: Nullable[float] - r"""Discount applied due to caching""" - cancelled: Nullable[bool] - r"""Whether the generation was cancelled""" - created_at: str - r"""ISO 8601 timestamp of when the generation was created""" - external_user: Nullable[str] - r"""External user identifier""" - finish_reason: Nullable[str] - r"""Reason the generation finished""" - generation_time: Nullable[float] - r"""Time taken for generation in milliseconds""" - http_referer: Nullable[str] - r"""Referer header from the request""" - id: str - r"""Unique identifier for the generation""" - is_byok: bool - r"""Whether this used bring-your-own-key""" - latency: Nullable[float] - r"""Total latency in milliseconds""" - model: str - r"""Model used for the generation""" - moderation_latency: Nullable[float] - r"""Moderation latency in milliseconds""" - native_finish_reason: Nullable[str] - r"""Native finish reason as reported by provider""" - native_tokens_cached: Nullable[int] - r"""Native cached tokens as reported by provider""" - native_tokens_completion: Nullable[int] - r"""Native completion tokens as reported by provider""" - native_tokens_completion_images: Nullable[int] - r"""Native completion image tokens as reported by provider""" - native_tokens_prompt: Nullable[int] - r"""Native prompt tokens as reported by provider""" - native_tokens_reasoning: Nullable[int] - r"""Native reasoning tokens as reported by provider""" - num_input_audio_prompt: Nullable[int] - r"""Number of audio inputs in the prompt""" - num_media_completion: Nullable[int] - r"""Number of media items in the completion""" - num_media_prompt: Nullable[int] - r"""Number of media items in the prompt""" - num_search_results: Nullable[int] - r"""Number of search results included""" - origin: str - r"""Origin URL of the request""" - provider_name: Nullable[str] - r"""Name of the provider that served the request""" - provider_responses: Nullable[ - List[components_providerresponse.ProviderResponseTypedDict] - ] - r"""List of provider responses for this generation, including fallback attempts""" - router: Nullable[str] - r"""Router used for the request (e.g., openrouter/auto)""" - streamed: Nullable[bool] - r"""Whether the response was streamed""" - tokens_completion: Nullable[int] - r"""Number of tokens in the completion""" - tokens_prompt: Nullable[int] - r"""Number of tokens in the prompt""" - total_cost: float - r"""Total cost of the generation in USD""" - upstream_id: Nullable[str] - r"""Upstream provider's identifier for this generation""" - upstream_inference_cost: Nullable[float] - r"""Cost charged by the upstream provider""" - usage: float - r"""Usage amount in USD""" - user_agent: Nullable[str] - r"""User-Agent header from the request""" - request_id: NotRequired[Nullable[str]] - r"""Unique identifier grouping all generations from a single API request""" - session_id: NotRequired[Nullable[str]] - r"""Session identifier grouping multiple generations in the same session""" - - -class GetGenerationData(BaseModel): - r"""Generation data""" - - api_type: Annotated[Nullable[APIType], PlainValidator(validate_open_enum(False))] - r"""Type of API used for the generation""" - - app_id: Nullable[int] - r"""ID of the app that made the request""" - - cache_discount: Nullable[float] - r"""Discount applied due to caching""" - - cancelled: Nullable[bool] - r"""Whether the generation was cancelled""" - - created_at: str - r"""ISO 8601 timestamp of when the generation was created""" - - external_user: Nullable[str] - r"""External user identifier""" - - finish_reason: Nullable[str] - r"""Reason the generation finished""" - - generation_time: Nullable[float] - r"""Time taken for generation in milliseconds""" - - http_referer: Nullable[str] - r"""Referer header from the request""" - - id: str - r"""Unique identifier for the generation""" - - is_byok: bool - r"""Whether this used bring-your-own-key""" - - latency: Nullable[float] - r"""Total latency in milliseconds""" - - model: str - r"""Model used for the generation""" - - moderation_latency: Nullable[float] - r"""Moderation latency in milliseconds""" - - native_finish_reason: Nullable[str] - r"""Native finish reason as reported by provider""" - - native_tokens_cached: Nullable[int] - r"""Native cached tokens as reported by provider""" - - native_tokens_completion: Nullable[int] - r"""Native completion tokens as reported by provider""" - - native_tokens_completion_images: Nullable[int] - r"""Native completion image tokens as reported by provider""" - - native_tokens_prompt: Nullable[int] - r"""Native prompt tokens as reported by provider""" - - native_tokens_reasoning: Nullable[int] - r"""Native reasoning tokens as reported by provider""" - - num_input_audio_prompt: Nullable[int] - r"""Number of audio inputs in the prompt""" - - num_media_completion: Nullable[int] - r"""Number of media items in the completion""" - - num_media_prompt: Nullable[int] - r"""Number of media items in the prompt""" - - num_search_results: Nullable[int] - r"""Number of search results included""" - - origin: str - r"""Origin URL of the request""" - - provider_name: Nullable[str] - r"""Name of the provider that served the request""" - - provider_responses: Nullable[List[components_providerresponse.ProviderResponse]] - r"""List of provider responses for this generation, including fallback attempts""" - - router: Nullable[str] - r"""Router used for the request (e.g., openrouter/auto)""" - - streamed: Nullable[bool] - r"""Whether the response was streamed""" - - tokens_completion: Nullable[int] - r"""Number of tokens in the completion""" - - tokens_prompt: Nullable[int] - r"""Number of tokens in the prompt""" - - total_cost: float - r"""Total cost of the generation in USD""" - - upstream_id: Nullable[str] - r"""Upstream provider's identifier for this generation""" - - upstream_inference_cost: Nullable[float] - r"""Cost charged by the upstream provider""" - - usage: float - r"""Usage amount in USD""" - - user_agent: Nullable[str] - r"""User-Agent header from the request""" - - request_id: OptionalNullable[str] = UNSET - r"""Unique identifier grouping all generations from a single API request""" - - session_id: OptionalNullable[str] = UNSET - r"""Session identifier grouping multiple generations in the same session""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["request_id", "session_id"] - nullable_fields = [ - "api_type", - "app_id", - "cache_discount", - "cancelled", - "external_user", - "finish_reason", - "generation_time", - "http_referer", - "latency", - "moderation_latency", - "native_finish_reason", - "native_tokens_cached", - "native_tokens_completion", - "native_tokens_completion_images", - "native_tokens_prompt", - "native_tokens_reasoning", - "num_input_audio_prompt", - "num_media_completion", - "num_media_prompt", - "num_search_results", - "provider_name", - "provider_responses", - "request_id", - "router", - "session_id", - "streamed", - "tokens_completion", - "tokens_prompt", - "upstream_id", - "upstream_inference_cost", - "user_agent", - ] - 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 - - -class GetGenerationResponseTypedDict(TypedDict): - r"""Generation response""" - - data: GetGenerationDataTypedDict - r"""Generation data""" - - -class GetGenerationResponse(BaseModel): - r"""Generation response""" - - data: GetGenerationData - r"""Generation data""" 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/getworkspace.py b/src/openrouter/operations/getworkspace.py new file mode 100644 index 0000000..f4d279e --- /dev/null +++ b/src/openrouter/operations/getworkspace.py @@ -0,0 +1,107 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetWorkspaceGlobalsTypedDict(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 GetWorkspaceGlobals(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 GetWorkspaceRequestTypedDict(TypedDict): + id: str + r"""The workspace ID (UUID) or slug""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetWorkspaceRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The workspace ID (UUID) or slug""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ 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/listgenerationcontent.py b/src/openrouter/operations/listgenerationcontent.py new file mode 100644 index 0000000..8d19500 --- /dev/null +++ b/src/openrouter/operations/listgenerationcontent.py @@ -0,0 +1,107 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListGenerationContentGlobalsTypedDict(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 ListGenerationContentGlobals(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 ListGenerationContentRequestTypedDict(TypedDict): + id: str + r"""The generation ID""" + 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 ListGenerationContentRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""The generation ID""" + + 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/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/listworkspaces.py b/src/openrouter/operations/listworkspaces.py new file mode 100644 index 0000000..236dc18 --- /dev/null +++ b/src/openrouter/operations/listworkspaces.py @@ -0,0 +1,132 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + listworkspacesresponse as components_listworkspacesresponse, +) +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata +import pydantic +from typing import Awaitable, Callable, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListWorkspacesGlobalsTypedDict(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 ListWorkspacesGlobals(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 ListWorkspacesRequestTypedDict(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. + + """ + offset: NotRequired[int] + r"""Number of records to skip for pagination""" + limit: NotRequired[int] + r"""Maximum number of records to return (max 100)""" + + +class ListWorkspacesRequest(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. + + """ + + offset: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Number of records to skip for pagination""" + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of records to return (max 100)""" + + +class ListWorkspacesResponseTypedDict(TypedDict): + result: components_listworkspacesresponse.ListWorkspacesResponseTypedDict + + +class ListWorkspacesResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListWorkspacesResponse]], + Callable[[], Awaitable[Optional[ListWorkspacesResponse]]], + ] + + result: components_listworkspacesresponse.ListWorkspacesResponse 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/operations/updateworkspace.py b/src/openrouter/operations/updateworkspace.py new file mode 100644 index 0000000..4ab7929 --- /dev/null +++ b/src/openrouter/operations/updateworkspace.py @@ -0,0 +1,123 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + updateworkspacerequest as components_updateworkspacerequest, +) +from openrouter.types import BaseModel +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateWorkspaceGlobalsTypedDict(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 UpdateWorkspaceGlobals(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 UpdateWorkspaceRequestTypedDict(TypedDict): + id: str + r"""The workspace ID (UUID) or slug""" + update_workspace_request: ( + components_updateworkspacerequest.UpdateWorkspaceRequestTypedDict + ) + 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 UpdateWorkspaceRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The workspace ID (UUID) or slug""" + + update_workspace_request: Annotated[ + components_updateworkspacerequest.UpdateWorkspaceRequest, + 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/sdk.py b/src/openrouter/sdk.py index 43d1636..580ff52 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -30,7 +30,9 @@ 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 + from openrouter.workspaces import Workspaces class OpenRouter(BaseSDK): @@ -40,6 +42,8 @@ class OpenRouter(BaseSDK): analytics: "Analytics" r"""Analytics and usage endpoints""" + tts: "Tts" + r"""Text-to-speech endpoints""" o_auth: "OAuth" r"""OAuth authentication endpoints""" chat: "Chat" @@ -66,8 +70,11 @@ class OpenRouter(BaseSDK): beta: "Beta" video_generation: "VideoGeneration" r"""Video Generation endpoints""" + workspaces: "Workspaces" + r"""Workspaces endpoints""" _sub_sdk_map = { "analytics": ("openrouter.analytics", "Analytics"), + "tts": ("openrouter.tts", "Tts"), "o_auth": ("openrouter.oauth", "OAuth"), "chat": ("openrouter.chat", "Chat"), "credits": ("openrouter.credits", "Credits"), @@ -82,6 +89,7 @@ class OpenRouter(BaseSDK): "rerank": ("openrouter.rerank", "Rerank"), "beta": ("openrouter.beta", "Beta"), "video_generation": ("openrouter.video_generation", "VideoGeneration"), + "workspaces": ("openrouter.workspaces", "Workspaces"), } def __init__( diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py new file mode 100644 index 0000000..4a8f39d --- /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 (provider-specific). + :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.CreateAudioSpeechRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + request_body=operations.CreateAudioSpeechRequestBody( + 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="/audio/speech", + 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.CreateAudioSpeechGlobals( + 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.CreateAudioSpeechRequestBody, + ), + 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="createAudioSpeech", + 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 (provider-specific). + :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.CreateAudioSpeechRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + request_body=operations.CreateAudioSpeechRequestBody( + 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="/audio/speech", + 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.CreateAudioSpeechGlobals( + 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.CreateAudioSpeechRequestBody, + ), + 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="createAudioSpeech", + 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/src/openrouter/workspaces.py b/src/openrouter/workspaces.py new file mode 100644 index 0000000..5d6e6ce --- /dev/null +++ b/src/openrouter/workspaces.py @@ -0,0 +1,2119 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from jsonpath import JSONPath +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, Awaitable, Dict, List, Mapping, Optional, Union + + +class Workspaces(BaseSDK): + r"""Workspaces endpoints""" + + def list( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListWorkspacesResponse]: + r"""List workspaces + + List all workspaces for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :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 offset: Number of records to skip for pagination + :param limit: Maximum number of records to return (max 100) + :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.ListWorkspacesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + ) + + req = self._build_request( + method="GET", + path="/workspaces", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListWorkspacesGlobals( + 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, + 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="listWorkspaces", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.ListWorkspacesResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if not request.offset is None else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit = request.limit if not request.limit is None else 0 + if len(results[0]) < limit: + return None + next_offset = offset + len(results[0]) + + return self.list( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListWorkspacesResponse( + result=unmarshal_json_response( + components.ListWorkspacesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[operations.ListWorkspacesResponse]: + r"""List workspaces + + List all workspaces for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :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 offset: Number of records to skip for pagination + :param limit: Maximum number of records to return (max 100) + :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.ListWorkspacesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + ) + + req = self._build_request_async( + method="GET", + path="/workspaces", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListWorkspacesGlobals( + 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, + 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="listWorkspaces", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + def next_func() -> Awaitable[Optional[operations.ListWorkspacesResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if not request.offset is None else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit = request.limit if not request.limit is None else 0 + if len(results[0]) < limit: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_async( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListWorkspacesResponse( + result=unmarshal_json_response( + components.ListWorkspacesResponse, http_res + ), + next=next_func, + ) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def create( + self, + *, + name: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + default_image_model: OptionalNullable[str] = UNSET, + default_provider_sort: OptionalNullable[str] = UNSET, + default_text_model: OptionalNullable[str] = UNSET, + description: OptionalNullable[str] = UNSET, + is_data_discount_logging_enabled: Optional[bool] = None, + is_observability_broadcast_enabled: Optional[bool] = None, + is_observability_io_logging_enabled: Optional[bool] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.CreateWorkspaceResponse: + r"""Create a workspace + + Create a new workspace for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param name: Name for the new workspace + :param slug: URL-friendly slug (lowercase alphanumeric and hyphens only) + :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 default_image_model: Default image model for this workspace + :param default_provider_sort: Default provider sort preference (price, throughput, latency, exacto) + :param default_text_model: Default text model for this workspace + :param description: Description of the workspace + :param is_data_discount_logging_enabled: Whether data discount logging is enabled + :param is_observability_broadcast_enabled: Whether broadcast is enabled + :param is_observability_io_logging_enabled: Whether private logging is enabled + :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.CreateWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_workspace_request=components.CreateWorkspaceRequest( + default_image_model=default_image_model, + default_provider_sort=default_provider_sort, + default_text_model=default_text_model, + description=description, + is_data_discount_logging_enabled=is_data_discount_logging_enabled, + is_observability_broadcast_enabled=is_observability_broadcast_enabled, + is_observability_io_logging_enabled=is_observability_io_logging_enabled, + name=name, + slug=slug, + ), + ) + + req = self._build_request( + method="POST", + path="/workspaces", + 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/json", + http_headers=http_headers, + _globals=operations.CreateWorkspaceGlobals( + 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.create_workspace_request, + False, + False, + "json", + components.CreateWorkspaceRequest, + ), + 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="createWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response(components.CreateWorkspaceResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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 + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def create_async( + self, + *, + name: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + default_image_model: OptionalNullable[str] = UNSET, + default_provider_sort: OptionalNullable[str] = UNSET, + default_text_model: OptionalNullable[str] = UNSET, + description: OptionalNullable[str] = UNSET, + is_data_discount_logging_enabled: Optional[bool] = None, + is_observability_broadcast_enabled: Optional[bool] = None, + is_observability_io_logging_enabled: Optional[bool] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.CreateWorkspaceResponse: + r"""Create a workspace + + Create a new workspace for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param name: Name for the new workspace + :param slug: URL-friendly slug (lowercase alphanumeric and hyphens only) + :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 default_image_model: Default image model for this workspace + :param default_provider_sort: Default provider sort preference (price, throughput, latency, exacto) + :param default_text_model: Default text model for this workspace + :param description: Description of the workspace + :param is_data_discount_logging_enabled: Whether data discount logging is enabled + :param is_observability_broadcast_enabled: Whether broadcast is enabled + :param is_observability_io_logging_enabled: Whether private logging is enabled + :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.CreateWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + create_workspace_request=components.CreateWorkspaceRequest( + default_image_model=default_image_model, + default_provider_sort=default_provider_sort, + default_text_model=default_text_model, + description=description, + is_data_discount_logging_enabled=is_data_discount_logging_enabled, + is_observability_broadcast_enabled=is_observability_broadcast_enabled, + is_observability_io_logging_enabled=is_observability_io_logging_enabled, + name=name, + slug=slug, + ), + ) + + req = self._build_request_async( + method="POST", + path="/workspaces", + 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/json", + http_headers=http_headers, + _globals=operations.CreateWorkspaceGlobals( + 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.create_workspace_request, + False, + False, + "json", + components.CreateWorkspaceRequest, + ), + 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="createWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return unmarshal_json_response(components.CreateWorkspaceResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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 + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def delete( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteWorkspaceResponse: + r"""Delete a workspace + + Delete an existing workspace. The default workspace cannot be deleted. Workspaces with active API keys cannot be deleted. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request( + method="DELETE", + path="/workspaces/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteWorkspaceGlobals( + 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, + 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="deleteWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.DeleteWorkspaceResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def delete_async( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.DeleteWorkspaceResponse: + r"""Delete a workspace + + Delete an existing workspace. The default workspace cannot be deleted. Workspaces with active API keys cannot be deleted. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.DeleteWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request_async( + method="DELETE", + path="/workspaces/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteWorkspaceGlobals( + 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, + 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="deleteWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.DeleteWorkspaceResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GetWorkspaceResponse: + r"""Get a workspace + + Get a single workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request( + method="GET", + path="/workspaces/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetWorkspaceGlobals( + 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, + 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="getWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.GetWorkspaceResponse, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_async( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.GetWorkspaceResponse: + r"""Get a workspace + + Get a single workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + ) + + req = self._build_request_async( + method="GET", + path="/workspaces/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetWorkspaceGlobals( + 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, + 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="getWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.GetWorkspaceResponse, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def update( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + default_image_model: OptionalNullable[str] = UNSET, + default_provider_sort: OptionalNullable[str] = UNSET, + default_text_model: OptionalNullable[str] = UNSET, + description: OptionalNullable[str] = UNSET, + is_data_discount_logging_enabled: Optional[bool] = None, + is_observability_broadcast_enabled: Optional[bool] = None, + is_observability_io_logging_enabled: Optional[bool] = None, + name: Optional[str] = None, + slug: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.UpdateWorkspaceResponse: + r"""Update a workspace + + Update an existing workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param default_image_model: Default image model for this workspace + :param default_provider_sort: Default provider sort preference (price, throughput, latency, exacto) + :param default_text_model: Default text model for this workspace + :param description: New description for the workspace + :param is_data_discount_logging_enabled: Whether data discount logging is enabled + :param is_observability_broadcast_enabled: Whether broadcast is enabled + :param is_observability_io_logging_enabled: Whether private logging is enabled + :param name: New name for the workspace + :param slug: New URL-friendly slug + :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.UpdateWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_workspace_request=components.UpdateWorkspaceRequest( + default_image_model=default_image_model, + default_provider_sort=default_provider_sort, + default_text_model=default_text_model, + description=description, + is_data_discount_logging_enabled=is_data_discount_logging_enabled, + is_observability_broadcast_enabled=is_observability_broadcast_enabled, + is_observability_io_logging_enabled=is_observability_io_logging_enabled, + name=name, + slug=slug, + ), + ) + + req = self._build_request( + method="PATCH", + path="/workspaces/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateWorkspaceGlobals( + 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.update_workspace_request, + False, + False, + "json", + components.UpdateWorkspaceRequest, + ), + 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="updateWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.UpdateWorkspaceResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def update_async( + self, + *, + id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + default_image_model: OptionalNullable[str] = UNSET, + default_provider_sort: OptionalNullable[str] = UNSET, + default_text_model: OptionalNullable[str] = UNSET, + description: OptionalNullable[str] = UNSET, + is_data_discount_logging_enabled: Optional[bool] = None, + is_observability_broadcast_enabled: Optional[bool] = None, + is_observability_io_logging_enabled: Optional[bool] = None, + name: Optional[str] = None, + slug: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.UpdateWorkspaceResponse: + r"""Update a workspace + + Update an existing workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param default_image_model: Default image model for this workspace + :param default_provider_sort: Default provider sort preference (price, throughput, latency, exacto) + :param default_text_model: Default text model for this workspace + :param description: New description for the workspace + :param is_data_discount_logging_enabled: Whether data discount logging is enabled + :param is_observability_broadcast_enabled: Whether broadcast is enabled + :param is_observability_io_logging_enabled: Whether private logging is enabled + :param name: New name for the workspace + :param slug: New URL-friendly slug + :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.UpdateWorkspaceRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + update_workspace_request=components.UpdateWorkspaceRequest( + default_image_model=default_image_model, + default_provider_sort=default_provider_sort, + default_text_model=default_text_model, + description=description, + is_data_discount_logging_enabled=is_data_discount_logging_enabled, + is_observability_broadcast_enabled=is_observability_broadcast_enabled, + is_observability_io_logging_enabled=is_observability_io_logging_enabled, + name=name, + slug=slug, + ), + ) + + req = self._build_request_async( + method="PATCH", + path="/workspaces/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateWorkspaceGlobals( + 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.update_workspace_request, + False, + False, + "json", + components.UpdateWorkspaceRequest, + ), + 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="updateWorkspace", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.UpdateWorkspaceResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def bulk_add_members( + self, + *, + id: str, + user_ids: List[str], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BulkAddWorkspaceMembersResponse: + r"""Bulk add members to a workspace + + Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param user_ids: List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.BulkAddWorkspaceMembersRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + bulk_add_workspace_members_request=components.BulkAddWorkspaceMembersRequest( + user_ids=user_ids, + ), + ) + + req = self._build_request( + method="POST", + path="/workspaces/{id}/members/add", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.BulkAddWorkspaceMembersGlobals( + 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.bulk_add_workspace_members_request, + False, + False, + "json", + components.BulkAddWorkspaceMembersRequest, + ), + 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="bulkAddWorkspaceMembers", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BulkAddWorkspaceMembersResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def bulk_add_members_async( + self, + *, + id: str, + user_ids: List[str], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BulkAddWorkspaceMembersResponse: + r"""Bulk add members to a workspace + + Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param user_ids: List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization. + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.BulkAddWorkspaceMembersRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + bulk_add_workspace_members_request=components.BulkAddWorkspaceMembersRequest( + user_ids=user_ids, + ), + ) + + req = self._build_request_async( + method="POST", + path="/workspaces/{id}/members/add", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.BulkAddWorkspaceMembersGlobals( + 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.bulk_add_workspace_members_request, + False, + False, + "json", + components.BulkAddWorkspaceMembersRequest, + ), + 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="bulkAddWorkspaceMembers", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BulkAddWorkspaceMembersResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def bulk_remove_members( + self, + *, + id: str, + user_ids: List[str], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BulkRemoveWorkspaceMembersResponse: + r"""Bulk remove members from a workspace + + Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param user_ids: List of user IDs to remove from the workspace + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.BulkRemoveWorkspaceMembersRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + bulk_remove_workspace_members_request=components.BulkRemoveWorkspaceMembersRequest( + user_ids=user_ids, + ), + ) + + req = self._build_request( + method="POST", + path="/workspaces/{id}/members/remove", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.BulkRemoveWorkspaceMembersGlobals( + 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.bulk_remove_workspace_members_request, + False, + False, + "json", + components.BulkRemoveWorkspaceMembersRequest, + ), + 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="bulkRemoveWorkspaceMembers", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BulkRemoveWorkspaceMembersResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def bulk_remove_members_async( + self, + *, + id: str, + user_ids: List[str], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BulkRemoveWorkspaceMembersResponse: + r"""Bulk remove members from a workspace + + Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param id: The workspace ID (UUID) or slug + :param user_ids: List of user IDs to remove from the workspace + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.BulkRemoveWorkspaceMembersRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + id=id, + bulk_remove_workspace_members_request=components.BulkRemoveWorkspaceMembersRequest( + user_ids=user_ids, + ), + ) + + req = self._build_request_async( + method="POST", + path="/workspaces/{id}/members/remove", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.BulkRemoveWorkspaceMembersGlobals( + 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.bulk_remove_workspace_members_request, + False, + False, + "json", + components.BulkRemoveWorkspaceMembersRequest, + ), + 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="bulkRemoveWorkspaceMembers", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.BulkRemoveWorkspaceMembersResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + 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, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/uv.lock b/uv.lock index 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" },