diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 04f8f75..efa65e9 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 5f7e8ca6bc0d259c803c0a9f1d076595 + docChecksum: 3b9e40b07bc5d20e439de7df0ee35242 docVersion: 1.0.0 speakeasyVersion: 1.680.0 generationVersion: 2.788.4 - releaseVersion: 0.9.2 - configChecksum: f906b25652bcc83a52d1c74e5018c02e + releaseVersion: 0.10.0 + configChecksum: 00a97c5bcdbddf7e591c0a1d7a45e98e repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 01e70c93-1c74-4268-a847-77bcb8354f3c - pristine_commit_hash: 27acb9e68a5dcb4165451c0c99cccb6828dc0f0f - pristine_tree_hash: b01e1f8716abc3b4a335b139a12550ef1c267853 + generation_id: fe423d36-a9e1-48e2-961b-6c1823ed53a7 + pristine_commit_hash: 3f2320e4f294cb653708f2608f75571a65fd67ed + pristine_tree_hash: e136e22d1018c2dc7a1274bae71b6e60ed6e7812 features: python: acceptHeaders: 3.0.0 @@ -38,6 +38,7 @@ features: ignores: 3.0.1 methodArguments: 1.0.2 methodSecurity: 3.0.1 + multipartFileContentType: 1.0.0 nameOverrides: 3.0.1 nullables: 1.0.1 openEnums: 1.0.1 @@ -49,6 +50,7 @@ features: serverEventsSentinels: 0.1.0 serverIDs: 3.0.0 unions: 3.1.1 + uploadStreams: 1.0.0 trackedFiles: .devcontainer/README.md: id: b170c0f184ac @@ -74,6 +76,10 @@ trackedFiles: id: 3aed33ce6e6f last_write_checksum: sha1:d70160e42e737f03bca79873bae8e91ae2b585d1 pristine_git_object: 9c1506b8f539140db04b239d7a84d8b599747932 + docs/components/aabenchmarkentry.md: + id: f90294cbb4a3 + last_write_checksum: sha1:86a3b23d00014cdee0eea44dcdbaf965117a6e35 + pristine_git_object: f4d05c6ca2c90f231fc59abd56b907a02fcd3dc1 docs/components/action.md: id: 6b3978ee918f last_write_checksum: sha1:9d4cd420c5cd5ea25837e2c6db447d5ecb600b7a @@ -104,8 +110,8 @@ trackedFiles: pristine_git_object: 3e901718f78569d175db37fb6bdbc84733dd8d61 docs/components/advisornestedtool.md: id: afec78271fac - last_write_checksum: sha1:b9df7445a86df92246cf1c01149fd2faa0103736 - pristine_git_object: 1f7ab5357fffae77442b6cfd9ba2681cf1b03555 + last_write_checksum: sha1:ca6504064c6d1e18c50d38edb7ee9ab8749caa06 + pristine_git_object: d830783b9c4bd36787ad3532b11a2b8a297d01c7 docs/components/advisorreasoning.md: id: a6a4f2f081cf last_write_checksum: sha1:44835b03d48275fbd0ee12badc399462037a2f12 @@ -116,8 +122,8 @@ trackedFiles: pristine_git_object: 70c97a14813005cfafcc7e2d132921d3e95fb7bc docs/components/advisorservertoolconfig.md: id: 9a630ec9486f - last_write_checksum: sha1:2282846da6517a7d1091d89a04450a4c7176479f - pristine_git_object: ce16435a04c1b3121c65334056d1576769aa1a3d + last_write_checksum: sha1:b01e3db43dd70ddca3a7bb093b99f5b14c669835 + pristine_git_object: 82c8b8f26dd010e9502b80219619f2c7f12dff95 docs/components/advisorservertoolopenrouter.md: id: e66ed24a0e81 last_write_checksum: sha1:20e9d09f8361ef7b1ffced630df13d9deebb2f98 @@ -582,6 +588,58 @@ trackedFiles: id: e6ed8eddbb24 last_write_checksum: sha1:4b8db8f915f099b89698c93a9dd86fdde32f0d29 pristine_git_object: 39e37fdadaf320fbd499c345f02b0f248331fa98 + docs/components/benchmarkpricing.md: + id: 1773696fd2fb + last_write_checksum: sha1:335d20d71d0225a7b8b3ef222f2433571966fe03 + pristine_git_object: 335c8e92b6ef64040c2d5d774f8bba265bf98f83 + docs/components/benchmarksaaitem.md: + id: a51a6ebb2653 + last_write_checksum: sha1:5f32825973fbdb3a88d6ae603d9f342befa17ab8 + pristine_git_object: 1800438874a9224105018148d4fb38ec29aed892 + docs/components/benchmarksaameta.md: + id: 66665e5cc0cb + last_write_checksum: sha1:4015be7186e032526ac628e4e57420410ea86bc7 + pristine_git_object: 92f3db8c60f8ef464075623dc24a6e20c74d1750 + docs/components/benchmarksaametasource.md: + id: 2aac90c13609 + last_write_checksum: sha1:218130854d26c4067c6ced560ec4c1393e144174 + pristine_git_object: 9917ffc03124110df323fa88d5a5026145797eb1 + docs/components/benchmarksaametasourceurl.md: + id: 5775371c2220 + last_write_checksum: sha1:bfd9917a494e65d372cd3900f5178e37af0580ed + pristine_git_object: 79522841c570e593e332ce71c07eb81b23abc230 + docs/components/benchmarksaametaversion.md: + id: 7ff3469b31de + last_write_checksum: sha1:e26c09306146670ea424451b18297b96258d29c2 + pristine_git_object: 9649dd143a7a7d927563c2e5d66d899d4bd4a23d + docs/components/benchmarksaaresponse.md: + id: 6a2090513e37 + last_write_checksum: sha1:139fd98981f96576c7ef677d15536be622e5b8fe + pristine_git_object: a170b12c3bd7816ed14a2bcf823ad518bb5b10ff + docs/components/benchmarksdaitem.md: + id: a921b9b462b2 + last_write_checksum: sha1:51b045b1525937e43d122e7e944e305393957000 + pristine_git_object: 6ef28c047743208fd9694ff3f5fb6797ed2bec39 + docs/components/benchmarksdameta.md: + id: 396a3643066d + last_write_checksum: sha1:33c7867659944bd15b83c41170aa6a2cf6b18726 + pristine_git_object: 71b87b1e04918ab51469ac90868385b723147734 + docs/components/benchmarksdametasource.md: + id: 2846adb831b8 + last_write_checksum: sha1:c6a9d05b62027e40294664cd4d60eb54eb638ec4 + pristine_git_object: 5c7aa0e34088aba458f90c5ef441b84b6cc3201e + docs/components/benchmarksdametasourceurl.md: + id: 6991d2000ec5 + last_write_checksum: sha1:10a1e0d6a64580aa4443b35ebd44497fd6720c15 + pristine_git_object: 0460bd8b38e93aaf2dfee47a96b9e46ef2e3b0d0 + docs/components/benchmarksdametaversion.md: + id: da86e114b298 + last_write_checksum: sha1:e36c13df0304f6803bae21d80dc888d29c281634 + pristine_git_object: 8997ff2bb56ee569f15d0d1932b95f00c2674ebc + docs/components/benchmarksdaresponse.md: + id: f052f6690836 + last_write_checksum: sha1:d49ff5d719b552043a32a0cde7c36578bb5f1a8f + pristine_git_object: d296d588dcc07434b82d1fc1bb60a88486406ded docs/components/bulkaddworkspacemembersrequest.md: id: 12cbe93243c4 last_write_checksum: sha1:5bc0f5067f2fdd1a05409b18ec723b8b2acb4026 @@ -796,8 +854,8 @@ trackedFiles: pristine_git_object: f3a972b60a63cdb55670cc56cc92eae40578aa87 docs/components/chatfunctiontool.md: id: 3c79deefdcc0 - last_write_checksum: sha1:5c94be4dffc20808f0ccdee5d4f4390bb5a2101f - pristine_git_object: d7c9834426f64fce76b207715465fddb97d7e4e8 + last_write_checksum: sha1:f156ebb35822963a3bde0d64fc7204ef683c6ff0 + pristine_git_object: 419a1b6800384c276581afe7f59d4e52efc75e90 docs/components/chatfunctiontoolfunction.md: id: 0de29ccfd817 last_write_checksum: sha1:0a25d1c9b64f1da2513e9153682848cf41f324b2 @@ -836,8 +894,8 @@ trackedFiles: pristine_git_object: ca73483767de32b3d83b7f9e2741011e26ac8e59 docs/components/chatrequest.md: id: 5e0fa9a2cb13 - last_write_checksum: sha1:58ccd62998278ca595b2d308bff8d974ac32a317 - pristine_git_object: 8c5a706618a5c35ebf4ea32fd6de9893adc3ac3d + last_write_checksum: sha1:a0f55b1bb0073e6cbdc69d687115729737a9cf3e + pristine_git_object: 6c832606b0e983d2efd7cc6e3bec98d70e7fc603 docs/components/chatrequesteffort.md: id: 244b6cbbd2e1 last_write_checksum: sha1:232d283adecdffb3fd73e052f4913320c9d0b997 @@ -850,6 +908,10 @@ trackedFiles: id: dbec0ff3ecbc last_write_checksum: sha1:f749dd845cea3d45a0fd3f4a39e3f1edb5f8f54e pristine_git_object: baa1fb1a1f855f0ea648d44b8cb4c52185efe77d + docs/components/chatrequestreasoningeffort.md: + id: d91e84590d64 + last_write_checksum: sha1:e05ffa6a13566055170ad3490b2114c7f8215c70 + pristine_git_object: ab2eb8e2084efaee1528e74f2de35166d9bbf05e docs/components/chatrequestservicetier.md: id: deaf591bec38 last_write_checksum: sha1:8fa53b0f868c99934b83719b7c0b6b44b1f960eb @@ -996,8 +1058,8 @@ trackedFiles: pristine_git_object: 95203396fad26d48c76b23f3481b6167291500e5 docs/components/chatwebsearchshorthand.md: id: 97a5522cf188 - last_write_checksum: sha1:86d054fd7038215a3585b7661af9953b2edcba07 - pristine_git_object: 731bb0306c6017eece6c930f96876bc2c6ff4448 + last_write_checksum: sha1:396851eb324b825081c3cecf557c03b7110e5cc8 + pristine_git_object: f3a9ca0b0bee0235b09c4105185cde2e4c5cd678 docs/components/chatwebsearchshorthandtype.md: id: ec8d82e4169d last_write_checksum: sha1:11a35b858e9630405ffdde10c89e60ed33fbed45 @@ -1354,6 +1416,10 @@ trackedFiles: id: 5fabd69a4a9d last_write_checksum: sha1:900733b615df411575d56ac31008d2059e75e1be pristine_git_object: 173b9852b2b997cdbd6308ccfc7c8aa3659dea04 + docs/components/dabenchmarkentry.md: + id: ec28e83091da + last_write_checksum: sha1:d0b6bd3f94972b0d6051fb9518e8eb3a1768a844 + pristine_git_object: eec6060113f1177659279ced122473f4ab031a69 docs/components/datacollection.md: id: cacd95d2ebf9 last_write_checksum: sha1:1d9eb4c12467860d5ef9edceb6456a4b9d6de643 @@ -1478,6 +1544,10 @@ trackedFiles: id: 099ed6a1de82 last_write_checksum: sha1:41580565bc483b2ca1cdb981e15d324f8060f504 pristine_git_object: 8463c0cdd55e1d75e23e3d7362f0dbfeca1985c0 + docs/components/elobounds.md: + id: a274cbd2e74e + last_write_checksum: sha1:516698f2d4c018cb0e999981d34f4d4d782a2382 + pristine_git_object: 101203ebc6a380cabc8c7767c3d9a775bbf16dda docs/components/endpointinfo.md: id: 98e0e75e1121 last_write_checksum: sha1:5563b32279aeafa2725d1547df1d0f517e53789d @@ -1530,6 +1600,26 @@ trackedFiles: id: 41e6446acd3e last_write_checksum: sha1:8cf5b7140dee926145642fe455df0538a8c95e53 pristine_git_object: 787e2546ba435d92d0736bb1d4d6e212e0128ad7 + docs/components/filedeleteresponse.md: + id: 0fe19548775f + last_write_checksum: sha1:d889c371acdacb8ae1aa1e0ee20bef8f592ade22 + pristine_git_object: 04da1d71610c42c2225c2ca3707b1c8bc0520be7 + docs/components/filedeleteresponsetype.md: + id: b347190ca7f4 + last_write_checksum: sha1:7e9b2ded8643e7c4dbe2a633860188dbeedeea01 + pristine_git_object: ac0edebfe2e2699b264443c620d1cef047e572c5 + docs/components/filelistresponse.md: + id: b9d88cd4c0e1 + last_write_checksum: sha1:eb0f24dd3ded6f96256133a77622b91e5dcb283e + pristine_git_object: 2346d99debb688213acb2a17af75272ac7949688 + docs/components/filemetadata.md: + id: 8383f1928110 + last_write_checksum: sha1:23768b29ef2fa1152ce490ca08a9c02a24eb2223 + pristine_git_object: 19e14b3dedc2d2d167c0206290ef3ceeea718dc1 + docs/components/filemetadatatype.md: + id: 5ee442ed458a + last_write_checksum: sha1:2c89256b349b9c8c7b974dc71fa800e24fec89d7 + pristine_git_object: ca7fa8ca35f95843a6d0417467eac7b82f355f67 docs/components/fileparserplugin.md: id: 5f9fdad1c2b2 last_write_checksum: sha1:27fcde21e502bc5014e94a324bf470c98acb4b99 @@ -2116,8 +2206,8 @@ trackedFiles: pristine_git_object: 404cc4a69bca7b64c9172078420c72359ed9c2d8 docs/components/inputsunion1.md: id: d017aeaed00c - last_write_checksum: sha1:e206464b452b3efce9d7230396001c75c7cd929a - pristine_git_object: 746a2c8045d7ad24b52b905e6763f65fd3ec4f7a + last_write_checksum: sha1:8e8cac94038ec661116e932e5e7ada4a112745fb + pristine_git_object: 6e9649a8656b8695a04c8452af816d6d5f14757f docs/components/inputtext.md: id: cf4503b3219c last_write_checksum: sha1:af646125dfffda8cb71e15c602fcd4823b85f3ab @@ -2188,8 +2278,8 @@ trackedFiles: pristine_git_object: 22ecba2663eaeccadf0d1c0283236d794afb2b09 docs/components/legacywebsearchservertool.md: id: "0e2991237936" - last_write_checksum: sha1:4d3e9701c927a572dd50d6697526cc6f93047c0e - pristine_git_object: fe56675849b873eecde4306246b6f2fd8bd5b275 + last_write_checksum: sha1:1cae946738e369e79bdc8fa6c17efd8c9e72f77c + pristine_git_object: 6822d8ea287222cc37c67548a8c8c4cd704a24a6 docs/components/legacywebsearchservertooltype.md: id: c5def381d385 last_write_checksum: sha1:ea65b6214a79a7125bff8e6cca1f55863f5c1c08 @@ -2322,6 +2412,10 @@ trackedFiles: id: 02e41844a8ea last_write_checksum: sha1:a6cf799a1fa3dcd873532c14cfa673658ceb32b5 pristine_git_object: b72f8916b4236118a46566bf81ed1d4c466ed882 + docs/components/messagesfallbackparam.md: + id: dfcbb7b1e2e6 + last_write_checksum: sha1:53d5e4a1468a7678fe5f0a3b643807c01868c9ae + pristine_git_object: ef4923e715bbb2fa8a00b2d0ed6025e36280dfa0 docs/components/messagesmessageparam.md: id: 4f67bcb5ba0d last_write_checksum: sha1:cf46c4085fd571135f33f1f4eae994d49775d140 @@ -2372,8 +2466,8 @@ trackedFiles: pristine_git_object: 6a8883bfc55e71980d691e2b9bda395dc40397e0 docs/components/messagesrequest.md: id: e479a7035a9d - last_write_checksum: sha1:3ca14c934dd303e0d3da2efac9160cca1448eedc - pristine_git_object: 86c616e20899fc4410a0902368d2304fd5067b30 + last_write_checksum: sha1:7f34c120832595fda47c0a0740558fd1778775de + pristine_git_object: ef9fe199bf4fe157d4e0a141e0a68fb072e94163 docs/components/messagesrequestplugin.md: id: 6c74af3351ff last_write_checksum: sha1:ae5c77653f405c1074121821ac97ff6a78c2f76f @@ -2412,8 +2506,8 @@ trackedFiles: pristine_git_object: d5bbdc95f658be46eebf13f0ba8b9ae3716f72e2 docs/components/model.md: id: 673ad57400cd - last_write_checksum: sha1:e628f3670edde9ecdd3b5c227c95b8f3f6c2620f - pristine_git_object: 55f6fe4664787c9dd50ae653851a2d42b70ba7e2 + last_write_checksum: sha1:517cbce221606bacb2cab7b97e53d316d09a5f17 + pristine_git_object: 8ce3d9d7c9ddc7c270da3a39df079148aa7ff207 docs/components/modelarchitecture.md: id: 79816051e6e8 last_write_checksum: sha1:158b04c79b7a32a2d95e3d3fda8fa6da0ab91cd9 @@ -2422,6 +2516,10 @@ trackedFiles: id: 3518ad912450 last_write_checksum: sha1:e4745000d4820fa66c7b7994e676b061fbf38d96 pristine_git_object: eabbbe356d5ed319279e02b0aa032253b67e3bb0 + docs/components/modelbenchmarks.md: + id: a1ad8feb3ff8 + last_write_checksum: sha1:d2404ae535f53140e257391a944052da2f87790a + pristine_git_object: 84513fb30a065bb405e4b1f9316d91989e9f928f docs/components/modelenum.md: id: 578e84498f95 last_write_checksum: sha1:e4c89141e391bb02c8b01ef243e414603937b527 @@ -2434,6 +2532,10 @@ trackedFiles: id: 74607e6a173d last_write_checksum: sha1:445ec227b130763e2509d1a181dd5e3e6d71420a pristine_git_object: 317190772f743d2aba63c4dad770827b46688f6a + docs/components/modelresponse.md: + id: 9d48c3f335b1 + last_write_checksum: sha1:5d8890c41a9f448341037e9915dd6e93df9140cb + pristine_git_object: 2a7433dc87413943d14220ffdfda8b25e59bc9c0 docs/components/modelscountresponse.md: id: abdad0c1a02a last_write_checksum: sha1:50ae205604eddcbdced268b8cd3e1ac06f0dd7c0 @@ -3108,8 +3210,8 @@ trackedFiles: pristine_git_object: d9e663fcae49dba7885223f4f0848aa9f9a23002 docs/components/outputitems.md: id: 92565743132e - last_write_checksum: sha1:ec270d016224b2d593e20ee661dae22ed61d8851 - pristine_git_object: 6e103ee1d6841359426b63204ff153c12eaad319 + last_write_checksum: sha1:8cf85818cb3bf198bd3a4c00e8e3c3193f187d1d + pristine_git_object: bf2538cd707ab2f40a4feb4f4aed5f4051f6b66f docs/components/outputlogs.md: id: 0821eefe9546 last_write_checksum: sha1:1ff4592093bd2fe28038cc8db28bee6a35025c96 @@ -3282,6 +3384,14 @@ trackedFiles: id: 38aa50f0c8ad last_write_checksum: sha1:497eff39dfcc79b381adf509b9ba70dd8dfd6832 pristine_git_object: 9e2ef674ca5e736dda8f47ab6749ebc1df31d475 + docs/components/outputsubagentservertoolitem.md: + id: d52938a1b53f + last_write_checksum: sha1:034e536a262bb5162af5d89de941b7781b3e84f8 + pristine_git_object: a136f6241ff64496d53dd20432c465f9af592fde + docs/components/outputsubagentservertoolitemtype.md: + id: 4825eb0f554d + last_write_checksum: sha1:f33d221e6ca447e6ea10c61ba7a2d24b32bedef0 + pristine_git_object: 1fec3b0e22e307a64e258bb1582347b2e675d308 docs/components/outputtexteditorservertoolitem.md: id: 6c114519044a last_write_checksum: sha1:7b90b5ce30ff6df03376e337e266dbdadfa751c0 @@ -3440,16 +3550,16 @@ trackedFiles: pristine_git_object: 83cb70870a74ea33634483654fa1c03406e5fdb5 docs/components/preview20250311websearchservertool.md: id: 0ba7bd853f96 - last_write_checksum: sha1:f29b3b4d60d9144b753d57bb606825dd647a4146 - pristine_git_object: f11fbc20667eefc4bf96f9b0f6245097682c5493 + last_write_checksum: sha1:7ba5eab37a306dbdbdb432ccaefb401be6564d56 + pristine_git_object: a08c6cef21449191315496ae13643a39e97426a3 docs/components/preview20250311websearchservertooltype.md: id: 7258d1f3ed79 last_write_checksum: sha1:8fd6c12c225e6756938f25e97c6818a7477d9408 pristine_git_object: 16caa8a6f0ac16b49437cb1a95e5c93781d98d01 docs/components/previewwebsearchservertool.md: id: b43bb7090a75 - last_write_checksum: sha1:9aeb9d3a4f3951fd8db0cd892d1dfe676e7888f3 - pristine_git_object: 43701ad75870e8b0ddbd792cfc86e2724aaf7e54 + last_write_checksum: sha1:152b0f074ce786d8c9afcb7fbe24a2ba767e9800 + pristine_git_object: f98f627e139c480bf7b405edd3c372dda5a8a8ba docs/components/previewwebsearchservertooltype.md: id: c6073c9ee3eb last_write_checksum: sha1:46f579d5f71a87b20d7ca0674004ced55c37121b @@ -3540,8 +3650,12 @@ trackedFiles: pristine_git_object: 54e6cc87d517e482c1ac183ccf82c0140f081d24 docs/components/rankingsdailymeta.md: id: 6e0da9cd4001 - last_write_checksum: sha1:51cd8cda99b6dedd6d2a2c96d8c18e72b2371986 - pristine_git_object: fea99fcf6d54cf6e8676eff7883b643f8deaab2c + last_write_checksum: sha1:b8d4b19c912849fdb8bcb368ab8fd69e79c8d95c + pristine_git_object: 29de269bdb6ef7a68d6611ca47122d56c50e63b8 + docs/components/rankingsdailymetaversion.md: + id: 3d7a17ae95b6 + last_write_checksum: sha1:9e2999b047c2e7ef2828c0d710f7428fd88496f7 + pristine_git_object: 6bf107f0b3c03140e6d4e894204a21564c51eca2 docs/components/rankingsdailyresponse.md: id: f8764b589bb4 last_write_checksum: sha1:4d31d93b0df4cf990f541cc7f08649f8cb438c43 @@ -3784,8 +3898,8 @@ trackedFiles: pristine_git_object: 98ae0961e2afdbf95cdc71e2eee23c9c06972889 docs/components/responsesrequesttoolunion.md: id: d6a807777d03 - last_write_checksum: sha1:7094ca8d783089f3430bc4865017d6eb462c8a98 - pristine_git_object: e64a76c9221b039eff259a866cf47e8da4e0e6cb + last_write_checksum: sha1:4a4794e3b931e824f43ff5590e0ed94f539b5140 + pristine_git_object: e57db617fb2807f716ce62195dfc96d5c34e828a docs/components/responsesrequesttype.md: id: 5bd80a5ef99f last_write_checksum: sha1:96aba92528f15b2e26760ec90539b8fd7a0e9cc3 @@ -3820,8 +3934,8 @@ trackedFiles: pristine_git_object: a3dc6194e6abc9a0cc62bd9e20b7131fe106ab36 docs/components/searchqualitylevel.md: id: a4e6b74956c7 - last_write_checksum: sha1:4b218b033d279c041761d90bbec7c13f07358f5e - pristine_git_object: 76b14f2086dc9a5462827e25c9fffb476d207c65 + last_write_checksum: sha1:027c0155e4ca55866ca5ef9cc4851b3df09f5cb2 + pristine_git_object: 4b8fd627a27f792e0e88e0afe406d7a552143f48 docs/components/security.md: id: beee40001fda last_write_checksum: sha1:45b7b8881a6560a468153662d61b99605a492edf @@ -4050,6 +4164,30 @@ trackedFiles: id: bda939de1537 last_write_checksum: sha1:e11351ee3e6d4a0470f28a611080c00e9eed11f0 pristine_git_object: 8d8525a4e7947322cbc5b35d82f87d76d7157b24 + docs/components/subagentnestedtool.md: + id: f1ac0bf22f13 + last_write_checksum: sha1:9c9c34831e5d2b73421281ac36cc2100d32d4f45 + pristine_git_object: 52cee326ba52e795dd864616e975da730b397630 + docs/components/subagentreasoning.md: + id: 28eb0e1a766c + last_write_checksum: sha1:0a2d377998ebc796f48259f9d81031aa3d62eec0 + pristine_git_object: 3e49330ffc6e7ae403873cfe3e8297ad188bcafa + docs/components/subagentreasoningeffort.md: + id: 068a2b1e59c4 + last_write_checksum: sha1:6b27ed5774615473f501ec7bf18c1524c99e4002 + pristine_git_object: fe29f80f29f7137d07401b4d25def11360a70a32 + docs/components/subagentservertoolconfig.md: + id: 07f1740a203f + last_write_checksum: sha1:3175e6b1db4977f98195f30c6e2391092bc017ff + pristine_git_object: 45a261d6ce97463045aa6d90765720108722eb99 + docs/components/subagentservertoolopenrouter.md: + id: 0049c5a944d8 + last_write_checksum: sha1:70d3153bf5ff0d5c78747a6e684a126917fd032d + pristine_git_object: f695a981599a6e45d91f4e6206010c8602884bb4 + docs/components/subagentservertoolopenroutertype.md: + id: bf827ad8b352 + last_write_checksum: sha1:fcb3cd3c4edefc7071ed2c71b7801567b1f883cc + pristine_git_object: f28523e50df8342437db36e0a98bffbfa69fefd0 docs/components/supportedaspectratio.md: id: 435dd9a15912 last_write_checksum: sha1:25a608572d10d4c76eb9e4f45e16494bea931120 @@ -4194,6 +4332,10 @@ trackedFiles: id: c9e56036dd80 last_write_checksum: sha1:4b25308beba5c14f49058889aabd27bcf025c184 pristine_git_object: e66d615faf440dba26e666f28cb740a477df6e84 + docs/components/tournamentstats.md: + id: 0be10d528a1a + last_write_checksum: sha1:38e369f7141807de906f2af88d0c4956884319c6 + pristine_git_object: b27126b18386e224874a4186e801bb6c4fdcf818 docs/components/traceconfig.md: id: 639fd1f6f967 last_write_checksum: sha1:560d3f57a9f103eee587ab1f260548161658675f @@ -4426,10 +4568,6 @@ trackedFiles: id: 0a9da5ac382d last_write_checksum: sha1:76ec453c1e767ce0f8c76afc0617cdc7ff29b60c pristine_git_object: cf10c9e56352e1ef074e794b915639774a0de872 - docs/components/version.md: - id: 7507f00a20fb - last_write_checksum: sha1:64a942b733da255793b182b90030ef9514db6e27 - pristine_git_object: f76abbca9198ac1083a5983ac69dcfc9a87561b1 docs/components/videogenerationrequest.md: id: cacead3ac9fe last_write_checksum: sha1:c87d8d7a7ce900738b6a536f863a34cf36854506 @@ -4512,20 +4650,20 @@ trackedFiles: pristine_git_object: f1771d0b194da9cadcbe7176c43059189745af44 docs/components/websearchconfig.md: id: 3fcee95e24a6 - last_write_checksum: sha1:a97ac8c61fbb719c987f84abbd4acc20180ccc75 - pristine_git_object: 24d2e61af8e697249dd222ce823773024e577dd8 + last_write_checksum: sha1:a7e71501e94f736860627a199589ca0c89f26e38 + pristine_git_object: c6c10a9dd5850754454a547917f29e227394e678 docs/components/websearchdomainfilter.md: id: 47d067b8286d last_write_checksum: sha1:bc0207fdf5478614ee90906ce70c42e57506378d pristine_git_object: 49047767ed450538e956901a7a1bab92099a9493 docs/components/websearchengine.md: id: ec8b8ee1236a - last_write_checksum: sha1:59a0029e174957275203a64c9d2b4a502cd8c2bd - pristine_git_object: c0da50524ffa09ff15d26306df1bb1e9f7346998 + last_write_checksum: sha1:888cad8aaad95b2303bc85a8baa09276ee391607 + pristine_git_object: 8772c8f29a972acaefab0adc329db053ae7dde62 docs/components/websearchengineenum.md: id: c7543e4c8464 - last_write_checksum: sha1:c5fa6ad3f597c1696c68e19536922db63df4a819 - pristine_git_object: df79f646589aca3ce23214862d78c3c105811bc0 + last_write_checksum: sha1:1793a4a3cb9a9517b99a6640640d0afbe791197e + pristine_git_object: 8a28ed0821e632fce98f29e8041f99d35616017c docs/components/websearchplugin.md: id: d6baf3aa0a96 last_write_checksum: sha1:cc37dce50cf180ddb4d6ece96993600f0d73eff2 @@ -4540,12 +4678,12 @@ trackedFiles: pristine_git_object: a64310784046570184cdec6d848897351c112b30 docs/components/websearchservertool.md: id: 92cff6162ede - last_write_checksum: sha1:860b4c1b13b6be3ffbd2ff99f20e7055a0ac2098 - pristine_git_object: 8ad43c178a611051aabb65b30222a2e901004d9f + last_write_checksum: sha1:f61fd96406c47270aa0b766535aa75306f12f058 + pristine_git_object: 151fd7fdb33b9589c9db9075cadcc60b4f78c6c7 docs/components/websearchservertoolconfig.md: id: 03a09e9ae532 - last_write_checksum: sha1:447a828f922aaf71b6f28bdd341f6c6c8566a841 - pristine_git_object: 8b0ac6c73051263887dae73ea83635466e4480a8 + last_write_checksum: sha1:242d80746302361503a6dfa822453ea6c94541b8 + pristine_git_object: 00528819693a841e1d20dccf09ab24b4a09d4b73 docs/components/websearchservertoolopenrouter.md: id: 34b36452e3b3 last_write_checksum: sha1:c3676ba15e24d124c35c69ed20af393f10bc111e @@ -4666,6 +4804,10 @@ trackedFiles: id: 4343ac43161c last_write_checksum: sha1:562c0f21e308ad10c27f85f75704c15592c6929d pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf + docs/operations/arena.md: + id: a9de99ef2b33 + last_write_checksum: sha1:72964c86d5b8a31c3144454e0ca717b111a5c4f4 + pristine_git_object: bb57edab7f915ebccc0af37e46c11b7b23f9dfd9 docs/operations/bulkaddworkspacemembersglobals.md: id: 6cff183f93a1 last_write_checksum: sha1:39941ebc9a51b0189aed03680e2168e25b7c9692 @@ -4760,8 +4902,8 @@ trackedFiles: pristine_git_object: 6dc06174a0f72d4b4d0f22bc88a3f8a941e7666f docs/operations/createauthkeyscoderequestbody.md: id: 402f2065cf8a - last_write_checksum: sha1:df4a827cb17240f62bfa31c2f72444a7dd49d7ac - pristine_git_object: 787c57a4d6bd2134c71d88a83044aee60cd9cc83 + last_write_checksum: sha1:2d5fa5f4aa05e78535b8b90a2d73667b08d38dda + pristine_git_object: d37c21942ce85a11a1be7d9f8ed11279e2255554 docs/operations/createauthkeyscoderesponse.md: id: 6c92952aa6b6 last_write_checksum: sha1:9f9f0dd11d268a8bb27e9f6f99ce41da757e23fc @@ -4930,6 +5072,14 @@ trackedFiles: id: 0f7d1a3cad77 last_write_checksum: sha1:31a3faafb0bed58823054afcd7956cf9e3881266 pristine_git_object: 0ddbc912f8cb861cee8e1806d1324541e0e637de + docs/operations/deletefileglobals.md: + id: 47ec2f40c8e9 + last_write_checksum: sha1:06807ac545024567e53306d34c2d065536ec05eb + pristine_git_object: 9b34d571d0fd52d1dbe1d6c30ff1fce3accb3d34 + docs/operations/deletefilerequest.md: + id: 9e780e5a62c8 + last_write_checksum: sha1:d402693b03224324a6f71a13b510a7176d53a322 + pristine_git_object: 6fc40ff3b1ec6999d5ee5af3c974a410c7be3ef0 docs/operations/deleteguardrailglobals.md: id: fc24ed3e100f last_write_checksum: sha1:303b76381d6ae26e8d39c5470d35bfbbbb5df0df @@ -4978,6 +5128,10 @@ trackedFiles: id: ad242fff7e06 last_write_checksum: sha1:1b2aee0301442f0d1cd0cc187da805775033cba3 pristine_git_object: dd278a8c74326eb0b1636e8d1c74bd24b0cfed31 + docs/operations/distillable.md: + id: ab4b4fcec736 + last_write_checksum: sha1:11ce4c3bdfd7a3aca4e94e2bbf81318acd845f9e + pristine_git_object: 77fb765c6ac1a5588d6f96fdcc0d3f57635f72c8 docs/operations/document.md: id: 640b715eb2a4 last_write_checksum: sha1:e5354408ae5ad862afda9ee12e58ae51ee2b99b4 @@ -4990,6 +5144,14 @@ trackedFiles: id: 1dbe219e966f last_write_checksum: sha1:aae01d1323240685b2f38f0409b18530fbe8193d pristine_git_object: bb8bfba10d72c9a749611ba87413df6f06e068af + docs/operations/downloadfilecontentglobals.md: + id: 40cf7c83ef44 + last_write_checksum: sha1:85802c7eddba33133a5d3913a23db467049fb01c + pristine_git_object: ba3fc09c424898cab0279dc5cf8abea7c3fba7af + docs/operations/downloadfilecontentrequest.md: + id: f23fbce569ce + last_write_checksum: sha1:f3a2a8aafd962f49a181f7ea6518c4b9780cf422 + pristine_git_object: 31be67d10cc2e2f7964f9bb5dbb608d9375cc973 docs/operations/embedding.md: id: f269f99ee6d5 last_write_checksum: sha1:37c64f7daf2ddca055feafab8df92acd112976f3 @@ -5018,6 +5180,10 @@ trackedFiles: id: 62e36bd89583 last_write_checksum: sha1:f1f06cc15b7bf183358c6de9aa6351b70ca5e8bf pristine_git_object: 11975e02a266c09b4c6c77409c7e8a42fe7cb537 + docs/operations/file.md: + id: fb72601b883e + last_write_checksum: sha1:ade4d3c908c664a07a3c333cc24bc1bfb43ab88b + pristine_git_object: 37cc418f9e5189c18f312c42060fd702e2963765 docs/operations/filter_.md: id: 99a428faae78 last_write_checksum: sha1:bebef12ff586b33835e6093318d2a232ddb60fc8 @@ -5058,6 +5224,22 @@ trackedFiles: id: f6276c91ff17 last_write_checksum: sha1:9c80418c5384e63542ea16aa336c3bfe54c23b64 pristine_git_object: f0d402fbc8b66cc075706e056fd152e41e141c3f + docs/operations/getbenchmarksartificialanalysisglobals.md: + id: fc980e69438e + last_write_checksum: sha1:4b7871db540cc8d255518b0fb51845738a2b7d09 + pristine_git_object: 8925cb558b063d232a4eab418279d6fe69443023 + docs/operations/getbenchmarksartificialanalysisrequest.md: + id: 998a53047e6f + last_write_checksum: sha1:c4e6ee2f48087e0198b49e16c286f7034b043034 + pristine_git_object: bca988aaed6a6fee2fa08342305a1070c2d41c95 + docs/operations/getbenchmarksdesignarenaglobals.md: + id: 4e2f927bea8b + last_write_checksum: sha1:76d2ff4919b87f05d3672f5b660033d2c9e689a2 + pristine_git_object: d6c6cad08146378c7794aa8af56234a01cf0df71 + docs/operations/getbenchmarksdesignarenarequest.md: + id: aea9fe0d448c + last_write_checksum: sha1:433d65b3a6d7fe0b3e4a824a8ca9f9a36593a6be + pristine_git_object: 73202a7094b97faf481947434a8253f72eb872b6 docs/operations/getbyokkeyglobals.md: id: 82a8cd8db21c last_write_checksum: sha1:4490949622267f537def903fa3efe64142925739 @@ -5098,6 +5280,14 @@ trackedFiles: id: 37af8951de4d last_write_checksum: sha1:1e62836ec19a8aad8b0dcafd7799b71250a5c6f7 pristine_git_object: 2855d5b95d41a494bc7ffa9f85c74ff27a46ca96 + docs/operations/getfilemetadataglobals.md: + id: 2d5d096e7f7e + last_write_checksum: sha1:9bb4324ec2eb4bdc590dd11587ffd8382b03fd27 + pristine_git_object: 75e2f6c313dd6b7b10e85312cb696e0d9d99175a + docs/operations/getfilemetadatarequest.md: + id: b47b5ebc4684 + last_write_checksum: sha1:8650f381ccdd0b4f936c1d54e36496437548f6e2 + pristine_git_object: dbb1ad6578af3d162e73adaa1f3a1937eddebf69 docs/operations/getgenerationglobals.md: id: 0d6e856c5861 last_write_checksum: sha1:b5236815132dedf2b595fd520f1753d5ec8bb6e0 @@ -5130,6 +5320,14 @@ trackedFiles: id: c145b1a0dd5f last_write_checksum: sha1:c315584d278f8f91f4437479ef8e95ce48b3130c pristine_git_object: 72e8055b7d9b0de224ea423fab24a5614d6e9da3 + docs/operations/getmodelglobals.md: + id: 8bf42bb29760 + last_write_checksum: sha1:015159b3fab18f2122ba256831314a96c88085de + pristine_git_object: 5c12ffab153909fbf0b235c63500d36f09bc6259 + docs/operations/getmodelrequest.md: + id: 81d572026a85 + last_write_checksum: sha1:87ba489a1703e58e49c19ff6f29a416f9441a378 + pristine_git_object: ebc160f8b88bbe2208da932a31248fa0eb726d83 docs/operations/getmodelscategory.md: id: 30e7c8fb695d last_write_checksum: sha1:aab2e450286bc960f0aa5a856e29b6b2f2feaaa1 @@ -5140,8 +5338,8 @@ trackedFiles: pristine_git_object: 9533d03cfb8ec3720fde4833d7260f4f645d6786 docs/operations/getmodelsrequest.md: id: ffb89fce8262 - last_write_checksum: sha1:82a616e853d456b0435abb5cbbe9cfdb9f65af2a - pristine_git_object: 8fa79b3536676090c781f6c6e5cfb967bd52c136 + last_write_checksum: sha1:1d88165796c59d6569965a3ae3ce69833ee38399 + pristine_git_object: 2086a7996a3e115a85ba53f9de087d4e5b5396e5 docs/operations/getmodelssort.md: id: 0e5bc10b2c1e last_write_checksum: sha1:18273aafc3b1f4aee1e426355a8f53e609a3e196 @@ -5274,6 +5472,18 @@ trackedFiles: id: 37a957da8f54 last_write_checksum: sha1:6892fe1fc31da14493b937171caec5f0fabb8daf pristine_git_object: 54cf662af701995f7c04272d932f9a2e2731beeb + docs/operations/listfilesglobals.md: + id: 7714f717b38a + last_write_checksum: sha1:1c33d490023fc17efa93535eb6a9216c892f791f + pristine_git_object: 7de49096c3a1c04634f297ac6477e5293febb539 + docs/operations/listfilesrequest.md: + id: 2110213173a9 + last_write_checksum: sha1:7ec4380dca8eb27e7af711c6eacc232a981517ea + pristine_git_object: aed56276f9f1a086b43d8011a7d0baf8775f17a8 + docs/operations/listfilesresponse.md: + id: 2f635c7a9991 + last_write_checksum: sha1:f1702087ae5a485f124b8dc4d83d9c8d8172eb06 + pristine_git_object: 371188d710b21e568e6405528febcb034c6c4b55 docs/operations/listgenerationcontentglobals.md: id: 86c60d8ee820 last_write_checksum: sha1:6bb5e89777b8f25572237af5065a15ff5abea244 @@ -5528,8 +5738,8 @@ trackedFiles: pristine_git_object: d8c88120bf89df54fc08efc3de0ae50c291cad39 docs/operations/queryanalyticsrequestbody.md: id: d462ba943863 - last_write_checksum: sha1:1d2c5928d852134b8f46f890710d8ea3fa4afb47 - pristine_git_object: 8b20d84e52c0e3bf788ac6edef549e39538669c8 + last_write_checksum: sha1:d61b9cb983826a5e4dc9c5fef29e29d7c3ccd848 + pristine_git_object: 87a4d54f500b26455023c24ac6b5f26b9efad510 docs/operations/queryanalyticsresponse.md: id: 662c24789418 last_write_checksum: sha1:88a8ceb4ceaad18c15e6b22450205d1562b17064 @@ -5538,6 +5748,10 @@ trackedFiles: id: 55ccfab9dcb0 last_write_checksum: sha1:ba383320e312bc87bd156a5d338f3d973376ec02 pristine_git_object: eeed3720e0eef6a871483dabd4a345495b466339 + docs/operations/region.md: + id: d0bc61dedd4a + last_write_checksum: sha1:bf44dd639de860bc02404edc99be98a19c4e0c00 + pristine_git_object: 36a51ce0097c2ad065ee0b0331d90339fcf3a6e5 docs/operations/result.md: id: 432b3cd4c69c last_write_checksum: sha1:ec5cacde47270f2b163116b6b38820cfaa285dc0 @@ -5630,6 +5844,18 @@ trackedFiles: id: 719c33978f4d last_write_checksum: sha1:3ea95e60674f4d0380f532123c75579855ac00fe pristine_git_object: d5bd345f6faefd5e2448b7e6c6c15ae58df7d0d2 + docs/operations/uploadfileglobals.md: + id: e6a061691838 + last_write_checksum: sha1:941faa7b58e39cdc3a0e54ccfaa9d2e4dea7674c + pristine_git_object: 49b2442475be39e51f009fed49e7735d305e06b1 + docs/operations/uploadfilerequest.md: + id: afe31e35e3ec + last_write_checksum: sha1:1f4254b0494cb4bf33bdd7a07b374cbf057c1e0f + pristine_git_object: b80c439e24b92151a6cf871b4043a7d2e2bf5532 + docs/operations/uploadfilerequestbody.md: + id: e6a8c28ec386 + last_write_checksum: sha1:004454df6c98ca21a802bf9da7eea64abc7cb70b + pristine_git_object: ac4e22af61da02419948c154cc56a7dc70fdac0f docs/operations/usagelimittype.md: id: f83f3fcb36f8 last_write_checksum: sha1:9c272d9908a57fdbd2b376e13c8fd226e7d4ce65 @@ -5646,6 +5872,10 @@ trackedFiles: id: 20b3a19cf0bf last_write_checksum: sha1:3ee651ec1a0b12ed21c222f856ed351e99ce36b5 pristine_git_object: 9b4d37e44d3b989fe6b9bc47c9e35a9e09cdc5cb + docs/operations/zdr.md: + id: 7b519776696a + last_write_checksum: sha1:9c7ea16d0ca7b4105190e93e583f145fb9c8b8f4 + pristine_git_object: c97bcf8826ee67a7b62c427daf0b541030785c46 docs/sdks/analytics/README.md: id: 4c84abb05030 last_write_checksum: sha1:2af2b879b1945ad9293b519ffa87579393608031 @@ -5656,24 +5886,24 @@ trackedFiles: pristine_git_object: 6e72f51df9e9811cee424032f7dba0887e15afec docs/sdks/betaanalytics/README.md: id: e037af84b386 - last_write_checksum: sha1:9375a62a38b542ab12a694dc8be8993d2982181f - pristine_git_object: 4c593aa7680dac5f237b405d7eaa21c3e1e7706b + last_write_checksum: sha1:78a1ed27ae55ac9b6e6926e2587adeda0de65aa3 + pristine_git_object: 7f19e372b77803949f2afb8dd86b4794556e9c7e docs/sdks/byok/README.md: id: 511ba2ae7a1b last_write_checksum: sha1:ef72e4c9cae06d60f4c2f2ad0578747d39e1d5ef pristine_git_object: a6f5335576f02b6108482dcd54e066b34a7c586f docs/sdks/chat/README.md: id: 393193527c2c - last_write_checksum: sha1:ee1db1ffd0e27ed3b8730031bd4359e0ada7dabd - pristine_git_object: 6ef196052d45156ac3427e72889d5fcd4b246e28 + last_write_checksum: sha1:0b40d973610ed193d6faafc7f4f0bfad06c78225 + pristine_git_object: 08b736f0782487ac73f87d4f008079ebc00eab48 docs/sdks/credits/README.md: id: 81608135c0ff last_write_checksum: sha1:abca02bc25760be47f80100a7cce6bb711202aef pristine_git_object: 1837ff59343eb87482e8750c1fb5d2b5f89aae6a docs/sdks/datasets/README.md: id: deb5d90f4faf - last_write_checksum: sha1:c09c0c118def84591a90132f77b67f40ae9e3d1e - pristine_git_object: afcf796dfd4d793bbfe7bcd3bdd81e5fe908de94 + last_write_checksum: sha1:a3585d8d399421584c3f65610c59fe5dfbf897ab + pristine_git_object: f097289cff8c229c70c4f9e3e934f28372f69167 docs/sdks/embeddings/README.md: id: 15b5b04486c1 last_write_checksum: sha1:c2ed15521af31873f56e7813292aa30c5adf94e4 @@ -5682,6 +5912,10 @@ trackedFiles: id: 80d3fa9f5f5b last_write_checksum: sha1:8eead5232f81561abe5a4d37c74c9a69a5de0387 pristine_git_object: 2ce96e9a6eedf3a64256cd848615e9c4fd76c0af + docs/sdks/files/README.md: + id: e576d7a117f0 + last_write_checksum: sha1:ec0f9444f9d8a657caf6bbae2cc08805d4e6f17a + pristine_git_object: 687d0fd1d678b125fb0d4dcaa6cd20512707849e docs/sdks/generations/README.md: id: a7d12ae95fb1 last_write_checksum: sha1:70dbb18cfaff95cf5e398fed34ef969a683964d5 @@ -5692,12 +5926,12 @@ trackedFiles: pristine_git_object: 427dac57b47fbb136a16eb1ab7732c1ff61d7c2e docs/sdks/models/README.md: id: b35bdf4bc7ed - last_write_checksum: sha1:5e810aa08ca47adf984749b54820797f11905d98 - pristine_git_object: 4875c608ca2e0c3d598daf9eeaeda610fc587b75 + last_write_checksum: sha1:76c1efecbc8a679a233ea1a80bdb01ead5b65ce1 + pristine_git_object: 8af216e242e3fe88aa21b2ef11436e3f24541813 docs/sdks/oauth/README.md: id: 80ad2c1a7b62 - last_write_checksum: sha1:bec31275e907bdf1f888ad7e2a6af916b84d5103 - pristine_git_object: 562e2e83f65a925b834b591ede742db3050d3cce + last_write_checksum: sha1:3590ea2a886254f74575d5a803b8be3aa5f7de90 + pristine_git_object: a99fae69d502c4249a72145eea286d404ef81c3e docs/sdks/observability/README.md: id: bab967736831 last_write_checksum: sha1:88065c2ad18b9ab74228a89bac655b05dbc11991 @@ -5708,8 +5942,8 @@ trackedFiles: pristine_git_object: 867781001d3d7c6e755bcd3024268d831d154732 docs/sdks/presets/README.md: id: ead9668ae1dd - last_write_checksum: sha1:94365626300b73b78ac9cdfcac1e85833a862fc9 - pristine_git_object: 8ec4f55c51a6b59577b683323276d1ffdd824c63 + last_write_checksum: sha1:340a33451b0f832a07ed068df7ce71707e80484d + pristine_git_object: f31181e6253ccc15aaf6edf21fb489e49a0ec9ce docs/sdks/providers/README.md: id: b02aa45c0093 last_write_checksum: sha1:576c938477d66de01f39db88b50caea41a6812d3 @@ -5744,8 +5978,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:62d35f2ecbe840540100da937920ee63980a1e12 - pristine_git_object: 9e4606d0c68e092819b9d86eb23859bd85c5ede7 + last_write_checksum: sha1:ccf5925a473a1eb527cec02639f862b79b601251 + pristine_git_object: 396bd51f9c1428f03560f3e7988edc99edc698e8 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -5772,8 +6006,8 @@ trackedFiles: pristine_git_object: 07ace03229fd3267623c8f48665d2c3a67c3565d src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:dd226a1c87253767a3a41d735f600db8980faa45 - pristine_git_object: fcebde34f88b9450f406b1563d00942dbd6d7b80 + last_write_checksum: sha1:017dc1ec43588b31eee23532d74d4421993dd874 + pristine_git_object: be619e3be1aa8d27deef5752ecc9ff09ccd4cd9f src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:6d47d1ab3da9cb4ac9f0a2bfe442f1a82a614f35 @@ -5792,20 +6026,24 @@ trackedFiles: pristine_git_object: 9c02cc64163adf027507af763e7b612d3b704adb src/openrouter/beta_analytics.py: id: 81988b170188 - last_write_checksum: sha1:289c9aad2d6787aabc6fa84952748de6189f7180 - pristine_git_object: 6c56ac11235d3ba9752ccc75299be655a9678ef5 + last_write_checksum: sha1:56eec7f30bf7d6cce1548863eae879b339b2a76b + pristine_git_object: 9db10e868aa38e1c38036d55416f7bb39c71bc0d src/openrouter/byok.py: id: bec352462ae1 last_write_checksum: sha1:2508c32fac403ebb6dbd65eab53601d88039fbc0 pristine_git_object: 9c2b675374900474076991a713a40ad119ee8b17 src/openrouter/chat.py: id: 723fdce15c1d - last_write_checksum: sha1:134121bd2f0c3e5e928ac783c705ce3ba7377ee6 - pristine_git_object: 3b47457b9e9bb17942a99aa1ae297195ab62aa39 + last_write_checksum: sha1:045ca733908a82e099a0c2a76c6c498025827391 + pristine_git_object: a1894915bd32aee65f019885634eb7908970a046 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:ed8fa9af5ffd2d90eb89d0acba5ebf9a774b89f8 - pristine_git_object: ebf1361a13695019951e306d9dce69367a3a62f8 + last_write_checksum: sha1:754b7cd9603aba7d8e8478ecb3b0bd650a80f893 + pristine_git_object: d45e7394adc4467fc5be61e5baaf38302b4a0afd + src/openrouter/components/aabenchmarkentry.py: + id: e2e0f0b48c82 + last_write_checksum: sha1:1b6b66672fb80dccdc39843a98bdef6d7d804364 + pristine_git_object: dcf36134b499bea29d47a0aa4df1eb2963955f75 src/openrouter/components/activityitem.py: id: 3bbe7d35f459 last_write_checksum: sha1:32b873ba5c0a9dbf5f0cf32c0217ce17395ae69e @@ -5816,8 +6054,8 @@ trackedFiles: pristine_git_object: 1138e6f6bc025546a86877749ce83aca4c46499a src/openrouter/components/advisornestedtool.py: id: 768fcc6bad2b - last_write_checksum: sha1:53c5ee4836751d76dced0302d5bc27c341b8e889 - pristine_git_object: 02266270ccd1e567452d6bedfd858e08a99f507e + last_write_checksum: sha1:199df787c5418a426e0c2104945f381890d461a2 + pristine_git_object: e21d2d2322aad32dabda485132c4046d2ec6de89 src/openrouter/components/advisorreasoning.py: id: d5af5c19fc73 last_write_checksum: sha1:ee69d03c9da3a6b9b42c3e6525d21d9c1910cfa1 @@ -5828,8 +6066,8 @@ trackedFiles: pristine_git_object: 923d26368a221b79e489ab8bfa4356e05cbf2a5a src/openrouter/components/advisorservertoolconfig.py: id: 683887bb9db3 - last_write_checksum: sha1:15fa9d64f76952001416c44aea307f5e1a631906 - pristine_git_object: 7cfdf3a163cb42d995019d2dab522c97268efcd6 + last_write_checksum: sha1:2bcc6dfe509c99927ae841738dd58457f8fb79d5 + pristine_git_object: 4540be9c1c0935cc1a3c4c3445a272c4616abb8d src/openrouter/components/annotationaddedevent.py: id: dc032c9ad744 last_write_checksum: sha1:8e5d49d2b57114df7f4559b611d40769e65f9f78 @@ -6034,6 +6272,34 @@ trackedFiles: id: 5533c01ab156 last_write_checksum: sha1:0d74bf725e24809c704e0c293d72ea96a897446b pristine_git_object: 0e610680e018be53b3e62759ad61e9f7c416640b + src/openrouter/components/benchmarkpricing.py: + id: a7c56383dbe6 + last_write_checksum: sha1:2af31e20dfde609e7d5c1b791e02b55a483d92c6 + pristine_git_object: 3524f786e3f73c7436e061800ecd403d92854621 + src/openrouter/components/benchmarksaaitem.py: + id: a90a5423d2ab + last_write_checksum: sha1:7b10783085a9bb672306573cf73a8a77f5d65973 + pristine_git_object: 2855ffe10969511370a40e492b4956196a075864 + src/openrouter/components/benchmarksaameta.py: + id: 67ea1de84da3 + last_write_checksum: sha1:def05fd7d2546eeb56f2e908c1032aa2a9f8af1e + pristine_git_object: 9d751f4abb5b2d88625ecf05a447f9368b03999e + src/openrouter/components/benchmarksaaresponse.py: + id: b0b47f818fb0 + last_write_checksum: sha1:9fff98aec7bdcf688bb46673949f2badf0c21c33 + pristine_git_object: 787ae1ca313f84e1f958d01fbde16a7addfe30c3 + src/openrouter/components/benchmarksdaitem.py: + id: 575945def054 + last_write_checksum: sha1:7cd6079757b7be8f6e3add94eb05d68cf7c73bc4 + pristine_git_object: 7713e2e8acdc2a75742873408b2238c163acba91 + src/openrouter/components/benchmarksdameta.py: + id: dd1d01a44665 + last_write_checksum: sha1:e8e640d403468fe3be115da58a843eb37cc2e292 + pristine_git_object: 0ca3550d2febc93be4ef3f4df531ef4e2dca6358 + src/openrouter/components/benchmarksdaresponse.py: + id: 9e8cefb8d1e1 + last_write_checksum: sha1:694c9e050fec812c95cf37eeb53b9e3920773106 + pristine_git_object: 7588fc5242eb12d83c24453d8dad455d6ee7e1aa src/openrouter/components/bulkaddworkspacemembersrequest.py: id: c042d4bce938 last_write_checksum: sha1:dd5b69cce65985231a77351be04aadeecc85c46c @@ -6168,8 +6434,8 @@ trackedFiles: pristine_git_object: 7a6140f2b8afb0cde9b031322a4284c9cbce7e33 src/openrouter/components/chatfunctiontool.py: id: 1fcf92f8a7da - last_write_checksum: sha1:e2bd26a5d3ed55cb33fc467d01e4acf6d63770db - pristine_git_object: ab87fc30e7ad511450887b29270689ae6ab0dd0b + last_write_checksum: sha1:914ec1c354458da1d6634f12ad3f0149dd588f6a + pristine_git_object: e0f23b38e09fdac95768ba454244919f3d496007 src/openrouter/components/chatjsonschemaconfig.py: id: d2278e414fab last_write_checksum: sha1:69efa91d33e4767058c2d377814b820bb5104ab4 @@ -6188,8 +6454,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:b1b13e3f1cfe602fa882a746270ad3fd3cf0020c - pristine_git_object: 97f89d96cc2b0c370e64317c3cf1b7d102e81d69 + last_write_checksum: sha1:65012c617dd06019eb4bf62d04c434ebfb23adcc + pristine_git_object: f90c290577966b6fc85afaf1634b2413b02661b6 src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:b44dc25412b1206cc188d9516191a273d0f3e4dc @@ -6260,8 +6526,8 @@ trackedFiles: pristine_git_object: 9092aa329bdd58891c2c6f92a6d9c4228b37400c src/openrouter/components/chatwebsearchshorthand.py: id: 13091b97a3f6 - last_write_checksum: sha1:f119143175c06ae4c041faf2d56884039527c7dd - pristine_git_object: ee79798ccb0119bb798bcd1d553807eb9fd5e0fc + last_write_checksum: sha1:1a67f1312fd4f4b0cc1e3abddbea45d1df02a02b + pristine_git_object: 529d7b6906b00e7e96f67f6f2ffa5e9efca28977 src/openrouter/components/codeinterpreterservertool.py: id: a72c520afbf9 last_write_checksum: sha1:f6123d9808c530e0b042e0a30fbb1a11a82096e6 @@ -6418,6 +6684,10 @@ trackedFiles: id: 533940b12cd2 last_write_checksum: sha1:9702dd53b6f12e5fbc9b6d8d8b19fbaa4cb712a1 pristine_git_object: c8201422a35e2c12c9e4321c3622f95f76a3234a + src/openrouter/components/dabenchmarkentry.py: + id: 5f5745cbfe75 + last_write_checksum: sha1:4416b41c6ca98d790893113ed5f6c3e0157e74dd + pristine_git_object: 35a1a90cf109062a379cead396c3d7b94cc7f810 src/openrouter/components/datetimeservertool.py: id: 444350bd66f4 last_write_checksum: sha1:ce9c7aba930c6a8764ca762052912d6533ccf53a @@ -6474,6 +6744,18 @@ trackedFiles: id: ae9f50481422 last_write_checksum: sha1:3e94a2b7245fb44ae818f78168767980f41e6559 pristine_git_object: 7217c3099593e28e52a784193364285f101d7318 + src/openrouter/components/filedeleteresponse.py: + id: 45d467f4500a + last_write_checksum: sha1:cab7fd623f6e61fd80f2fb3490599e236e599203 + pristine_git_object: ee75b85ee8d580fb1fb71bee31adbfd2552885c3 + src/openrouter/components/filelistresponse.py: + id: d0c949679c66 + last_write_checksum: sha1:8426dcfad214046837ae4d227af96bf75772f24a + pristine_git_object: 689329945ffca1f92e2283d4f0cf7ac4df1c55c4 + src/openrouter/components/filemetadata.py: + id: 31b55c7f5dbd + last_write_checksum: sha1:2543bac9ec9d7174e47fe375a5eb936fd5e5f720 + pristine_git_object: e128dc9b415b5eb362a076ac1c1c59b500792c96 src/openrouter/components/fileparserplugin.py: id: 1120c86c0856 last_write_checksum: sha1:a23fe386c1606aebe30057fec1d20516b5984f7e @@ -6692,8 +6974,8 @@ trackedFiles: pristine_git_object: a3d84a96f4553a320f5eee5d63f6bc5c244ab446 src/openrouter/components/inputs_union.py: id: 17d6239cb6a7 - last_write_checksum: sha1:d10956498400233baa95936ae5f7756b1eda6e06 - pristine_git_object: b4098988f58113db7ee9f9805a058d4e44b3abc3 + last_write_checksum: sha1:a44cd4d689a7c8f85f6f827d42cbdb3fca80b1de + pristine_git_object: 04e80eb24a668a9f6b15ce48632231b92367e50c src/openrouter/components/inputtext.py: id: a995ae96be99 last_write_checksum: sha1:0e30dbfa1813d3e69e0ccd2511f50080cce0fb6e @@ -6724,8 +7006,8 @@ trackedFiles: pristine_git_object: b5dd4d1a0d29169acd66c3b92b04dd9cf5291f79 src/openrouter/components/legacy_websearchservertool.py: id: 8b28b05b8756 - last_write_checksum: sha1:2a917ce617b652fa9bc490d8f74e661480ff4f81 - pristine_git_object: 3b584a93c2329f2ff1c4b24a57abe0d238e35fcb + last_write_checksum: sha1:095d3da0b2df0584b7868452c57d0e4bb46bafac + pristine_git_object: b014aea366e98f389c9f2f30fdcd172ee3619edf src/openrouter/components/listbyokkeysresponse.py: id: d5f63cba5dd9 last_write_checksum: sha1:97cd54e94ba4996ebb43252ac31aa70511e0328c @@ -6798,6 +7080,10 @@ trackedFiles: id: e36ad7b5263e last_write_checksum: sha1:4aeab70302022153c511d68625d64d91d699fd3d pristine_git_object: d52ac13f673f5998b315547f515aac509ff7157a + src/openrouter/components/messagesfallbackparam.py: + id: 53ba6717a4cc + last_write_checksum: sha1:8652a951a6b53396444aa1d5202736cf4f96143b + pristine_git_object: 05b041967edf0ab2d8458f9f0fc3577f0a55fcfc src/openrouter/components/messagesmessageparam.py: id: ed8bbab6720d last_write_checksum: sha1:0f53182e86a40e39319eba4da2cbfc14cbd97a3e @@ -6808,20 +7094,24 @@ trackedFiles: pristine_git_object: a5410bd961e2ce450b97e6a5702a336731b2e0ab src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:66dafe0b56379f70dd281f374e940f92dbfb225f - pristine_git_object: fc1f1dbb56c1de4cfd5d28058201ca5309a0e3cb + last_write_checksum: sha1:a03c557fca983279521c04f710310f09195a5d6f + pristine_git_object: 2f93bcfcd69ae20ca260631e4d218db6f5b5ee8f src/openrouter/components/metadatalevel.py: id: 0eede47eef62 last_write_checksum: sha1:b4e7e6fc4e9016b65008e9ebbfcc6f018fe89ced pristine_git_object: 1257b38d2001f34078cd1b052c20264e81a95e57 src/openrouter/components/model.py: id: cef3adaa772b - last_write_checksum: sha1:091b93cae931939e83e2fdcbf86f72ff36e9344a - pristine_git_object: 53fc43004c15681897f637536c1f8a023bee953c + last_write_checksum: sha1:53eb4a044a7bf546225416bb08597df46a3b60a2 + pristine_git_object: 637b3fbe54ddcc454750d8de702045ee690c3333 src/openrouter/components/modelarchitecture.py: id: b37ac27e512b last_write_checksum: sha1:e1dd41aa140b2ca2c3bbf15abf74e034d42b0166 pristine_git_object: 2da26c7abc1b7e2b895a056c72d90bf8c8efa6b4 + src/openrouter/components/modelbenchmarks.py: + id: efd0b01b6775 + last_write_checksum: sha1:3cd5ff77d780c3b9ddbeea46e345fcb77ba7a829 + pristine_git_object: 37d57a208efec04590ecbe69485e2b70a13dbcab src/openrouter/components/modelgroup.py: id: ffb5492b0d39 last_write_checksum: sha1:75da0e0a977d4fd2908506683548c7a8c878b869 @@ -6830,6 +7120,10 @@ trackedFiles: id: b8759a1a4787 last_write_checksum: sha1:69b2c991666848f4790e5136c67553733cc68a54 pristine_git_object: c197cb2c527296adff2c3cfd9e49bcbc48087ce7 + src/openrouter/components/modelresponse.py: + id: 023136e6dedf + last_write_checksum: sha1:af84587984cbe6341f59f176b08df43096ac48c6 + pristine_git_object: 567bdc9a4181271486d015c3f9be12e33b51d12a src/openrouter/components/modelscountresponse.py: id: c08f960ac611 last_write_checksum: sha1:82669f5aa9379f6c90393ea0b78f2bafdce545df @@ -7056,8 +7350,8 @@ trackedFiles: pristine_git_object: 897c4727eec2497fe15e5603187e24218c08ac87 src/openrouter/components/outputitems.py: id: 90f107de3116 - last_write_checksum: sha1:e899a996bb5d48ce8088035141a74414ab54b83a - pristine_git_object: 8eff2c70ff7f2801d490e6e37298ddf3d402f205 + last_write_checksum: sha1:31923f8d495bcd6b48594217cff463b5f868ecbb + pristine_git_object: a7d056e30ef0b1035d5d2e020505821dbc638143 src/openrouter/components/outputmcpservertoolitem.py: id: bb8c2536a58e last_write_checksum: sha1:6cbe556b2268af0142d982007b273cc43b7605c7 @@ -7098,6 +7392,10 @@ trackedFiles: id: 9962f4d291a9 last_write_checksum: sha1:58a7a14968db8a009756f93f8b37071ee2b169a7 pristine_git_object: fca6bbd43fe7716ba4ab12bd9ee9d016c3c62800 + src/openrouter/components/outputsubagentservertoolitem.py: + id: 7480e835aa08 + last_write_checksum: sha1:ca9160c28b0f21992ad64925b587f13a4fee0756 + pristine_git_object: 35e06653f101cc5a4cd4cb173818e75fe2e52bce src/openrouter/components/outputtexteditorservertoolitem.py: id: 2a5dc9318fe6 last_write_checksum: sha1:75ce53e78b352b0427acfb5310b2500ee76351dd @@ -7192,12 +7490,12 @@ trackedFiles: pristine_git_object: cb5c91085cd5934b4f855a06a7c6e66c891cc32b src/openrouter/components/preview_20250311_websearchservertool.py: id: ecfe1a37c34f - last_write_checksum: sha1:0f1409a07771fe8ae5c7be7130a75424ecd7de5f - pristine_git_object: 2f0cd464f6e9c118472c9fa2365456e5522f285d + last_write_checksum: sha1:5b4c33aae7e9d7ac6e052fd14cb3cc87ba3c1901 + pristine_git_object: 49029cfc65ec0f596ee3d9738c2a24c51251bed6 src/openrouter/components/preview_websearchservertool.py: id: 9c02777285ce - last_write_checksum: sha1:1921201f0eaee55ac342d6ab987e9ece535c598d - pristine_git_object: 434b214eef98bac64bfe51f0c511d5b5030180f3 + last_write_checksum: sha1:ee4c8a04d68b52cb337aebc446e815ff4606a76f + pristine_git_object: c0682b33abc6cc6b031c2bb492eb6e2b64e55ca2 src/openrouter/components/preview_websearchuserlocation.py: id: 40414eada27a last_write_checksum: sha1:52707a8a06e2c03a4c671f909e42c6d1da6dabed @@ -7252,8 +7550,8 @@ trackedFiles: pristine_git_object: 7325fa4619692b4c395e6b6d068519bd37d4b063 src/openrouter/components/rankingsdailymeta.py: id: 067dec7d316a - last_write_checksum: sha1:56d4331dc516624c2c7084c26b5043b0a0458a57 - pristine_git_object: df1ae5d889c2b8d5608964f9da92be651be6cb67 + last_write_checksum: sha1:2993b72319acc7dd79ae670539ce5dcea3dd9353 + pristine_git_object: 956291592f17cfd10c446185349d81711cdb1384 src/openrouter/components/rankingsdailyresponse.py: id: dcdb3308ad5d last_write_checksum: sha1:e7c0e4a022ad6aedd4ed21bbc0eb0160b1dae70a @@ -7356,8 +7654,8 @@ trackedFiles: pristine_git_object: d3c77624292ba0985104a6125e462c305a633d84 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:99fbe103f2e3de8ecfc1fb2ed767082605896237 - pristine_git_object: 6f285c26c1a9857044e1dc57e1dceb004108a4d5 + last_write_checksum: sha1:f3943c6484819e73eafb9baaa6ee56bfe2fb0ae7 + pristine_git_object: 8f4b2a3e17f49d7059cd5427e65d76a41f3a380b src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -7384,8 +7682,8 @@ trackedFiles: pristine_git_object: 559ecad60dc51d3a30a5b40421fd0e1e5db2aaed src/openrouter/components/searchqualitylevel.py: id: 8fdb148edfb2 - last_write_checksum: sha1:c48540ecaa98b3e1bff1d2ba8f8425f10990f476 - pristine_git_object: 27deefd8a7092a2a0a0c31e77147d40750aafe4b + last_write_checksum: sha1:05a1ae3b774381f4d20f62c02cd413125be4c321 + pristine_git_object: 450aea60f799bd4eb7e8e53e9fa24a376062c62f src/openrouter/components/security.py: id: ae2ca334218a last_write_checksum: sha1:e6bfa94172df4c823ed9dd83b9b2614e6890d462 @@ -7506,6 +7804,22 @@ trackedFiles: id: abe8329af787 last_write_checksum: sha1:213749fb8f5389bc607b75300b6fcff714c83b6d pristine_git_object: c7661d13e6970fcb82970968a85d5e8507bc0c0e + src/openrouter/components/subagentnestedtool.py: + id: 911a465973a0 + last_write_checksum: sha1:5b58207526a92f946b0ee20248d194f4289e2939 + pristine_git_object: 8e1417b1cf116bf26060143dcab214d2623bddcf + src/openrouter/components/subagentreasoning.py: + id: 2715ebf26eb3 + last_write_checksum: sha1:40e3041f4cf9ac8b4371e6351686cbf537d17da1 + pristine_git_object: 1eb4e862985164f2e48b53dd0119d42bf8bed25e + src/openrouter/components/subagentservertool_openrouter.py: + id: f08524c6985a + last_write_checksum: sha1:771b71aae9989727ea3564615f06da7f08431705 + pristine_git_object: a33e7690f45117da788ddfabe9ad4102ac3605d0 + src/openrouter/components/subagentservertoolconfig.py: + id: a8425c790cb6 + last_write_checksum: sha1:a885325a7612357dbb9454400433cc485e6ca420 + pristine_git_object: 27bb1e45236dcdda4d14d5c09bac867d86cf1ace src/openrouter/components/textdeltaevent.py: id: 6d1d416a373d last_write_checksum: sha1:9a024e07b3f2d65d5f88e01f0e2035efd956f3fc @@ -7640,36 +7954,36 @@ trackedFiles: pristine_git_object: adceee794cf8135f5db3b2d741dc6e4de9c4e968 src/openrouter/components/websearchconfig.py: id: 3884d9509e8c - last_write_checksum: sha1:cbfdd9cc0abfbe8438c0602dd8a29d1a04d206b2 - pristine_git_object: 6db24abe2002d7628210d1417dd74ea393d1f091 + last_write_checksum: sha1:905976be4b26f36ed952f664e5a72d57080318e4 + pristine_git_object: 5007c57c30ee110222b60fcfbae4a2a97edb7c88 src/openrouter/components/websearchdomainfilter.py: id: 4a7307ed2ba6 last_write_checksum: sha1:043839dada28f82b33f70534895e98e7ee6ce7f5 pristine_git_object: 64d3c5f2138e19cbe4f4444e006ac826be48d808 src/openrouter/components/websearchengine.py: id: 9e028088afc7 - last_write_checksum: sha1:d549940c1ee74aa82d7aff4ff3ce6846a8ff20f1 - pristine_git_object: 992db72e3236a262e2d93d2ed58f0ae44cc194bc + last_write_checksum: sha1:cd81a891b0304187d5abbb7e9972543333e51bf8 + pristine_git_object: 5d67b4f2aa8dd9375b5fdff61d4c7f4d8bc01379 src/openrouter/components/websearchengineenum.py: id: 97803317b825 - last_write_checksum: sha1:4159789e76774df1a714b995d644011c49168d79 - pristine_git_object: 90a22b964f3d318b9f5080f316d7fd171058c7e9 + last_write_checksum: sha1:f3c03768c47a20eece5f58e1043a8dafb13a4c59 + pristine_git_object: aba36c1943f9b8e57d5e6f95d8b707263d95f738 src/openrouter/components/websearchplugin.py: id: 1d872d1792a7 last_write_checksum: sha1:824232ea50b6befbbfae9537d44c42fa2b84b26e pristine_git_object: 3c8e46d68d02d7b60ccfbfc9ebcbcc92a443bd54 src/openrouter/components/websearchservertool.py: id: 32c7333e3c21 - last_write_checksum: sha1:57f9a9d65715b12f0ad7ddf88690b9eb656b074b - pristine_git_object: 363a4ea93e4eff5ac708bd2eb69aa6aada986075 + last_write_checksum: sha1:34a7dd2298f89bd99b9e80f5b84dd7f5ab8683c8 + pristine_git_object: 490580967147a0e1f567fe1887aefb24ee8382cc src/openrouter/components/websearchservertool_openrouter.py: id: 3fcedc999f5b last_write_checksum: sha1:81c68c3a06f55fee5b6cf18730f3bb0141d168a4 pristine_git_object: c5717ed5a3d7adf2ef2777ed76233365c1d5b443 src/openrouter/components/websearchservertoolconfig.py: id: ebdaa99d47da - last_write_checksum: sha1:b9f17b263990249cfdbc238c902dde7c52241c43 - pristine_git_object: e5aeae2ff37595892059bbd06a23043f8e83f781 + last_write_checksum: sha1:12148500949091abc600772278cabc30abbbd031 + pristine_git_object: 5ca754c459e5babd1bfac8ec876c7edd4c146382 src/openrouter/components/websearchsource.py: id: a1fe81b68a7b last_write_checksum: sha1:fa30e5813682231d742fb6861f0fe92f655c8e81 @@ -7700,8 +8014,8 @@ trackedFiles: pristine_git_object: 0a376fb8ee2df0be8546458e0008a2fbc0fd492a src/openrouter/datasets.py: id: 2378f80d1d6a - last_write_checksum: sha1:057b0dde4e051f2cf5cd9fd5b82bbe45eb8fafc5 - pristine_git_object: c483912549b3243f73b300bcea343914e66ef211 + last_write_checksum: sha1:16857b6d0c5e815cfacb6db6eef804dd37493a38 + pristine_git_object: c80a941f2da9bc4c71561fb804ca4e64dfb7c31b src/openrouter/embeddings.py: id: 0374ace39067 last_write_checksum: sha1:8622e7717ef639f2ee452d295c4b2c957a2fe13f @@ -7790,6 +8104,10 @@ trackedFiles: id: fac4aa89599e last_write_checksum: sha1:5505f65c29d570dee9ccbc7188b50b3d833c68fa pristine_git_object: d858f3b578b189d20b89d0dfc1a6b829ff5897ff + src/openrouter/files.py: + id: 7baf7ee1f5b3 + last_write_checksum: sha1:8186736d2d9586f07ba2a236e9524f171c466ce5 + pristine_git_object: 6af040bba3f2bd74a5950e073ef02d0e9a3c473d src/openrouter/generations.py: id: 70e1c21042bc last_write_checksum: sha1:f7df8719bf188b05a29b8694e6c2db7adb262bd3 @@ -7816,20 +8134,20 @@ trackedFiles: pristine_git_object: 701741bbf61e70c9dd84199249f2aa1192c30a18 src/openrouter/models_.py: id: 4e1ae1fe5b98 - last_write_checksum: sha1:ef0acdf22acb146b77781d968cc2cd366a507831 - pristine_git_object: b1f9143134e2e282d5beedd6ceb79c3dd68ceeb5 + last_write_checksum: sha1:e7a5e49a0ad303b7018d4aa00a4ed30ff9806f9f + pristine_git_object: 73133117083cd2ecd59fc9d74ac3763db724ff80 src/openrouter/oauth.py: id: 1948ce27255b - last_write_checksum: sha1:e847767a0718afa3d0cac8a3d0735d95e6892265 - pristine_git_object: ef6eb9aa10d9b067d96dad78a1d34f939c1091e8 + last_write_checksum: sha1:5e44e649bd946fb42c10b8a8f8fb9b6d894278e8 + pristine_git_object: 185de12d9f87d04c4fb7f0ca8c54dba9f62924d8 src/openrouter/observability.py: id: 6a17f32d3f33 last_write_checksum: sha1:1e31c36f61ec2a2c224c6ad0b0f5b2a09e758a3b pristine_git_object: 37ee42a638f5fce69fc7db1e6b86efb51f381582 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:cd29da201ac98881ca09ef4a62294d6802396c6d - pristine_git_object: 7c6acb80d98f0a89d7c63848e52a29a00e097d59 + last_write_checksum: sha1:c176f21f2e22db4d380804fe21bace36acbb49cf + pristine_git_object: 8013fe6327a4fa72324bfb4c92c761f14bdb069a src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:2b9c73dd8a24d6c479d50118a309e4e0969ca7ea @@ -7864,8 +8182,8 @@ trackedFiles: pristine_git_object: 01441144f8433569cb0846df23bbafc9b790a1de src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 - last_write_checksum: sha1:de809cb9a55efb7b22d033bace50344bf53696f4 - pristine_git_object: d3ef6c4b8374be3dfa5d807f879a430e50dc444e + last_write_checksum: sha1:87f7a4f6bceb89cec0c961e4ed57a20918a0b603 + pristine_git_object: 344b269c059ecaf93f8858694dc85e062c7425b5 src/openrouter/operations/createbyokkey.py: id: eaeefa9fe0c2 last_write_checksum: sha1:856828a03093b93a93edcc907531057f473e3447 @@ -7918,6 +8236,10 @@ trackedFiles: id: b1b2c6b06913 last_write_checksum: sha1:c6e283d2af7bf36388aaf91b6bd433b1605b2ca8 pristine_git_object: 08c3b34c3f8fe29087074fa2359080b3637af8c6 + src/openrouter/operations/deletefile.py: + id: 7035af059141 + last_write_checksum: sha1:0b9bc5395e72cb1a00240cae9643defcde0b4472 + pristine_git_object: 961175c5f8e02c50f4f2f20a3e0935f8bfad0fcb src/openrouter/operations/deleteguardrail.py: id: 1fbdb98bbb85 last_write_checksum: sha1:e245a5061592daf839d38caace9cc38abbce879d @@ -7934,6 +8256,10 @@ trackedFiles: id: f92017ce65e8 last_write_checksum: sha1:ac9aa22002cf938a69643dac44c38ab7d702c31c pristine_git_object: fbfef8826b9993d95d355ec0335f943e97a75bda + src/openrouter/operations/downloadfilecontent.py: + id: 6ff3d391a23f + last_write_checksum: sha1:a5848ffcbfeaa295c496e3a5a5527a7d236e6c4e + pristine_git_object: 3d4be3f79e0f677bd91164894c8a45d161bc6fe1 src/openrouter/operations/exchangeauthcodeforapikey.py: id: 37bdd1517a07 last_write_checksum: sha1:963c95a165a35ae235d9b03d31c4e029de0246d4 @@ -7946,6 +8272,14 @@ trackedFiles: id: 5ffd23dafcc1 last_write_checksum: sha1:c9011252cc7862d8c35b4ff2f3c82003c98953de pristine_git_object: d19ef64ed4dcc19027c95ba19c9b37ed301ebb72 + src/openrouter/operations/getbenchmarksartificialanalysis.py: + id: c967fd553338 + last_write_checksum: sha1:75aed29dbc8f9d41ba0eb3dabd077a2747018eb9 + pristine_git_object: 707ed91247e14983a8fdc1241b83c9512db9144f + src/openrouter/operations/getbenchmarksdesignarena.py: + id: b05492401be4 + last_write_checksum: sha1:fa36e7a28e19c67d8b72060ce85fa6c83e3b7ca9 + pristine_git_object: 2ac2aed2e814ba1a8dc6ad49d05ae582a42f149d src/openrouter/operations/getbyokkey.py: id: d141452bd88a last_write_checksum: sha1:16c33afc84cd0d3a68e977e739a59d14dfd3bd44 @@ -7958,6 +8292,10 @@ trackedFiles: id: baf3e38db22c last_write_checksum: sha1:9d59301c91d1a0056c8817195ea4e33d0ca68a08 pristine_git_object: 2d26173fd7e4555e188999eee1e282e85b68c73d + src/openrouter/operations/getfilemetadata.py: + id: 408c34486769 + last_write_checksum: sha1:c8eec522d3109c0c9376729fa438af918b2c29ea + pristine_git_object: 6a7ddf0774a233d065042406ca2067bd7b684ec1 src/openrouter/operations/getgeneration.py: id: d7c64961334f last_write_checksum: sha1:7c919236caf0943f145d584024a85bb663f0e911 @@ -7970,10 +8308,14 @@ trackedFiles: id: d9769da90865 last_write_checksum: sha1:511b994a0bd1241856b06184f05433bec3a16733 pristine_git_object: d2370a94a10fadec861d31e6fd1a9b2566e94d22 + src/openrouter/operations/getmodel.py: + id: 90c926cd726f + last_write_checksum: sha1:f09d4d15678f12e6110cad664349f392f3ef9ff2 + pristine_git_object: e45056283604220d3395365bedfbaa1d1df13095 src/openrouter/operations/getmodels.py: id: 5bd5dfcb0125 - last_write_checksum: sha1:77daf349415cd86fce63b94fbee5344850b01c79 - pristine_git_object: 288c8594750b28de72ec81299ffc36a42c8a683b + last_write_checksum: sha1:3788099c1b4727ae6f5cbceea1b8ee8420ee36df + pristine_git_object: 7491bf97c268b2e6de8838924f019c2cec552112 src/openrouter/operations/getobservabilitydestination.py: id: 15b49f22aca9 last_write_checksum: sha1:89cbc1ea42d52efd81f18ebe90094c204fbe88ad @@ -8022,6 +8364,10 @@ trackedFiles: id: 588bf206e92f last_write_checksum: sha1:6d8e90c542ae6344e403767a3a4f8ec5d1d4dc75 pristine_git_object: 23e735db74e27dc35e80b2f72cf386b0eeeb116d + src/openrouter/operations/listfiles.py: + id: fd89527f4236 + last_write_checksum: sha1:76a902a7cc595f6c1949a73068c72ebc0afb7b41 + pristine_git_object: 834ff78375ff803f605ed95a3e3f86f5961b3bc6 src/openrouter/operations/listgenerationcontent.py: id: 2f086d74631c last_write_checksum: sha1:922e30991bb7b3ef69e2672a2b969d74ce0b838d @@ -8088,8 +8434,8 @@ trackedFiles: pristine_git_object: 236dc188826db184deca4a749dab47e58c3dd637 src/openrouter/operations/queryanalytics.py: id: d76c63ff66f6 - last_write_checksum: sha1:3e1f7dffb9441705fcbe353ee1e1a46d3ca02b8f - pristine_git_object: fe4a010c49d57a5de816988706b10ea31bb935ef + last_write_checksum: sha1:e05ee800c16323bc17ac79f06977144990ec0b17 + pristine_git_object: 698b5f7c4639bd7309a3d2ad4fd8cf5c31b717bf src/openrouter/operations/sendchatcompletionrequest.py: id: d9fee71bb577 last_write_checksum: sha1:130a25fdb3f44490b68ca99153c0cccba25db87e @@ -8114,14 +8460,18 @@ trackedFiles: id: 2e9960985cbc last_write_checksum: sha1:88c11ee7a31bc5e2267981d882a01a2a71aafe55 pristine_git_object: 4ab7929896a5dede1fa4cf9ce6acfaedd99160aa + src/openrouter/operations/uploadfile.py: + id: f9dc565da045 + last_write_checksum: sha1:6ebd83512ef670b3a9201aa8518267ba243a3070 + pristine_git_object: 579e1df65e14d2416c7bad356524f788f4705c67 src/openrouter/organization.py: id: 6f4c63c416e8 last_write_checksum: sha1:4ca00158cd6a4971e7a4cf6da1ef084da25630d9 pristine_git_object: ad2e7f86b6138cf2b2137345155e2b3a5784fb46 src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:13029d26c65600f4b0198f294bdccd29fb71d7b3 - pristine_git_object: ab9e6ba6afa040493f70c882b152a994d1eee7d1 + last_write_checksum: sha1:e8ce79b2a8f66c69a5b4ae926cc57d7751044f3b + pristine_git_object: ae12a80da2520719fd06717796b8b8cc4a7d9354 src/openrouter/providers.py: id: debc4c48f149 last_write_checksum: sha1:f39f155f26e6f5e4fb5b7e0f577a8c49536f6bb3 @@ -8140,8 +8490,8 @@ trackedFiles: pristine_git_object: 944aff9aa812fff9b702d8735a37ea279d915a1d src/openrouter/sdk.py: id: ee9846c4c9c5 - last_write_checksum: sha1:4ea86de699eb1b480fbc5ef30bca6b9d900815d3 - pristine_git_object: ec179e1832688dd2045f53af1360bb37a39ad6b1 + last_write_checksum: sha1:b2d1f64ba5783c98dc31e15e23966d83abaa2d9d + pristine_git_object: abc46c8355ba5cd0fee2e8e1536ac90eda7aa1b4 src/openrouter/sdkconfiguration.py: id: 55773bb98d7c last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001 @@ -8786,6 +9136,8 @@ examples: application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} listOrganizationMembers: speakeasy-default-list-organization-members: responses: @@ -9410,5 +9762,133 @@ examples: application/json: {"error": {"code": 404, "message": "Resource not found"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getBenchmarksArtificialAnalysis: + speakeasy-default-get-benchmarks-artificial-analysis: + parameters: + query: + max_results: 20 + responses: + "200": + application/json: {"data": [{"aa_name": "GPT-4o", "agentic_index": 58.3, "coding_index": 65.8, "intelligence_index": 71.2, "model_permaslug": "openai/gpt-4o", "pricing": {"completion": "0.00001", "prompt": "0.0000025"}}], "meta": {"as_of": "2026-06-03T12:00:00Z", "citation": "Source: Artificial Analysis (artificialanalysis.ai) via OpenRouter (openrouter.ai/rankings).", "model_count": 1, "source": "artificial-analysis", "source_url": "https://artificialanalysis.ai", "version": "v1"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getBenchmarksDesignArena: + speakeasy-default-get-benchmarks-design-arena: + parameters: + query: + arena: "models" + max_results: 20 + responses: + "200": + application/json: {"data": [{"arena": "models", "avg_generation_time_ms": 3200, "category": "codecategories", "display_name": "Claude Sonnet 4", "elo": 1423, "model_permaslug": "anthropic/claude-sonnet-4", "pricing": {"completion": "0.000015", "prompt": "0.000003"}, "tournament_stats": {"first_place": 12, "fourth_place": 2, "second_place": 8, "third_place": 5, "total": 27}, "win_rate": 72}], "meta": {"arena": "models", "as_of": "2026-06-03T12:00:00Z", "category": null, "citation": "Source: Design Arena (www.designarena.ai) via OpenRouter (openrouter.ai/rankings).", "elo_bounds": {"max": 1600, "min": 900}, "model_count": 1, "source": "design-arena", "source_url": "https://www.designarena.ai", "version": "v1"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listFiles: + speakeasy-default-list-files: + responses: + "200": + application/json: {"cursor": null, "data": [{"created_at": "2025-01-01T00:00:00Z", "downloadable": false, "filename": "document.pdf", "id": "file_011CNha8iCJcU1wXNR6q4V8w", "mime_type": "application/pdf", "size_bytes": 1024000, "type": "file"}], "first_id": "file_011CNha8iCJcU1wXNR6q4V8w", "has_more": false, "last_id": "file_011CNha8iCJcU1wXNR6q4V8w"} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + uploadFile: + speakeasy-default-upload-file: + requestBody: + multipart/form-data: {"file": "x-file: example.file"} + responses: + "200": + application/json: {"created_at": "2025-01-01T00:00:00Z", "downloadable": false, "filename": "document.pdf", "id": "file_011CNha8iCJcU1wXNR6q4V8w", "mime_type": "application/pdf", "size_bytes": 1024000, "type": "file"} + "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"}} + "413": + application/json: {"error": {"code": 413, "message": "Request payload too large"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteFile: + speakeasy-default-delete-file: + parameters: + path: + file_id: "file_011CNha8iCJcU1wXNR6q4V8w" + responses: + "200": + application/json: {"id": "file_011CNha8iCJcU1wXNR6q4V8w", "type": "file_deleted"} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "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"}} + getFileMetadata: + speakeasy-default-get-file-metadata: + parameters: + path: + file_id: "file_011CNha8iCJcU1wXNR6q4V8w" + responses: + "200": + application/json: {"created_at": "2025-01-01T00:00:00Z", "downloadable": false, "filename": "document.pdf", "id": "file_011CNha8iCJcU1wXNR6q4V8w", "mime_type": "application/pdf", "size_bytes": 1024000, "type": "file"} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "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"}} + downloadFileContent: + speakeasy-default-download-file-content: + parameters: + path: + file_id: "file_011CNha8iCJcU1wXNR6q4V8w" + responses: + "200": + application/octet-stream: "x-file: example.file" + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "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"}} + getModel: + speakeasy-default-get-model: + parameters: + path: + author: "openai" + slug: "gpt-4" + responses: + "200": + application/json: {"data": {"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": {}, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-5.4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens"], "supported_voices": null, "top_provider": {"is_moderated": true}}} + "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.chat.send()`: \n * `request` **Changed** **Breaking** :warning:\n * `response` **Changed**\n * `error` **Changed**\n* `open_router.video_generation.generate()`: \n * `request` **Changed** **Breaking** :warning:\n * `error.openrouter_metadata` **Added**\n* `open_router.beta.responses.send()`: \n * `request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n * `error` **Changed**\n* `open_router.rerank.rerank()`: \n * `request.documents.[]` **Changed** **Breaking** :warning:\n * `response.results.[].document` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.generations.get_generation()`: \n * `response.data` **Changed** **Breaking** :warning:\n * `error.openrouter_metadata` **Added**\n* `open_router.o_auth.create_auth_code()`: `error.openrouter_metadata` **Added**\n* `open_router.endpoints.list()`: `error.openrouter_metadata` **Added**\n* `open_router.embeddings.list_models()`: \n * `response.data.[].supported_voices` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.byok.update()`: **Added**\n* `open_router.datasets.get_app_rankings()`: **Added**\n* `open_router.datasets.get_rankings_daily()`: **Added**\n* `open_router.generations.list_generation_content()`: **Added**\n* `open_router.observability.list()`: **Added**\n* `open_router.observability.create()`: **Added**\n* `open_router.observability.delete()`: **Added**\n* `open_router.observability.get()`: **Added**\n* `open_router.observability.update()`: **Added**\n* `open_router.presets.list()`: **Added**\n* `open_router.presets.get()`: **Added**\n* `open_router.presets.create_presets_chat_completions()`: **Added**\n* `open_router.presets.create_presets_messages()`: **Added**\n* `open_router.presets.create_presets_responses()`: **Added**\n* `open_router.presets.list_versions()`: **Added**\n* `open_router.presets.get_version()`: **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.analytics.get_user_activity()`: `error.openrouter_metadata` **Added**\n* `open_router.o_auth.exchange_auth_code_for_api_key()`: `error.openrouter_metadata` **Added**\n* `open_router.beta.analytics.get_analytics_meta()`: **Added**\n* `open_router.byok.create()`: **Added**\n* `open_router.credits.get_credits()`: `error.openrouter_metadata` **Added**\n* `open_router.embeddings.generate()`: \n * `request.input.[array].[].content.[]` **Changed**\n * `response.usage.prompt_tokens_details` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.byok.get()`: **Added**\n* `open_router.byok.delete()`: **Added**\n* `open_router.guardrails.list_guardrail_key_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.byok.list()`: **Added**\n* `open_router.guardrails.list()`: \n * `request.workspace_id` **Added**\n * `response.data.[]` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.guardrails.create()`: \n * `request` **Changed**\n * `response.data` **Changed**\n * `error` **Changed**\n* `open_router.guardrails.delete()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.get()`: \n * `response.data` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.guardrails.update()`: \n * `request` **Changed**\n * `response.data` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_assign_keys()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_unassign_keys()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.list_guardrail_member_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_assign_members()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_unassign_members()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.list_key_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.list_member_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.api_keys.get_current_key_metadata()`: `error.openrouter_metadata` **Added**\n* `open_router.api_keys.list()`: \n * `request.workspace_id` **Added**\n * `response.data.[].workspace_id` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.api_keys.create()`: \n * `request.workspace_id` **Added**\n * `response.data.workspace_id` **Added**\n * `error` **Changed**\n* `open_router.api_keys.delete()`: `error.openrouter_metadata` **Added**\n* `open_router.api_keys.get()`: \n * `response.data.workspace_id` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.api_keys.update()`: \n * `response.data.workspace_id` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.models.list()`: \n * `request.sort` **Added**\n * `response.data.[].supported_voices` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.models.count()`: `error.openrouter_metadata` **Added**\n* `open_router.models.list_for_user()`: \n * `response.data.[].supported_voices` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.organization.list_members()`: `error.openrouter_metadata` **Added**\n* `open_router.providers.list()`: `error.openrouter_metadata` **Added**\n* `open_router.stt.create_transcription()`: **Added**\n* `open_router.tts.create_speech()`: **Added**\n* `open_router.beta.analytics.query_analytics()`: **Added**\n* `open_router.video_generation.get_generation()`: `error.openrouter_metadata` **Added**\n* `open_router.video_generation.get_video_content()`: `error.openrouter_metadata` **Added**\n* `open_router.video_generation.list_videos_models()`: `error.openrouter_metadata` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n* `open_router.presets.create_presets_responses()`: `request` **Changed** **Breaking** :warning:\n* `open_router.presets.create_presets_chat_completions()`: `request` **Changed** **Breaking** :warning:\n* `open_router.chat.send()`: `request` **Changed** **Breaking** :warning:\n* `open_router.files.delete()`: **Added**\n* `open_router.files.retrieve()`: **Added**\n* `open_router.files.download()`: **Added**\n* `open_router.models.get()`: **Added**\n* `open_router.datasets.get_benchmarks_artificial_analysis()`: **Added**\n* `open_router.o_auth.create_auth_code()`: \n * `request.workspace_id` **Added**\n * `error.status[403]` **Added**\n* `open_router.files.upload()`: **Added**\n* `open_router.embeddings.list_models()`: `response.data.[].benchmarks` **Added**\n* `open_router.models.list()`: \n * `request` **Changed**\n * `response.data.[].benchmarks` **Added**\n* `open_router.models.list_for_user()`: `response.data.[].benchmarks` **Added**\n* `open_router.files.list()`: **Added**\n* `open_router.presets.create_presets_messages()`: `request.fallbacks` **Added**\n* `open_router.datasets.get_benchmarks_design_arena()`: **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index a104a8b..652ef6c 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.9.2 + version: 0.10.0 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index c34dd86..27f25b8 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -23,6 +23,36 @@ components: description: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. schemas: + AABenchmarkEntry: + description: Artificial Analysis benchmark index scores. + example: + agentic_index: 55.8 + coding_index: 63.2 + intelligence_index: 71.4 + properties: + agentic_index: + description: Artificial Analysis Agentic Index score + example: 55.8 + format: double + nullable: true + type: number + coding_index: + description: Artificial Analysis Coding Index score + example: 63.2 + format: double + nullable: true + type: number + intelligence_index: + description: Artificial Analysis Intelligence Index score + example: 71.4 + format: double + nullable: true + type: number + required: + - intelligence_index + - coding_index + - agentic_index + type: object ActivityItem: example: byok_usage_inference: 0.012 @@ -123,14 +153,10 @@ components: additionalProperties: nullable: true description: >- - A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself. + A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself. example: type: openrouter:web_search properties: - function: - additionalProperties: - nullable: true - type: object parameters: additionalProperties: nullable: true @@ -234,7 +260,7 @@ components: type: number tools: description: >- - Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself. + Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself. items: $ref: '#/components/schemas/AdvisorNestedTool' type: array @@ -1210,6 +1236,8 @@ components: allOf: - $ref: '#/components/schemas/AnthropicBaseUsageIteration' - properties: + model: + type: string type: enum: - message @@ -3598,6 +3626,349 @@ components: oneOf: - $ref: '#/components/schemas/ContainerAutoEnvironment' - $ref: '#/components/schemas/ContainerReferenceEnvironment' + BenchmarkPricing: + description: OpenRouter pricing per token for this model. Null if pricing is unavailable. + example: + completion: '0.000015' + prompt: '0.000003' + nullable: true + properties: + completion: + description: Cost per output token (USD, decimal string). + example: '0.000015' + type: string + prompt: + description: Cost per input token (USD, decimal string). + example: '0.000003' + type: string + required: + - prompt + - completion + type: object + BenchmarksAAItem: + example: + aa_name: GPT-4o + agentic_index: 58.3 + coding_index: 65.8 + intelligence_index: 71.2 + model_permaslug: openai/gpt-4o + pricing: + completion: '0.00001' + prompt: '0.0000025' + properties: + aa_name: + description: Model name as listed on Artificial Analysis. + example: GPT-4o + type: string + agentic_index: + description: Artificial Analysis Agentic Index composite score. Higher is better. + example: 58.3 + format: double + nullable: true + type: number + coding_index: + description: Artificial Analysis Coding Index composite score. Higher is better. + example: 65.8 + format: double + nullable: true + type: number + intelligence_index: + description: Artificial Analysis Intelligence Index composite score. Higher is better. + example: 71.2 + format: double + nullable: true + type: number + model_permaslug: + description: Stable OpenRouter model identifier. + example: openai/gpt-4o + type: string + pricing: + $ref: '#/components/schemas/BenchmarkPricing' + required: + - model_permaslug + - aa_name + - intelligence_index + - coding_index + - agentic_index + - pricing + type: object + BenchmarksAAMeta: + example: + as_of: '2026-06-03T12:00:00Z' + citation: 'Source: Artificial Analysis (artificialanalysis.ai) via OpenRouter (openrouter.ai/rankings).' + model_count: 50 + source: artificial-analysis + source_url: https://artificialanalysis.ai + version: v1 + properties: + as_of: + description: ISO-8601 timestamp of when this data was last updated. + example: '2026-06-03T12:00:00Z' + type: string + citation: + description: Required attribution when republishing this data. + example: 'Source: Artificial Analysis (artificialanalysis.ai) via OpenRouter (openrouter.ai/rankings).' + type: string + model_count: + description: Number of unique models in the response. + type: integer + source: + description: Data source identifier. + enum: + - artificial-analysis + type: string + source_url: + description: URL of the upstream data source. + enum: + - https://artificialanalysis.ai + type: string + version: + description: Dataset version. + enum: + - v1 + type: string + required: + - as_of + - version + - source + - source_url + - citation + - model_count + type: object + BenchmarksAAResponse: + example: + data: + - aa_name: GPT-4o + agentic_index: 58.3 + coding_index: 65.8 + intelligence_index: 71.2 + model_permaslug: openai/gpt-4o + pricing: + completion: '0.00001' + prompt: '0.0000025' + meta: + as_of: '2026-06-03T12:00:00Z' + citation: 'Source: Artificial Analysis (artificialanalysis.ai) via OpenRouter (openrouter.ai/rankings).' + model_count: 1 + source: artificial-analysis + source_url: https://artificialanalysis.ai + version: v1 + properties: + data: + items: + $ref: '#/components/schemas/BenchmarksAAItem' + type: array + meta: + $ref: '#/components/schemas/BenchmarksAAMeta' + required: + - data + - meta + type: object + BenchmarksDAItem: + example: + arena: models + avg_generation_time_ms: 3200 + category: codecategories + display_name: Claude Sonnet 4 + elo: 1423 + model_permaslug: anthropic/claude-sonnet-4 + pricing: + completion: '0.000015' + prompt: '0.000003' + tournament_stats: + first_place: 12 + fourth_place: 2 + second_place: 8 + third_place: 5 + total: 27 + win_rate: 72 + properties: + arena: + description: Arena this ranking belongs to. + example: models + type: string + avg_generation_time_ms: + description: Average generation time in milliseconds. + example: 3200 + format: double + nullable: true + type: number + category: + description: Category within the arena. + example: codecategories + type: string + display_name: + description: Human-readable model name from Design Arena. + example: Claude Sonnet 4 + type: string + elo: + description: ELO rating from head-to-head arena battles. + example: 1423 + format: double + type: number + model_permaslug: + description: >- + Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models. + example: anthropic/claude-sonnet-4 + type: string + pricing: + $ref: '#/components/schemas/BenchmarkPricing' + tournament_stats: + description: Placement distribution from tournament matches. + properties: + first_place: + nullable: true + type: integer + fourth_place: + nullable: true + type: integer + second_place: + nullable: true + type: integer + third_place: + nullable: true + type: integer + total: + nullable: true + type: integer + required: + - first_place + - second_place + - third_place + - fourth_place + - total + type: object + win_rate: + description: Win rate as a percentage (0–100). + example: 72 + format: double + type: number + required: + - model_permaslug + - display_name + - arena + - category + - elo + - win_rate + - avg_generation_time_ms + - tournament_stats + - pricing + type: object + BenchmarksDAMeta: + example: + arena: models + as_of: '2026-06-03T12:00:00Z' + category: null + citation: 'Source: Design Arena (www.designarena.ai) via OpenRouter (openrouter.ai/rankings).' + elo_bounds: + max: 1600 + min: 900 + model_count: 50 + source: design-arena + source_url: https://www.designarena.ai + version: v1 + properties: + arena: + description: The arena filter applied. + type: string + as_of: + description: ISO-8601 timestamp of when this data was generated. + example: '2026-06-03T12:00:00Z' + type: string + category: + description: The category filter applied, or null if showing all. + nullable: true + type: string + citation: + description: Required attribution when republishing this data. + example: 'Source: Design Arena (www.designarena.ai) via OpenRouter (openrouter.ai/rankings).' + type: string + elo_bounds: + description: ELO range across all returned models for normalization. + properties: + max: + description: Maximum ELO in the result set. + format: double + type: number + min: + description: Minimum ELO in the result set. + format: double + type: number + required: + - min + - max + type: object + model_count: + description: Number of unique models in the response. + type: integer + source: + description: Data source identifier. + enum: + - design-arena + type: string + source_url: + description: URL of the upstream data source. + enum: + - https://www.designarena.ai + type: string + version: + description: Dataset version. + enum: + - v1 + type: string + required: + - as_of + - version + - source + - source_url + - citation + - model_count + - arena + - category + - elo_bounds + type: object + BenchmarksDAResponse: + example: + data: + - arena: models + avg_generation_time_ms: 3200 + category: codecategories + display_name: Claude Sonnet 4 + elo: 1423 + model_permaslug: anthropic/claude-sonnet-4 + pricing: + completion: '0.000015' + prompt: '0.000003' + tournament_stats: + first_place: 12 + fourth_place: 2 + second_place: 8 + third_place: 5 + total: 27 + win_rate: 72 + meta: + arena: models + as_of: '2026-06-03T12:00:00Z' + category: null + citation: 'Source: Design Arena (www.designarena.ai) via OpenRouter (openrouter.ai/rankings).' + elo_bounds: + max: 1600 + min: 900 + model_count: 1 + source: design-arena + source_url: https://www.designarena.ai + version: v1 + properties: + data: + items: + $ref: '#/components/schemas/BenchmarksDAItem' + type: array + meta: + $ref: '#/components/schemas/BenchmarksDAMeta' + required: + - data + - meta + type: object BigNumberUnion: description: Price per million prompt tokens example: 1000 @@ -4422,6 +4793,7 @@ components: - $ref: '#/components/schemas/DatetimeServerTool' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' - $ref: '#/components/schemas/WebFetchServerTool' - $ref: '#/components/schemas/OpenRouterWebSearchServerTool' - $ref: '#/components/schemas/ChatWebSearchShorthand' @@ -4624,6 +4996,13 @@ components: session_id: session-456 user_id: user-123 type: object + min_p: + description: >- + Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. + example: 0.1 + format: double + nullable: true + type: number modalities: description: Output modalities for the response. Supported values are "text", "image", and "audio". example: @@ -4704,6 +5083,28 @@ components: summary: $ref: '#/components/schemas/ChatReasoningSummaryVerbosityEnum' type: object + reasoning_effort: + description: >- + Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + enum: + - xhigh + - high + - medium + - low + - minimal + - none + - null + example: medium + nullable: true + type: string + x-speakeasy-unknown-values: allow + repetition_penalty: + description: >- + Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. + example: 1 + format: double + nullable: true + type: number response_format: description: Response format configuration discriminator: @@ -4785,6 +5186,19 @@ components: items: $ref: '#/components/schemas/ChatFunctionTool' type: array + top_a: + description: >- + Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter. + example: 0 + format: double + nullable: true + type: number + top_k: + description: >- + Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. + example: 40 + nullable: true + type: integer top_logprobs: description: Number of top log probabilities to return (0-20) example: 5 @@ -5402,7 +5816,7 @@ components: properties: allowed_domains: description: >- - Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains. + Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains. items: type: string type: array @@ -5410,18 +5824,18 @@ components: $ref: '#/components/schemas/WebSearchEngineEnum' excluded_domains: description: >- - Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains. + Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains. items: type: string type: array max_characters: description: >- - Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel). + Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity). example: 2000 type: integer max_results: description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. example: 5 type: integer max_total_results: @@ -6710,6 +7124,44 @@ components: id: ctco-abc123 output: patch applied successfully type: custom_tool_call_output + DABenchmarkEntry: + description: A single Design Arena benchmark entry for a specific arena+category + example: + arena: models + category: website + elo: 1385.2 + rank: 5 + win_rate: 62.5 + properties: + arena: + description: Arena type (e.g. models, builders, agents) + example: models + type: string + category: + description: Category within the arena (e.g. website, gamedev, uicomponent) + example: website + type: string + elo: + description: ELO rating from head-to-head arena battles + example: 1385.2 + format: double + type: number + rank: + description: Rank position within this arena+category among models available on OpenRouter (1 = highest ELO) + example: 5 + type: integer + win_rate: + description: Win rate percentage in arena battles + example: 62.5 + format: double + type: number + required: + - arena + - category + - elo + - win_rate + - rank + type: object DatetimeServerTool: description: 'OpenRouter built-in server tool: returns the current date and time' example: @@ -7048,46 +7500,137 @@ components: - filename - index type: object - FileParserPlugin: + FileDeleteResponse: + description: Confirmation that a file was deleted. example: - enabled: true - id: file-parser - pdf: - engine: cloudflare-ai + id: file_011CNha8iCJcU1wXNR6q4V8w + type: file_deleted properties: - enabled: - description: Set to false to disable the file-parser plugin for this request. Defaults to true. - type: boolean id: + type: string + type: enum: - - file-parser + - file_deleted type: string - pdf: - $ref: '#/components/schemas/PDFParserOptions' required: - id + - type type: object - FilePath: + FileListResponse: + description: A page of files belonging to the requesting workspace. example: - file_id: file-xyz789 - index: 0 - type: file_path + cursor: null + data: + - created_at: '2025-01-01T00:00:00Z' + downloadable: false + filename: document.pdf + id: file_011CNha8iCJcU1wXNR6q4V8w + mime_type: application/pdf + size_bytes: 1024000 + type: file + first_id: file_011CNha8iCJcU1wXNR6q4V8w + has_more: false + last_id: file_011CNha8iCJcU1wXNR6q4V8w properties: - file_id: + cursor: + description: Opaque cursor for the next page; null when there are no more results. + nullable: true type: string - index: - type: integer - type: - enum: - - file_path + data: + items: + $ref: '#/components/schemas/FileMetadata' + type: array + first_id: + nullable: true + type: string + has_more: + type: boolean + last_id: + nullable: true type: string required: - - type - - file_id - - index + - data + - has_more + - first_id + - last_id + - cursor type: object - FileSearchServerTool: - description: File search tool configuration + FileMetadata: + description: Metadata describing a stored file. + example: + created_at: '2025-01-01T00:00:00Z' + downloadable: false + filename: document.pdf + id: file_011CNha8iCJcU1wXNR6q4V8w + mime_type: application/pdf + size_bytes: 1024000 + type: file + properties: + created_at: + type: string + downloadable: + type: boolean + filename: + type: string + id: + type: string + mime_type: + type: string + size_bytes: + type: integer + type: + enum: + - file + type: string + required: + - id + - type + - filename + - mime_type + - size_bytes + - created_at + - downloadable + type: object + FileParserPlugin: + example: + enabled: true + id: file-parser + pdf: + engine: cloudflare-ai + properties: + enabled: + description: Set to false to disable the file-parser plugin for this request. Defaults to true. + type: boolean + id: + enum: + - file-parser + type: string + pdf: + $ref: '#/components/schemas/PDFParserOptions' + required: + - id + type: object + FilePath: + example: + file_id: file-xyz789 + index: 0 + type: file_path + properties: + file_id: + type: string + index: + type: integer + type: + enum: + - file_path + type: string + required: + - type + - file_id + - index + type: object + FileSearchServerTool: + description: File search tool configuration example: type: file_search vector_store_ids: @@ -9203,6 +9746,7 @@ components: - $ref: '#/components/schemas/OutputMcpServerToolItem' - $ref: '#/components/schemas/OutputSearchModelsServerToolItem' - $ref: '#/components/schemas/OutputAdvisorServerToolItem' + - $ref: '#/components/schemas/OutputSubagentServerToolItem' - $ref: '#/components/schemas/LocalShellCallItem' - $ref: '#/components/schemas/LocalShellCallOutputItem' - $ref: '#/components/schemas/ShellCallItem' @@ -9421,7 +9965,7 @@ components: $ref: '#/components/schemas/WebSearchDomainFilter' max_results: description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. example: 5 type: integer search_context_size: @@ -10465,6 +11009,19 @@ components: - type - error type: object + MessagesFallbackParam: + additionalProperties: + nullable: true + description: >- + Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected. + example: + model: claude-opus-4-8 + properties: + model: + type: string + required: + - model + type: object MessagesMessageParam: description: Anthropic message with OpenRouter extensions example: @@ -10810,6 +11367,15 @@ components: type: object type: array type: object + fallbacks: + description: >- + Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. + example: + - model: claude-opus-4-8 + items: + $ref: '#/components/schemas/MessagesFallbackParam' + nullable: true + type: array max_tokens: type: integer messages: @@ -11541,6 +12107,8 @@ components: properties: architecture: $ref: '#/components/schemas/ModelArchitecture' + benchmarks: + $ref: '#/components/schemas/ModelBenchmarks' canonical_slug: description: Canonical slug for the model example: openai/gpt-4 @@ -11681,6 +12249,36 @@ components: - input_modalities - output_modalities type: object + ModelBenchmarks: + description: Third-party benchmark rankings for this model. Omitted when no benchmark data is available. + example: + artificial_analysis: + agentic_index: 55.8 + coding_index: 63.2 + intelligence_index: 71.4 + design_arena: + - arena: models + category: website + elo: 1385.2 + rank: 5 + win_rate: 62.5 + properties: + artificial_analysis: + $ref: '#/components/schemas/AABenchmarkEntry' + design_arena: + description: Design Arena ELO rankings across arena+category pairs. + example: + - arena: models + category: website + elo: 1385.2 + rank: 5 + win_rate: 62.5 + items: + $ref: '#/components/schemas/DABenchmarkEntry' + type: array + required: + - design_arena + type: object ModelGroup: description: Tokenizer type used by the model enum: @@ -11723,6 +12321,43 @@ components: description: Model to use for completion example: openai/gpt-4 type: string + ModelResponse: + description: Single model response + example: + data: + architecture: + input_modalities: + - text + instruct_type: chatml + modality: text->text + output_modalities: + - text + tokenizer: GPT + context_length: 8192 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + id: openai/gpt-4 + name: GPT-4 + per_request_limits: null + pricing: + completion: '0.00006' + image: '0' + prompt: '0.00003' + request: '0' + supported_parameters: + - temperature + - top_p + - max_tokens + top_provider: + context_length: 8192 + is_moderated: true + max_completion_tokens: 4096 + properties: + data: + $ref: '#/components/schemas/Model' + required: + - data + type: object ModelsCountResponse: description: Model count data example: @@ -15368,6 +16003,7 @@ components: openrouter:image_generation: '#/components/schemas/OutputImageGenerationServerToolItem' openrouter:mcp: '#/components/schemas/OutputMcpServerToolItem' openrouter:memory: '#/components/schemas/OutputMemoryServerToolItem' + openrouter:subagent: '#/components/schemas/OutputSubagentServerToolItem' openrouter:text_editor: '#/components/schemas/OutputTextEditorServerToolItem' openrouter:tool_search: '#/components/schemas/OutputToolSearchServerToolItem' openrouter:web_fetch: '#/components/schemas/OutputWebFetchServerToolItem' @@ -15413,6 +16049,7 @@ components: - $ref: '#/components/schemas/OutputSearchModelsServerToolItem' - $ref: '#/components/schemas/OutputFusionServerToolItem' - $ref: '#/components/schemas/OutputAdvisorServerToolItem' + - $ref: '#/components/schemas/OutputSubagentServerToolItem' - $ref: '#/components/schemas/OutputCustomToolCallItem' OutputItemWebSearchCall: example: @@ -15801,6 +16438,40 @@ components: - status - output type: object + OutputSubagentServerToolItem: + description: An openrouter:subagent server tool output item + example: + id: st_tmp_abc123 + status: completed + type: openrouter:subagent + properties: + error: + description: Error message when the subagent task did not produce an outcome. + type: string + id: + type: string + model: + description: Slug of the worker model that executed the task. + type: string + outcome: + description: The worker model's result (the outcome text returned to the delegating model). + type: string + status: + $ref: '#/components/schemas/ToolCallStatus' + task_description: + description: The task description the delegating model sent to the worker. + type: string + task_name: + description: The short task identifier the delegating model supplied. + type: string + type: + enum: + - openrouter:subagent + type: string + required: + - status + - type + type: object OutputTextEditorServerToolItem: description: An openrouter:text_editor server tool output item example: @@ -16428,7 +17099,7 @@ components: $ref: '#/components/schemas/WebSearchDomainFilter' max_results: description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. example: 5 type: integer search_context_size: @@ -16453,7 +17124,7 @@ components: $ref: '#/components/schemas/WebSearchDomainFilter' max_results: description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. example: 5 type: integer search_context_size: @@ -18426,6 +19097,7 @@ components: - $ref: '#/components/schemas/ApplyPatchServerTool' - $ref: '#/components/schemas/CustomTool' - $ref: '#/components/schemas/AdvisorServerTool_OpenRouter' + - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' - $ref: '#/components/schemas/DatetimeServerTool' - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' @@ -18538,7 +19210,7 @@ components: type: object SearchQualityLevel: description: >- - How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set. + How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set. enum: - low - medium @@ -19324,6 +19996,102 @@ components: example: 113 type: integer type: object + SubagentNestedTool: + additionalProperties: + nullable: true + description: >- + A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself. + example: + type: openrouter:web_search + properties: + parameters: + additionalProperties: + nullable: true + type: object + type: + type: string + required: + - type + type: object + SubagentReasoning: + description: >- + Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking. + example: + effort: low + properties: + effort: + description: Reasoning effort level for the subagent call. + enum: + - xhigh + - high + - medium + - low + - minimal + - none + type: string + x-speakeasy-unknown-values: allow + max_tokens: + description: >- + Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call. + type: integer + type: object + SubagentServerTool_OpenRouter: + description: >- + OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools. + example: + parameters: + model: ~anthropic/claude-haiku-latest + type: openrouter:subagent + properties: + parameters: + $ref: '#/components/schemas/SubagentServerToolConfig' + type: + enum: + - openrouter:subagent + type: string + required: + - type + type: object + SubagentServerToolConfig: + description: Configuration for the openrouter:subagent server tool. + example: + model: ~anthropic/claude-haiku-latest + properties: + instructions: + description: System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own. + example: You are a fast, focused worker. Complete the task exactly as described. + type: string + max_completion_tokens: + description: >- + Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies. + example: 2048 + type: integer + max_tool_calls: + description: >- + Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call. + example: 5 + maximum: 25 + minimum: 1 + type: integer + model: + description: >- + Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model. + example: ~anthropic/claude-haiku-latest + type: string + reasoning: + $ref: '#/components/schemas/SubagentReasoning' + temperature: + description: Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies. + example: 0.7 + format: double + type: number + tools: + description: >- + Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself. + items: + $ref: '#/components/schemas/SubagentNestedTool' + type: array + type: object TextConfig: description: Text output configuration including format and verbosity example: @@ -20526,7 +21294,7 @@ components: properties: allowed_domains: description: >- - Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains. + Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains. items: type: string type: array @@ -20534,18 +21302,18 @@ components: $ref: '#/components/schemas/WebSearchEngineEnum' excluded_domains: description: >- - Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains. + Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains. items: type: string type: array max_characters: description: >- - Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel). + Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity). example: 2000 type: integer max_results: description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. example: 5 type: integer max_total_results: @@ -20584,18 +21352,20 @@ components: - exa - firecrawl - parallel + - perplexity example: exa type: string x-speakeasy-unknown-values: allow WebSearchEngineEnum: description: >- - Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. + Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). enum: - - auto - native - exa - parallel - firecrawl + - perplexity + - auto example: auto type: string x-speakeasy-unknown-values: allow @@ -20673,7 +21443,7 @@ components: $ref: '#/components/schemas/WebSearchDomainFilter' max_results: description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. example: 5 type: integer search_context_size: @@ -20711,7 +21481,7 @@ components: properties: allowed_domains: description: >- - Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains. + Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains. items: type: string type: array @@ -20719,18 +21489,18 @@ components: $ref: '#/components/schemas/WebSearchEngineEnum' excluded_domains: description: >- - Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains. + Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains. items: type: string type: array max_characters: description: >- - Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel). + Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity). example: 2000 type: integer max_results: description: >- - Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search. + Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. example: 5 type: integer max_total_results: @@ -21339,7 +22109,7 @@ paths: type: string group_limit: description: >- - Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. + Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. example: 100 type: integer limit: @@ -21889,7 +22659,7 @@ paths: properties: callback_url: description: >- - The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. example: https://myapp.com/auth/callback format: uri type: string @@ -21942,6 +22712,10 @@ paths: example: monthly type: string x-speakeasy-unknown-values: allow + workspace_id: + description: Optional workspace ID to associate the API key with + format: uuid + type: string required: - callback_url type: object @@ -22010,6 +22784,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 '409': content: application/json: @@ -23109,41 +23893,254 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /datasets/rankings-daily: + /datasets/benchmarks/artificial-analysis: get: - description: |- - Returns the top 50 public models per day by total token usage on OpenRouter, plus a - single aggregated `other` row per day that sums every model outside that top 50. - Token totals are `prompt_tokens + completion_tokens`, matching the public rankings - chart on openrouter.ai/rankings. - - Each row is a distinct `(date, model_permaslug)` pair. The `other` row uses the - reserved permaslug `other` and is always returned last within its date, so callers - can compute `top-50 traffic / total daily traffic` without a second request. - - Authenticate with any valid OpenRouter API key (same key used for inference). - Rate-limited to 30 requests/minute per key and 500 requests/day per account. - - When republishing or quoting this dataset, OpenRouter must be cited as: - "Source: OpenRouter (openrouter.ai/rankings), as of {as_of}." - - Token counts come from each upstream provider's own tokenizer (Anthropic counts - are as reported by Anthropic, OpenAI counts are as reported by OpenAI, etc.), so - a token in one row is not directly comparable to a token in another row from a - different provider. - operationId: getRankingsDaily + description: >- + Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + operationId: getBenchmarksArtificialAnalysis parameters: - - description: >- - Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. + - description: Max results to return (1–100, default 50). in: query - name: start_date + name: max_results required: false schema: - description: >- - Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. - example: '2026-04-12' - pattern: ^\d{4}-\d{2}-\d{2}$ - type: string + default: 50 + description: Max results to return (1–100, default 50). + example: 20 + maximum: 100 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + example: + data: + - aa_name: GPT-4o + agentic_index: 58.3 + coding_index: 65.8 + intelligence_index: 71.2 + model_permaslug: openai/gpt-4o + pricing: + completion: '0.00001' + prompt: '0.0000025' + meta: + as_of: '2026-06-03T12:00:00Z' + citation: 'Source: Artificial Analysis (artificialanalysis.ai) via OpenRouter (openrouter.ai/rankings).' + model_count: 1 + source: artificial-analysis + source_url: https://artificialanalysis.ai + version: v1 + schema: + $ref: '#/components/schemas/BenchmarksAAResponse' + description: Artificial Analysis composite index scores with pricing and attribution metadata. + '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 + '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: Artificial Analysis Benchmark Indices + tags: + - Datasets + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /datasets/benchmarks/design-arena: + get: + description: >- + Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + operationId: getBenchmarksDesignArena + parameters: + - description: Arena to query. Defaults to `models`. + in: query + name: arena + required: false + schema: + default: models + description: Arena to query. Defaults to `models`. + enum: + - models + - builders + - agents + example: models + type: string + x-speakeasy-unknown-values: allow + - description: >- + Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories. + in: query + name: category + required: false + schema: + description: >- + Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories. + example: codecategories + type: string + - description: 'Max results to return: per category when no category filter is applied (1–100, default 50).' + in: query + name: max_results + required: false + schema: + default: 50 + description: 'Max results to return: per category when no category filter is applied (1–100, default 50).' + example: 20 + maximum: 100 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + example: + data: + - arena: models + avg_generation_time_ms: 3200 + category: codecategories + display_name: Claude Sonnet 4 + elo: 1423 + model_permaslug: anthropic/claude-sonnet-4 + pricing: + completion: '0.000015' + prompt: '0.000003' + tournament_stats: + first_place: 12 + fourth_place: 2 + second_place: 8 + third_place: 5 + total: 27 + win_rate: 72 + meta: + arena: models + as_of: '2026-06-03T12:00:00Z' + category: null + citation: 'Source: Design Arena (www.designarena.ai) via OpenRouter (openrouter.ai/rankings).' + elo_bounds: + max: 1600 + min: 900 + model_count: 1 + source: design-arena + source_url: https://www.designarena.ai + version: v1 + schema: + $ref: '#/components/schemas/BenchmarksDAResponse' + description: Design Arena ELO rankings with pricing and attribution metadata. + '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 + '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: Design Arena Benchmark Rankings + tags: + - Datasets + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /datasets/rankings-daily: + get: + description: |- + Returns the top 50 public models per day by total token usage on OpenRouter, plus a + single aggregated `other` row per day that sums every model outside that top 50. + Token totals are `prompt_tokens + completion_tokens`, matching the public rankings + chart on openrouter.ai/rankings. + + Each row is a distinct `(date, model_permaslug)` pair. The `other` row uses the + reserved permaslug `other` and is always returned last within its date, so callers + can compute `top-50 traffic / total daily traffic` without a second request. + + Authenticate with any valid OpenRouter API key (same key used for inference). + Rate-limited to 30 requests/minute per key and 500 requests/day per account. + + When republishing or quoting this dataset, OpenRouter must be cited as: + "Source: OpenRouter (openrouter.ai/rankings), as of {as_of}." + + Token counts come from each upstream provider's own tokenizer (Anthropic counts + are as reported by Anthropic, OpenAI counts are as reported by OpenAI, etc.), so + a token in one row is not directly comparable to a token in another row from a + different provider. + operationId: getRankingsDaily + parameters: + - description: >- + Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. + in: query + name: start_date + required: false + schema: + description: >- + Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. + example: '2026-04-12' + pattern: ^\d{4}-\d{2}-\d{2}$ + type: string - description: >- End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. in: query @@ -23612,8 +24609,542 @@ paths: is_moderated: false max_completion_tokens: null schema: - $ref: '#/components/schemas/ModelsListResponse' - description: Returns a list of embeddings models + $ref: '#/components/schemas/ModelsListResponse' + description: Returns a list of embeddings models + '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 + '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: List all embeddings models + tags: + - Embeddings + x-speakeasy-name-override: listModels + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /endpoints/zdr: + get: + operationId: listEndpointsZdr + responses: + '200': + content: + application/json: + example: + data: + - context_length: 8192 + latency_last_30m: + p50: 0.25 + p75: 0.35 + p90: 0.48 + p99: 0.85 + max_completion_tokens: 4096 + max_prompt_tokens: 8192 + model_id: openai/gpt-4 + model_name: GPT-4 + name: 'OpenAI: GPT-4' + pricing: + completion: '0.00006' + image: '0' + prompt: '0.00003' + request: '0' + provider_name: OpenAI + quantization: fp16 + status: default + supported_parameters: + - temperature + - top_p + - max_tokens + supports_implicit_caching: true + tag: openai + throughput_last_30m: + p50: 45.2 + p75: 38.5 + p90: 28.3 + p99: 15.1 + uptime_last_1d: 99.8 + uptime_last_30m: 99.5 + uptime_last_5m: 100 + schema: + example: + data: + - context_length: 8192 + latency_last_30m: + p50: 0.25 + p75: 0.35 + p90: 0.48 + p99: 0.85 + max_completion_tokens: 4096 + max_prompt_tokens: 8192 + model_id: openai/gpt-4 + model_name: GPT-4 + name: 'OpenAI: GPT-4' + pricing: + completion: '0.00006' + image: '0' + prompt: '0.00003' + request: '0' + provider_name: OpenAI + quantization: fp16 + status: default + supported_parameters: + - temperature + - top_p + - max_tokens + supports_implicit_caching: true + tag: openai + throughput_last_30m: + p50: 45.2 + p75: 38.5 + p90: 28.3 + p99: 15.1 + uptime_last_1d: 99.8 + uptime_last_30m: 99.5 + uptime_last_5m: 100 + properties: + data: + items: + $ref: '#/components/schemas/PublicEndpoint' + type: array + required: + - data + type: object + description: Returns a list of endpoints + '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: Preview the impact of ZDR on the available endpoints + tags: + - Endpoints + x-speakeasy-name-override: listZdrEndpoints + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /files: + get: + description: Lists files belonging to the workspace of the authenticating API key. + operationId: listFiles + parameters: + - description: Maximum number of files to return (1–1000). + in: query + name: limit + required: false + schema: + description: Maximum number of files to return (1–1000). + example: 100 + maximum: 1000 + minimum: 1 + type: integer + - description: Opaque pagination cursor from a previous response. + in: query + name: cursor + required: false + schema: + description: Opaque pagination cursor from a previous response. + example: eyJjdXJzb3IiOiJmaWxlXzAxMUNOaGE4aUNKY1Uxd1hOUjZxNFY4dyJ9 + type: string + - description: Workspace to scope the request to. Defaults to the caller’s default workspace. + in: query + name: workspace_id + required: false + schema: + description: Workspace to scope the request to. Defaults to the caller’s default workspace. + example: a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7 + format: uuid + type: string + responses: + '200': + content: + application/json: + example: + cursor: null + data: + - created_at: '2025-01-01T00:00:00Z' + downloadable: false + filename: document.pdf + id: file_011CNha8iCJcU1wXNR6q4V8w + mime_type: application/pdf + size_bytes: 1024000 + type: file + first_id: file_011CNha8iCJcU1wXNR6q4V8w + has_more: false + last_id: file_011CNha8iCJcU1wXNR6q4V8w + schema: + $ref: '#/components/schemas/FileListResponse' + description: A page of files. + '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 + '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: List files + tags: + - Files + x-speakeasy-name-override: list + x-speakeasy-pagination: + inputs: + - in: parameters + name: cursor + type: cursor + outputs: + nextCursor: $.cursor + results: $.data + type: cursor + post: + description: >- + Uploads a file to be referenced in future API calls. The file is stored under the workspace of the authenticating API key. Maximum file size: 100 MB. + operationId: uploadFile + parameters: + - description: Workspace to scope the request to. Defaults to the caller’s default workspace. + in: query + name: workspace_id + required: false + schema: + description: Workspace to scope the request to. Defaults to the caller’s default workspace. + example: a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7 + format: uuid + type: string + requestBody: + content: + multipart/form-data: + example: + file: document.pdf + schema: + properties: + file: + format: binary + type: string + required: + - file + type: object + required: true + responses: + '200': + content: + application/json: + example: + created_at: '2025-01-01T00:00:00Z' + downloadable: false + filename: document.pdf + id: file_011CNha8iCJcU1wXNR6q4V8w + mime_type: application/pdf + size_bytes: 1024000 + type: file + schema: + $ref: '#/components/schemas/FileMetadata' + description: The uploaded file metadata. + '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 + '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 + '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 + '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: Upload a file + tags: + - Files + x-speakeasy-name-override: upload + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /files/{file_id}: + delete: + description: Deletes a file owned by the requesting workspace. Deletion is irreversible. + operationId: deleteFile + parameters: + - in: path + name: file_id + required: true + schema: + example: file_011CNha8iCJcU1wXNR6q4V8w + type: string + - description: Workspace to scope the request to. Defaults to the caller’s default workspace. + in: query + name: workspace_id + required: false + schema: + description: Workspace to scope the request to. Defaults to the caller’s default workspace. + example: a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7 + format: uuid + type: string + responses: + '200': + content: + application/json: + example: + id: file_011CNha8iCJcU1wXNR6q4V8w + type: file_deleted + schema: + $ref: '#/components/schemas/FileDeleteResponse' + description: The file was deleted. + '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 + '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: Delete a file + tags: + - Files + x-speakeasy-name-override: delete + get: + description: Retrieves metadata for a single file owned by the requesting workspace. + operationId: getFileMetadata + parameters: + - in: path + name: file_id + required: true + schema: + example: file_011CNha8iCJcU1wXNR6q4V8w + type: string + - description: Workspace to scope the request to. Defaults to the caller’s default workspace. + in: query + name: workspace_id + required: false + schema: + description: Workspace to scope the request to. Defaults to the caller’s default workspace. + example: a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7 + format: uuid + type: string + responses: + '200': + content: + application/json: + example: + created_at: '2025-01-01T00:00:00Z' + downloadable: false + filename: document.pdf + id: file_011CNha8iCJcU1wXNR6q4V8w + mime_type: application/pdf + size_bytes: 1024000 + type: file + schema: + $ref: '#/components/schemas/FileMetadata' + description: The file metadata. + '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 + '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: Get file metadata + tags: + - Files + x-speakeasy-name-override: retrieve + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /files/{file_id}/content: + get: + description: Downloads the raw bytes of a file. Only files created server-side are downloadable; uploaded files return 400. + operationId: downloadFileContent + parameters: + - in: path + name: file_id + required: true + schema: + example: file_011CNha8iCJcU1wXNR6q4V8w + type: string + - description: Workspace to scope the request to. Defaults to the caller’s default workspace. + in: query + name: workspace_id + required: false + schema: + description: Workspace to scope the request to. Defaults to the caller’s default workspace. + example: a103d8b6-42f0-4e50-9a3c-bf41e2c3c1a7 + format: uuid + type: string + responses: + '200': + content: + application/octet-stream: + example: binary file contents + schema: + format: binary + type: string + description: The raw file content. '400': content: application/json: @@ -23624,111 +25155,36 @@ paths: schema: $ref: '#/components/schemas/BadRequestResponse' description: Bad Request - Invalid request parameters or malformed input - '500': + '401': content: application/json: example: error: - code: 500 - message: Internal Server Error + code: 401 + message: Missing Authentication header schema: - $ref: '#/components/schemas/InternalServerResponse' - description: Internal Server Error - Unexpected server error - summary: List all embeddings models - tags: - - Embeddings - x-speakeasy-name-override: listModels - parameters: - - $ref: "#/components/parameters/AppIdentifier" - - $ref: "#/components/parameters/AppDisplayName" - - $ref: "#/components/parameters/AppCategories" - /endpoints/zdr: - get: - operationId: listEndpointsZdr - responses: - '200': + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '404': content: application/json: example: - data: - - context_length: 8192 - latency_last_30m: - p50: 0.25 - p75: 0.35 - p90: 0.48 - p99: 0.85 - max_completion_tokens: 4096 - max_prompt_tokens: 8192 - model_id: openai/gpt-4 - model_name: GPT-4 - name: 'OpenAI: GPT-4' - pricing: - completion: '0.00006' - image: '0' - prompt: '0.00003' - request: '0' - provider_name: OpenAI - quantization: fp16 - status: default - supported_parameters: - - temperature - - top_p - - max_tokens - supports_implicit_caching: true - tag: openai - throughput_last_30m: - p50: 45.2 - p75: 38.5 - p90: 28.3 - p99: 15.1 - uptime_last_1d: 99.8 - uptime_last_30m: 99.5 - uptime_last_5m: 100 + error: + code: 404 + message: Resource not found schema: - example: - data: - - context_length: 8192 - latency_last_30m: - p50: 0.25 - p75: 0.35 - p90: 0.48 - p99: 0.85 - max_completion_tokens: 4096 - max_prompt_tokens: 8192 - model_id: openai/gpt-4 - model_name: GPT-4 - name: 'OpenAI: GPT-4' - pricing: - completion: '0.00006' - image: '0' - prompt: '0.00003' - request: '0' - provider_name: OpenAI - quantization: fp16 - status: default - supported_parameters: - - temperature - - top_p - - max_tokens - supports_implicit_caching: true - tag: openai - throughput_last_30m: - p50: 45.2 - p75: 38.5 - p90: 28.3 - p99: 15.1 - uptime_last_1d: 99.8 - uptime_last_30m: 99.5 - uptime_last_5m: 100 - properties: - data: - items: - $ref: '#/components/schemas/PublicEndpoint' - type: array - required: - - data - type: object - description: Returns a list of endpoints + $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: @@ -23739,10 +25195,10 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - summary: Preview the impact of ZDR on the available endpoints + summary: Download file content tags: - - Endpoints - x-speakeasy-name-override: listZdrEndpoints + - Files + x-speakeasy-name-override: download parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" @@ -26838,6 +28294,92 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /model/{author}/{slug}: + get: + description: >- + Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + operationId: getModel + parameters: + - description: The author/organization of the model + in: path + name: author + required: true + schema: + description: The author/organization of the model + example: openai + type: string + - description: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + in: path + name: slug + required: true + schema: + description: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + example: gpt-4 + type: string + responses: + '200': + content: + application/json: + example: + data: + architecture: + input_modalities: + - text + instruct_type: chatml + modality: text->text + output_modalities: + - text + tokenizer: GPT + context_length: 8192 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + id: openai/gpt-4 + name: GPT-4 + per_request_limits: null + pricing: + completion: '0.00006' + image: '0' + prompt: '0.00003' + request: '0' + supported_parameters: + - temperature + - top_p + - max_tokens + top_provider: + context_length: 8192 + is_moderated: true + max_completion_tokens: 4096 + schema: + $ref: '#/components/schemas/ModelResponse' + description: Returns the model details + '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: Get a model by its slug + tags: + - Models + x-speakeasy-name-override: get + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /models: get: operationId: getModels @@ -26902,6 +28444,108 @@ paths: example: newest type: string x-speakeasy-unknown-values: allow + - description: Free-text search by model name or slug. + in: query + name: q + required: false + schema: + description: Free-text search by model name or slug. + example: gpt-4 + type: string + - description: 'Filter models by input modality. Comma-separated list of: text, image, audio, file.' + in: query + name: input_modalities + required: false + schema: + description: 'Filter models by input modality. Comma-separated list of: text, image, audio, file.' + example: text,image + type: string + - description: Minimum context length (tokens). Models with smaller context are excluded. + in: query + name: context + required: false + schema: + description: Minimum context length (tokens). Models with smaller context are excluded. + example: 128000 + exclusiveMinimum: true + minimum: 0 + type: integer + - description: Minimum prompt price in $/M tokens. + in: query + name: min_price + required: false + schema: + description: Minimum prompt price in $/M tokens. + example: 0 + minimum: 0 + nullable: true + type: number + - description: Maximum prompt price in $/M tokens. + in: query + name: max_price + required: false + schema: + description: Maximum prompt price in $/M tokens. + example: 10 + minimum: 0 + nullable: true + type: number + - description: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). + in: query + name: arch + required: false + schema: + description: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). + example: GPT + type: string + - description: Filter models by the organization that created the model. Comma-separated list of author slugs. + in: query + name: model_authors + required: false + schema: + description: Filter models by the organization that created the model. Comma-separated list of author slugs. + example: openai,anthropic + type: string + - description: Filter models by hosting provider. Comma-separated list of provider names. + in: query + name: providers + required: false + schema: + description: Filter models by hosting provider. Comma-separated list of provider names. + example: OpenAI,Anthropic + type: string + - description: Filter by distillation capability. "true" returns only distillable models, "false" excludes them. + in: query + name: distillable + required: false + schema: + description: Filter by distillation capability. "true" returns only distillable models, "false" excludes them. + enum: + - 'true' + - 'false' + example: 'true' + type: string + x-speakeasy-unknown-values: allow + - description: When set to "true", return only models with zero data retention endpoints. + in: query + name: zdr + required: false + schema: + description: When set to "true", return only models with zero data retention endpoints. + enum: + - 'true' + example: 'true' + type: string + - description: Filter to models with endpoints in the given data region. Currently only "eu" is supported. + in: query + name: region + required: false + schema: + description: Filter to models with endpoints in the given data region. Currently only "eu" is supported. + enum: + - eu + example: eu + type: string responses: '200': content: @@ -30666,6 +32310,8 @@ tags: name: Embeddings - description: Endpoint information name: Endpoints + - description: Files endpoints + name: Files - description: Generation history endpoints name: Generations - description: Guardrails endpoints diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8d478ad..205e0cb 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,20 +2,20 @@ speakeasyVersion: 1.680.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08108f43d4fba1406b4c8f624792054965c95a14819f442262663cb25ce6cc25 - sourceBlobDigest: sha256:47fc5915e6a9ff29fca019515d6491adce926407ebb47cee480feb77cfb68f03 + sourceRevisionDigest: sha256:73110e992444fe79b661e96f4c5ce190721a6eb20328a9bb768100fc33ce5317 + sourceBlobDigest: sha256:7a91a13a891ca8a9775bc33b3e02751198aa379d773ab2efd1c85fb99b9eb8ed tags: - latest - - speakeasy-sdk-regen-1776991284 + - speakeasy-sdk-regen-1781312282 - 1.0.0 targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08108f43d4fba1406b4c8f624792054965c95a14819f442262663cb25ce6cc25 - sourceBlobDigest: sha256:47fc5915e6a9ff29fca019515d6491adce926407ebb47cee480feb77cfb68f03 + sourceRevisionDigest: sha256:73110e992444fe79b661e96f4c5ce190721a6eb20328a9bb768100fc33ce5317 + sourceBlobDigest: sha256:7a91a13a891ca8a9775bc33b3e02751198aa379d773ab2efd1c85fb99b9eb8ed codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:3c7b0aef799130660fd4017ab9113e6fd3e06a80cff6a540043b9b34dc22facf + codeSamplesRevisionDigest: sha256:82640f780ff70ec2b96aaac507d1b4b58b0a8a0e1e6ed1f45198dc0bceb46801 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.680.0 diff --git a/README-PYPI.md b/README-PYPI.md index 0148b4b..2c51bef 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -199,6 +199,39 @@ with OpenRouter( ``` + +## File uploads + +Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request. + +> [!TIP] +> +> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files. +> + +```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.files.upload(file={ + "file_name": "example.file", + "content": open("example.file", "rb"), + }) + + # Handle response + print(res) + +``` + + ## Resource Management diff --git a/README.md b/README.md index 0148b4b..2c51bef 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,39 @@ with OpenRouter( ``` + +## File uploads + +Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request. + +> [!TIP] +> +> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files. +> + +```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.files.upload(file={ + "file_name": "example.file", + "content": open("example.file", "rb"), + }) + + # Handle response + print(res) + +``` + + ## Resource Management diff --git a/RELEASES.md b/RELEASES.md index a5b6b37..5a34889 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -18,4 +18,14 @@ Based on: ### Generated - [python v0.9.2] . ### Releases -- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - . \ No newline at end of file +- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - . + +## 2026-06-15 00:59:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.10.0] . +### Releases +- [PyPI v0.10.0] https://pypi.org/project/openrouter/0.10.0 - . \ No newline at end of file diff --git a/docs/components/model.md b/docs/components/model.md index 55f6fe4..8ce3d9d 100644 --- a/docs/components/model.md +++ b/docs/components/model.md @@ -5,22 +5,23 @@ Information about an AI model available on OpenRouter ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `architecture` | [components.ModelArchitecture](../components/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {
"input_modalities": [
"text"
],
"instruct_type": "chatml",
"modality": "text-\u003etext",
"output_modalities": [
"text"
],
"tokenizer": "GPT"
} | -| `canonical_slug` | *str* | :heavy_check_mark: | Canonical slug for the model | openai/gpt-4 | -| `context_length` | *Nullable[int]* | :heavy_check_mark: | Maximum context length in tokens | 8192 | -| `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 | -| `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"temperature": 0.7,
"top_k": 0,
"top_p": 0.9
} | -| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. | -| `expiration_date` | *OptionalNullable[str]* | :heavy_minus_sign: | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 | -| `hugging_face_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Hugging Face model identifier, if applicable | microsoft/DialoGPT-medium | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 | -| `knowledge_cutoff` | *OptionalNullable[str]* | :heavy_minus_sign: | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 | -| `links` | [components.ModelLinks](../components/modellinks.md) | :heavy_check_mark: | Related API endpoints and resources for this model. | {
"details": "/api/v1/models/openai/gpt-5.4/endpoints"
} | -| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 | -| `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {
"completion_tokens": 1000,
"prompt_tokens": 1000
} | -| `pricing` | [components.PublicPricing](../components/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {
"completion": "0.00006",
"image": "0",
"prompt": "0.00003",
"request": "0"
} | -| `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | | -| `supported_voices` | List[*str*] | :heavy_check_mark: | List of supported voice identifiers for TTS models. Null for non-TTS models. | | -| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `architecture` | [components.ModelArchitecture](../components/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {
"input_modalities": [
"text"
],
"instruct_type": "chatml",
"modality": "text-\u003etext",
"output_modalities": [
"text"
],
"tokenizer": "GPT"
} | +| `benchmarks` | [Optional[components.ModelBenchmarks]](../components/modelbenchmarks.md) | :heavy_minus_sign: | Third-party benchmark rankings for this model. Omitted when no benchmark data is available. | {
"artificial_analysis": {
"agentic_index": 55.8,
"coding_index": 63.2,
"intelligence_index": 71.4
},
"design_arena": [
{
"arena": "models",
"category": "website",
"elo": 1385.2,
"rank": 5,
"win_rate": 62.5
}
]
} | +| `canonical_slug` | *str* | :heavy_check_mark: | Canonical slug for the model | openai/gpt-4 | +| `context_length` | *Nullable[int]* | :heavy_check_mark: | Maximum context length in tokens | 8192 | +| `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 | +| `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"temperature": 0.7,
"top_k": 0,
"top_p": 0.9
} | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. | +| `expiration_date` | *OptionalNullable[str]* | :heavy_minus_sign: | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 | +| `hugging_face_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Hugging Face model identifier, if applicable | microsoft/DialoGPT-medium | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 | +| `knowledge_cutoff` | *OptionalNullable[str]* | :heavy_minus_sign: | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 | +| `links` | [components.ModelLinks](../components/modellinks.md) | :heavy_check_mark: | Related API endpoints and resources for this model. | {
"details": "/api/v1/models/openai/gpt-5.4/endpoints"
} | +| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 | +| `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {
"completion_tokens": 1000,
"prompt_tokens": 1000
} | +| `pricing` | [components.PublicPricing](../components/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {
"completion": "0.00006",
"image": "0",
"prompt": "0.00003",
"request": "0"
} | +| `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | | +| `supported_voices` | List[*str*] | :heavy_check_mark: | List of supported voice identifiers for TTS models. Null for non-TTS models. | | +| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
} | \ No newline at end of file diff --git a/docs/components/websearchengine.md b/docs/components/websearchengine.md index c0da505..8772c8f 100644 --- a/docs/components/websearchengine.md +++ b/docs/components/websearchengine.md @@ -5,9 +5,10 @@ The search engine to use for web search. ## Values -| Name | Value | -| ----------- | ----------- | -| `NATIVE` | native | -| `EXA` | exa | -| `FIRECRAWL` | firecrawl | -| `PARALLEL` | parallel | \ No newline at end of file +| Name | Value | +| ------------ | ------------ | +| `NATIVE` | native | +| `EXA` | exa | +| `FIRECRAWL` | firecrawl | +| `PARALLEL` | parallel | +| `PERPLEXITY` | perplexity | \ No newline at end of file diff --git a/docs/operations/createauthkeyscoderequestbody.md b/docs/operations/createauthkeyscoderequestbody.md index 787c57a..d37c219 100644 --- a/docs/operations/createauthkeyscoderequestbody.md +++ b/docs/operations/createauthkeyscoderequestbody.md @@ -3,12 +3,13 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | -| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | -| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | -| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | 2027-12-31T23:59:59Z | -| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | -| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | -| `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. | https://myapp.com/auth/callback | +| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | +| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | 2027-12-31T23:59:59Z | +| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | +| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | +| `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to associate the API key with | | \ No newline at end of file diff --git a/docs/operations/getmodelsrequest.md b/docs/operations/getmodelsrequest.md index 8fa79b3..2086a79 100644 --- a/docs/operations/getmodelsrequest.md +++ b/docs/operations/getmodelsrequest.md @@ -11,4 +11,15 @@ | `category` | [Optional[operations.GetModelsCategory]](../operations/getmodelscategory.md) | :heavy_minus_sign: | Filter models by use case category | programming | | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | | `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | -| `sort` | [Optional[operations.GetModelsSort]](../operations/getmodelssort.md) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. | newest | \ No newline at end of file +| `sort` | [Optional[operations.GetModelsSort]](../operations/getmodelssort.md) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. | newest | +| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | +| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | +| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 | +| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 | +| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 | +| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT | +| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic | +| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic | +| `distillable` | [Optional[operations.Distillable]](../operations/distillable.md) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true | +| `zdr` | [Optional[operations.Zdr]](../operations/zdr.md) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true | +| `region` | [Optional[operations.Region]](../operations/region.md) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu | \ No newline at end of file diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index 6ef1960..08b736f 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -61,6 +61,7 @@ with OpenRouter( | `max_completion_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens in completion | 100 | | `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. | 100 | | `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | {
"session_id": "session-456",
"user_id": "user-123"
} | +| `min_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. | 0.1 | | `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text", "image", and "audio". | [
"text",
"image"
] | | `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | openai/gpt-4 | | `models` | List[*str*] | :heavy_minus_sign: | Models to use for completion | [
"openai/gpt-4",
"openai/gpt-4o"
] | @@ -69,6 +70,8 @@ with OpenRouter( | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | {
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.md) | :heavy_minus_sign: | Configuration options for reasoning models | {
"effort": "medium",
"summary": "concise"
} | +| `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../../components/chatrequestreasoningeffort.md) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | +| `repetition_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. | 1 | | `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | Response format configuration | {
"type": "json_object"
} | | `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | 42 | | `service_tier` | [OptionalNullable[components.ChatRequestServiceTier]](../../components/chatrequestservicetier.md) | :heavy_minus_sign: | The service tier to use for processing this request. | auto | @@ -80,6 +83,8 @@ with OpenRouter( | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | 0.7 | | `tool_choice` | [Optional[components.ChatToolChoice]](../../components/chattoolchoice.md) | :heavy_minus_sign: | Tool choice configuration | auto | | `tools` | List[[components.ChatFunctionTool](../../components/chatfunctiontool.md)] | :heavy_minus_sign: | Available tools for function calling | [
{
"function": {
"description": "Get weather",
"name": "get_weather"
},
"type": "function"
}
] | +| `top_a` | *OptionalNullable[float]* | :heavy_minus_sign: | Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter. | 0 | +| `top_k` | *OptionalNullable[int]* | :heavy_minus_sign: | Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. | 40 | | `top_logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | 5 | | `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | 1 | | `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | {
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | diff --git a/docs/sdks/models/README.md b/docs/sdks/models/README.md index 4875c60..8af216e 100644 --- a/docs/sdks/models/README.md +++ b/docs/sdks/models/README.md @@ -6,10 +6,60 @@ Model information endpoints ### Available Operations +* [get](#get) - Get a model by its slug * [list](#list) - List all models and their properties * [count](#count) - Get total count of available models * [list_for_user](#list_for_user) - List models filtered by user provider preferences, privacy settings, and guardrails +## get + +Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + +### 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.models.get(author="openai", slug="gpt-4") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `author` | *str* | :heavy_check_mark: | The author/organization of the model | openai | +| `slug` | *str* | :heavy_check_mark: | The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) | gpt-4 | +| `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.ModelResponse](../../components/modelresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + ## list List all models and their properties @@ -47,6 +97,17 @@ with OpenRouter( | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | | `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | | `sort` | [Optional[operations.GetModelsSort]](../../operations/getmodelssort.md) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. | newest | +| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | +| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | +| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 | +| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 | +| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 | +| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT | +| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic | +| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic | +| `distillable` | [Optional[operations.Distillable]](../../operations/distillable.md) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true | +| `zdr` | [Optional[operations.Zdr]](../../operations/zdr.md) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true | +| `region` | [Optional[operations.Region]](../../operations/region.md) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/oauth/README.md b/docs/sdks/oauth/README.md index 562e2e8..a99fae6 100644 --- a/docs/sdks/oauth/README.md +++ b/docs/sdks/oauth/README.md @@ -90,7 +90,7 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | +| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. | https://myapp.com/auth/callback | | `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.
| | @@ -100,6 +100,7 @@ with OpenRouter( | `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | | `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | | `usage_limit_type` | [Optional[operations.UsageLimitType]](../../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID to associate the API key with | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -112,6 +113,7 @@ with OpenRouter( | ---------------------------------- | ---------------------------------- | ---------------------------------- | | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | | errors.ConflictResponseError | 409 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 9e4606d..396bd51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.9.2" +version = "0.10.0" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index fcebde3..be619e3 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.2" +__version__: str = "0.10.0" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.788.4" -__user_agent__: str = "speakeasy-sdk/python 0.9.2 2.788.4 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.10.0 2.788.4 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/beta_analytics.py b/src/openrouter/beta_analytics.py index 6c56ac1..9db10e8 100644 --- a/src/openrouter/beta_analytics.py +++ b/src/openrouter/beta_analytics.py @@ -302,7 +302,7 @@ def query_analytics( :param dimensions: :param filters: :param granularity: Time granularity - :param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. + :param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. :param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. :param order_by: :param time_range: @@ -480,7 +480,7 @@ async def query_analytics_async( :param dimensions: :param filters: :param granularity: Time granularity - :param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. + :param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. :param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. :param order_by: :param time_range: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index 3b47457..a189491 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -48,6 +48,7 @@ def send( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -70,6 +71,10 @@ def send( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -99,6 +104,8 @@ def send( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -132,6 +139,7 @@ def send( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -140,6 +148,8 @@ def send( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -151,6 +161,8 @@ def send( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -194,6 +206,7 @@ def send( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -216,6 +229,10 @@ def send( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -245,6 +262,8 @@ def send( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -278,6 +297,7 @@ def send( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -286,6 +306,8 @@ def send( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -297,6 +319,8 @@ def send( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -339,6 +363,7 @@ def send( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -361,6 +386,10 @@ def send( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -390,6 +419,8 @@ def send( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -423,6 +454,7 @@ def send( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -431,6 +463,8 @@ def send( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -442,6 +476,8 @@ def send( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -484,6 +520,7 @@ def send( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -498,6 +535,8 @@ def send( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -520,6 +559,8 @@ def send( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), @@ -764,6 +805,7 @@ async def send_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -786,6 +828,10 @@ async def send_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -815,6 +861,8 @@ async def send_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -848,6 +896,7 @@ async def send_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -856,6 +905,8 @@ async def send_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -867,6 +918,8 @@ async def send_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -910,6 +963,7 @@ async def send_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -932,6 +986,10 @@ async def send_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -961,6 +1019,8 @@ async def send_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -994,6 +1054,7 @@ async def send_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -1002,6 +1063,8 @@ async def send_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -1013,6 +1076,8 @@ async def send_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -1055,6 +1120,7 @@ async def send_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -1077,6 +1143,10 @@ async def send_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -1106,6 +1176,8 @@ async def send_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -1139,6 +1211,7 @@ async def send_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -1147,6 +1220,8 @@ async def send_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -1158,6 +1233,8 @@ async def send_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -1200,6 +1277,7 @@ async def send_async( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -1214,6 +1292,8 @@ async def send_async( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -1236,6 +1316,8 @@ async def send_async( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index ebf1361..d45e739 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -6,6 +6,7 @@ import sys if TYPE_CHECKING: + from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict from .activityitem import ActivityItem, ActivityItemTypedDict from .activityresponse import ActivityResponse, ActivityResponseTypedDict from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict @@ -270,6 +271,38 @@ BashServerToolEnvironment, BashServerToolEnvironmentTypedDict, ) + from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict + from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict + from .benchmarksaameta import ( + BenchmarksAAMeta, + BenchmarksAAMetaSource, + BenchmarksAAMetaSourceURL, + BenchmarksAAMetaTypedDict, + BenchmarksAAMetaVersion, + ) + from .benchmarksaaresponse import ( + BenchmarksAAResponse, + BenchmarksAAResponseTypedDict, + ) + from .benchmarksdaitem import ( + BenchmarksDAItem, + BenchmarksDAItemTypedDict, + TournamentStats, + TournamentStatsTypedDict, + ) + from .benchmarksdameta import ( + BenchmarksDAMeta, + BenchmarksDAMetaSource, + BenchmarksDAMetaSourceURL, + BenchmarksDAMetaTypedDict, + BenchmarksDAMetaVersion, + EloBounds, + EloBoundsTypedDict, + ) + from .benchmarksdaresponse import ( + BenchmarksDAResponse, + BenchmarksDAResponseTypedDict, + ) from .bulkaddworkspacemembersrequest import ( BulkAddWorkspaceMembersRequest, BulkAddWorkspaceMembersRequestTypedDict, @@ -434,6 +467,7 @@ ChatRequestPlugin, ChatRequestPluginTypedDict, ChatRequestReasoning, + ChatRequestReasoningEffort, ChatRequestReasoningTypedDict, ChatRequestServiceTier, ChatRequestTypedDict, @@ -727,6 +761,7 @@ CustomToolCallOutputItemTypeInputImage, CustomToolCallOutputItemTypedDict, ) + from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict from .datetimeservertool import ( DatetimeServerTool, DatetimeServerToolType, @@ -785,6 +820,13 @@ from .endpointstatus import EndpointStatus from .errorevent import ErrorEvent, ErrorEventType, ErrorEventTypedDict from .filecitation import FileCitation, FileCitationType, FileCitationTypedDict + from .filedeleteresponse import ( + FileDeleteResponse, + FileDeleteResponseType, + FileDeleteResponseTypedDict, + ) + from .filelistresponse import FileListResponse, FileListResponseTypedDict + from .filemetadata import FileMetadata, FileMetadataType, FileMetadataTypedDict from .fileparserplugin import ( FileParserPlugin, FileParserPluginID, @@ -1218,6 +1260,10 @@ MessagesAdvisorToolResultBlockType, MessagesAdvisorToolResultBlockTypedDict, ) + from .messagesfallbackparam import ( + MessagesFallbackParam, + MessagesFallbackParamTypedDict, + ) from .messagesmessageparam import ( ContentCompaction, ContentCompactionTypedDict, @@ -1373,8 +1419,10 @@ ModelArchitectureInstructType, ModelArchitectureTypedDict, ) + from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modelgroup import ModelGroup from .modellinks import ModelLinks, ModelLinksTypedDict + from .modelresponse import ModelResponse, ModelResponseTypedDict from .modelscountresponse import ( ModelsCountResponse, ModelsCountResponseData, @@ -1820,6 +1868,11 @@ TypeExit, TypeTimeout, ) + from .outputsubagentservertoolitem import ( + OutputSubagentServerToolItem, + OutputSubagentServerToolItemType, + OutputSubagentServerToolItemTypedDict, + ) from .outputtexteditorservertoolitem import ( Command, OutputTextEditorServerToolItem, @@ -1973,7 +2026,7 @@ from .rankingsdailymeta import ( RankingsDailyMeta, RankingsDailyMetaTypedDict, - Version, + RankingsDailyMetaVersion, ) from .rankingsdailyresponse import ( RankingsDailyResponse, @@ -2234,6 +2287,21 @@ ) from .sttresponse import STTResponse, STTResponseTypedDict from .sttusage import STTUsage, STTUsageTypedDict + from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict + from .subagentreasoning import ( + SubagentReasoning, + SubagentReasoningEffort, + SubagentReasoningTypedDict, + ) + from .subagentservertool_openrouter import ( + SubagentServerToolOpenRouter, + SubagentServerToolOpenRouterType, + SubagentServerToolOpenRouterTypedDict, + ) + from .subagentservertoolconfig import ( + SubagentServerToolConfig, + SubagentServerToolConfigTypedDict, + ) from .textdeltaevent import ( TextDeltaEvent, TextDeltaEventType, @@ -2427,6 +2495,8 @@ ) __all__ = [ + "AABenchmarkEntry", + "AABenchmarkEntryTypedDict", "APIType", "Action", "ActionEnum", @@ -2627,6 +2697,26 @@ "BashServerToolEnvironmentTypedDict", "BashServerToolType", "BashServerToolTypedDict", + "BenchmarkPricing", + "BenchmarkPricingTypedDict", + "BenchmarksAAItem", + "BenchmarksAAItemTypedDict", + "BenchmarksAAMeta", + "BenchmarksAAMetaSource", + "BenchmarksAAMetaSourceURL", + "BenchmarksAAMetaTypedDict", + "BenchmarksAAMetaVersion", + "BenchmarksAAResponse", + "BenchmarksAAResponseTypedDict", + "BenchmarksDAItem", + "BenchmarksDAItemTypedDict", + "BenchmarksDAMeta", + "BenchmarksDAMetaSource", + "BenchmarksDAMetaSourceURL", + "BenchmarksDAMetaTypedDict", + "BenchmarksDAMetaVersion", + "BenchmarksDAResponse", + "BenchmarksDAResponseTypedDict", "BulkAddWorkspaceMembersRequest", "BulkAddWorkspaceMembersRequestTypedDict", "BulkAddWorkspaceMembersResponse", @@ -2736,6 +2826,7 @@ "ChatRequestPlugin", "ChatRequestPluginTypedDict", "ChatRequestReasoning", + "ChatRequestReasoningEffort", "ChatRequestReasoningTypedDict", "ChatRequestServiceTier", "ChatRequestTypedDict", @@ -2945,6 +3036,8 @@ "CustomToolCallOutputItemTypedDict", "CustomToolTypeCustom", "CustomToolTypedDict", + "DABenchmarkEntry", + "DABenchmarkEntryTypedDict", "DataCollection", "DataRegion", "DatetimeServerTool", @@ -2994,6 +3087,8 @@ "EditCompact20260112TypedDict", "EditTypeInputTokens", "EditTypedDict", + "EloBounds", + "EloBoundsTypedDict", "EndpointInfo", "EndpointInfoTypedDict", "EndpointStatus", @@ -3013,6 +3108,14 @@ "FileCitation", "FileCitationType", "FileCitationTypedDict", + "FileDeleteResponse", + "FileDeleteResponseType", + "FileDeleteResponseTypedDict", + "FileListResponse", + "FileListResponseTypedDict", + "FileMetadata", + "FileMetadataType", + "FileMetadataTypedDict", "FileParserPlugin", "FileParserPluginID", "FileParserPluginTypedDict", @@ -3331,6 +3434,8 @@ "MessagesAdvisorToolResultBlock", "MessagesAdvisorToolResultBlockType", "MessagesAdvisorToolResultBlockTypedDict", + "MessagesFallbackParam", + "MessagesFallbackParamTypedDict", "MessagesMessageParam", "MessagesMessageParamContentUnion1", "MessagesMessageParamContentUnion1TypedDict", @@ -3372,10 +3477,14 @@ "ModelArchitecture", "ModelArchitectureInstructType", "ModelArchitectureTypedDict", + "ModelBenchmarks", + "ModelBenchmarksTypedDict", "ModelEnum", "ModelGroup", "ModelLinks", "ModelLinksTypedDict", + "ModelResponse", + "ModelResponseTypedDict", "ModelTypedDict", "ModelsCountResponse", "ModelsCountResponseData", @@ -3702,6 +3811,9 @@ "OutputShellCallOutputItemOutputTypedDict", "OutputShellCallOutputItemTypeShellCallOutput", "OutputShellCallOutputItemTypedDict", + "OutputSubagentServerToolItem", + "OutputSubagentServerToolItemType", + "OutputSubagentServerToolItemTypedDict", "OutputTextEditorServerToolItem", "OutputTextEditorServerToolItemType", "OutputTextEditorServerToolItemTypedDict", @@ -3808,6 +3920,7 @@ "RankingsDailyItemTypedDict", "RankingsDailyMeta", "RankingsDailyMetaTypedDict", + "RankingsDailyMetaVersion", "RankingsDailyResponse", "RankingsDailyResponseTypedDict", "Reason", @@ -4007,6 +4120,16 @@ "StreamLogprobTopLogprob", "StreamLogprobTopLogprobTypedDict", "StreamLogprobTypedDict", + "SubagentNestedTool", + "SubagentNestedToolTypedDict", + "SubagentReasoning", + "SubagentReasoningEffort", + "SubagentReasoningTypedDict", + "SubagentServerToolConfig", + "SubagentServerToolConfigTypedDict", + "SubagentServerToolOpenRouter", + "SubagentServerToolOpenRouterType", + "SubagentServerToolOpenRouterTypedDict", "SupportedAspectRatio", "SupportedFrameImage", "SupportedResolution", @@ -4066,6 +4189,8 @@ "ToolWebSearch20260209TypedDict", "TopProviderInfo", "TopProviderInfoTypedDict", + "TournamentStats", + "TournamentStatsTypedDict", "TraceConfig", "TraceConfigTypedDict", "Trigger", @@ -4144,7 +4269,6 @@ "Variables", "VariablesTypedDict", "Verbosity", - "Version", "VideoGenerationRequest", "VideoGenerationRequestProvider", "VideoGenerationRequestProviderTypedDict", @@ -4214,6 +4338,8 @@ ] _dynamic_imports: dict[str, str] = { + "AABenchmarkEntry": ".aabenchmarkentry", + "AABenchmarkEntryTypedDict": ".aabenchmarkentry", "ActivityItem": ".activityitem", "ActivityItemTypedDict": ".activityitem", "ActivityResponse": ".activityresponse", @@ -4396,6 +4522,30 @@ "BashServerToolEngine": ".bashservertoolengine", "BashServerToolEnvironment": ".bashservertoolenvironment", "BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment", + "BenchmarkPricing": ".benchmarkpricing", + "BenchmarkPricingTypedDict": ".benchmarkpricing", + "BenchmarksAAItem": ".benchmarksaaitem", + "BenchmarksAAItemTypedDict": ".benchmarksaaitem", + "BenchmarksAAMeta": ".benchmarksaameta", + "BenchmarksAAMetaSource": ".benchmarksaameta", + "BenchmarksAAMetaSourceURL": ".benchmarksaameta", + "BenchmarksAAMetaTypedDict": ".benchmarksaameta", + "BenchmarksAAMetaVersion": ".benchmarksaameta", + "BenchmarksAAResponse": ".benchmarksaaresponse", + "BenchmarksAAResponseTypedDict": ".benchmarksaaresponse", + "BenchmarksDAItem": ".benchmarksdaitem", + "BenchmarksDAItemTypedDict": ".benchmarksdaitem", + "TournamentStats": ".benchmarksdaitem", + "TournamentStatsTypedDict": ".benchmarksdaitem", + "BenchmarksDAMeta": ".benchmarksdameta", + "BenchmarksDAMetaSource": ".benchmarksdameta", + "BenchmarksDAMetaSourceURL": ".benchmarksdameta", + "BenchmarksDAMetaTypedDict": ".benchmarksdameta", + "BenchmarksDAMetaVersion": ".benchmarksdameta", + "EloBounds": ".benchmarksdameta", + "EloBoundsTypedDict": ".benchmarksdameta", + "BenchmarksDAResponse": ".benchmarksdaresponse", + "BenchmarksDAResponseTypedDict": ".benchmarksdaresponse", "BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse", @@ -4507,6 +4657,7 @@ "ChatRequestPlugin": ".chatrequest", "ChatRequestPluginTypedDict": ".chatrequest", "ChatRequestReasoning": ".chatrequest", + "ChatRequestReasoningEffort": ".chatrequest", "ChatRequestReasoningTypedDict": ".chatrequest", "ChatRequestServiceTier": ".chatrequest", "ChatRequestTypedDict": ".chatrequest", @@ -4712,6 +4863,8 @@ "CustomToolCallOutputItemTypeCustomToolCallOutput": ".customtoolcalloutputitem", "CustomToolCallOutputItemTypeInputImage": ".customtoolcalloutputitem", "CustomToolCallOutputItemTypedDict": ".customtoolcalloutputitem", + "DABenchmarkEntry": ".dabenchmarkentry", + "DABenchmarkEntryTypedDict": ".dabenchmarkentry", "DatetimeServerTool": ".datetimeservertool", "DatetimeServerToolType": ".datetimeservertool", "DatetimeServerToolTypedDict": ".datetimeservertool", @@ -4761,6 +4914,14 @@ "FileCitation": ".filecitation", "FileCitationType": ".filecitation", "FileCitationTypedDict": ".filecitation", + "FileDeleteResponse": ".filedeleteresponse", + "FileDeleteResponseType": ".filedeleteresponse", + "FileDeleteResponseTypedDict": ".filedeleteresponse", + "FileListResponse": ".filelistresponse", + "FileListResponseTypedDict": ".filelistresponse", + "FileMetadata": ".filemetadata", + "FileMetadataType": ".filemetadata", + "FileMetadataTypedDict": ".filemetadata", "FileParserPlugin": ".fileparserplugin", "FileParserPluginID": ".fileparserplugin", "FileParserPluginTypedDict": ".fileparserplugin", @@ -5091,6 +5252,8 @@ "MessagesAdvisorToolResultBlock": ".messagesadvisortoolresultblock", "MessagesAdvisorToolResultBlockType": ".messagesadvisortoolresultblock", "MessagesAdvisorToolResultBlockTypedDict": ".messagesadvisortoolresultblock", + "MessagesFallbackParam": ".messagesfallbackparam", + "MessagesFallbackParamTypedDict": ".messagesfallbackparam", "ContentCompaction": ".messagesmessageparam", "ContentCompactionTypedDict": ".messagesmessageparam", "ContentRedactedThinking": ".messagesmessageparam", @@ -5239,9 +5402,13 @@ "ModelArchitecture": ".modelarchitecture", "ModelArchitectureInstructType": ".modelarchitecture", "ModelArchitectureTypedDict": ".modelarchitecture", + "ModelBenchmarks": ".modelbenchmarks", + "ModelBenchmarksTypedDict": ".modelbenchmarks", "ModelGroup": ".modelgroup", "ModelLinks": ".modellinks", "ModelLinksTypedDict": ".modellinks", + "ModelResponse": ".modelresponse", + "ModelResponseTypedDict": ".modelresponse", "ModelsCountResponse": ".modelscountresponse", "ModelsCountResponseData": ".modelscountresponse", "ModelsCountResponseDataTypedDict": ".modelscountresponse", @@ -5573,6 +5740,9 @@ "OutputShellCallOutputItemTypedDict": ".outputshellcalloutputitem", "TypeExit": ".outputshellcalloutputitem", "TypeTimeout": ".outputshellcalloutputitem", + "OutputSubagentServerToolItem": ".outputsubagentservertoolitem", + "OutputSubagentServerToolItemType": ".outputsubagentservertoolitem", + "OutputSubagentServerToolItemTypedDict": ".outputsubagentservertoolitem", "Command": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItem": ".outputtexteditorservertoolitem", "OutputTextEditorServerToolItemType": ".outputtexteditorservertoolitem", @@ -5690,7 +5860,7 @@ "RankingsDailyItemTypedDict": ".rankingsdailyitem", "RankingsDailyMeta": ".rankingsdailymeta", "RankingsDailyMetaTypedDict": ".rankingsdailymeta", - "Version": ".rankingsdailymeta", + "RankingsDailyMetaVersion": ".rankingsdailymeta", "RankingsDailyResponse": ".rankingsdailyresponse", "RankingsDailyResponseTypedDict": ".rankingsdailyresponse", "ReasoningConfig": ".reasoningconfig", @@ -5869,6 +6039,16 @@ "STTResponseTypedDict": ".sttresponse", "STTUsage": ".sttusage", "STTUsageTypedDict": ".sttusage", + "SubagentNestedTool": ".subagentnestedtool", + "SubagentNestedToolTypedDict": ".subagentnestedtool", + "SubagentReasoning": ".subagentreasoning", + "SubagentReasoningEffort": ".subagentreasoning", + "SubagentReasoningTypedDict": ".subagentreasoning", + "SubagentServerToolOpenRouter": ".subagentservertool_openrouter", + "SubagentServerToolOpenRouterType": ".subagentservertool_openrouter", + "SubagentServerToolOpenRouterTypedDict": ".subagentservertool_openrouter", + "SubagentServerToolConfig": ".subagentservertoolconfig", + "SubagentServerToolConfigTypedDict": ".subagentservertoolconfig", "TextDeltaEvent": ".textdeltaevent", "TextDeltaEventType": ".textdeltaevent", "TextDeltaEventTypedDict": ".textdeltaevent", diff --git a/src/openrouter/components/aabenchmarkentry.py b/src/openrouter/components/aabenchmarkentry.py new file mode 100644 index 0000000..dcf3613 --- /dev/null +++ b/src/openrouter/components/aabenchmarkentry.py @@ -0,0 +1,60 @@ +"""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 AABenchmarkEntryTypedDict(TypedDict): + r"""Artificial Analysis benchmark index scores.""" + + agentic_index: Nullable[float] + r"""Artificial Analysis Agentic Index score""" + coding_index: Nullable[float] + r"""Artificial Analysis Coding Index score""" + intelligence_index: Nullable[float] + r"""Artificial Analysis Intelligence Index score""" + + +class AABenchmarkEntry(BaseModel): + r"""Artificial Analysis benchmark index scores.""" + + agentic_index: Nullable[float] + r"""Artificial Analysis Agentic Index score""" + + coding_index: Nullable[float] + r"""Artificial Analysis Coding Index score""" + + intelligence_index: Nullable[float] + r"""Artificial Analysis Intelligence Index score""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["agentic_index", "coding_index", "intelligence_index"] + 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/advisornestedtool.py b/src/openrouter/components/advisornestedtool.py index 0226627..e21d2d2 100644 --- a/src/openrouter/components/advisornestedtool.py +++ b/src/openrouter/components/advisornestedtool.py @@ -9,15 +9,14 @@ class AdvisorNestedToolTypedDict(TypedDict): - r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself.""" + r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself.""" type: str - function: NotRequired[Dict[str, Nullable[Any]]] parameters: NotRequired[Dict[str, Nullable[Any]]] class AdvisorNestedTool(BaseModel): - r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself.""" + r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself.""" model_config = ConfigDict( populate_by_name=True, arbitrary_types_allowed=True, extra="allow" @@ -26,8 +25,6 @@ class AdvisorNestedTool(BaseModel): type: str - function: Optional[Dict[str, Nullable[Any]]] = None - parameters: Optional[Dict[str, Nullable[Any]]] = None @property diff --git a/src/openrouter/components/advisorservertoolconfig.py b/src/openrouter/components/advisorservertoolconfig.py index 7cfdf3a..4540be9 100644 --- a/src/openrouter/components/advisorservertoolconfig.py +++ b/src/openrouter/components/advisorservertoolconfig.py @@ -30,7 +30,7 @@ class AdvisorServerToolConfigTypedDict(TypedDict): temperature: NotRequired[float] r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies.""" tools: NotRequired[List[AdvisorNestedToolTypedDict]] - r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself.""" + r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself.""" class AdvisorServerToolConfig(BaseModel): @@ -64,4 +64,4 @@ class AdvisorServerToolConfig(BaseModel): r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies.""" tools: Optional[List[AdvisorNestedTool]] = None - r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself.""" + r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself.""" diff --git a/src/openrouter/components/benchmarkpricing.py b/src/openrouter/components/benchmarkpricing.py new file mode 100644 index 0000000..3524f78 --- /dev/null +++ b/src/openrouter/components/benchmarkpricing.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class BenchmarkPricingTypedDict(TypedDict): + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + completion: str + r"""Cost per output token (USD, decimal string).""" + prompt: str + r"""Cost per input token (USD, decimal string).""" + + +class BenchmarkPricing(BaseModel): + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + completion: str + r"""Cost per output token (USD, decimal string).""" + + prompt: str + r"""Cost per input token (USD, decimal string).""" diff --git a/src/openrouter/components/benchmarksaaitem.py b/src/openrouter/components/benchmarksaaitem.py new file mode 100644 index 0000000..2855ffe --- /dev/null +++ b/src/openrouter/components/benchmarksaaitem.py @@ -0,0 +1,77 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing_extensions import TypedDict + + +class BenchmarksAAItemTypedDict(TypedDict): + aa_name: str + r"""Model name as listed on Artificial Analysis.""" + agentic_index: Nullable[float] + r"""Artificial Analysis Agentic Index composite score. Higher is better.""" + coding_index: Nullable[float] + r"""Artificial Analysis Coding Index composite score. Higher is better.""" + intelligence_index: Nullable[float] + r"""Artificial Analysis Intelligence Index composite score. Higher is better.""" + model_permaslug: str + r"""Stable OpenRouter model identifier.""" + pricing: Nullable[BenchmarkPricingTypedDict] + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + +class BenchmarksAAItem(BaseModel): + aa_name: str + r"""Model name as listed on Artificial Analysis.""" + + agentic_index: Nullable[float] + r"""Artificial Analysis Agentic Index composite score. Higher is better.""" + + coding_index: Nullable[float] + r"""Artificial Analysis Coding Index composite score. Higher is better.""" + + intelligence_index: Nullable[float] + r"""Artificial Analysis Intelligence Index composite score. Higher is better.""" + + model_permaslug: str + r"""Stable OpenRouter model identifier.""" + + pricing: Nullable[BenchmarkPricing] + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = [ + "agentic_index", + "coding_index", + "intelligence_index", + "pricing", + ] + 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/benchmarksaameta.py b/src/openrouter/components/benchmarksaameta.py new file mode 100644 index 0000000..9d751f4 --- /dev/null +++ b/src/openrouter/components/benchmarksaameta.py @@ -0,0 +1,53 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +BenchmarksAAMetaSource = Literal["artificial-analysis",] +r"""Data source identifier.""" + + +BenchmarksAAMetaSourceURL = Literal["https://artificialanalysis.ai",] +r"""URL of the upstream data source.""" + + +BenchmarksAAMetaVersion = Literal["v1",] +r"""Dataset version.""" + + +class BenchmarksAAMetaTypedDict(TypedDict): + as_of: str + r"""ISO-8601 timestamp of when this data was last updated.""" + citation: str + r"""Required attribution when republishing this data.""" + model_count: int + r"""Number of unique models in the response.""" + source: BenchmarksAAMetaSource + r"""Data source identifier.""" + source_url: BenchmarksAAMetaSourceURL + r"""URL of the upstream data source.""" + version: BenchmarksAAMetaVersion + r"""Dataset version.""" + + +class BenchmarksAAMeta(BaseModel): + as_of: str + r"""ISO-8601 timestamp of when this data was last updated.""" + + citation: str + r"""Required attribution when republishing this data.""" + + model_count: int + r"""Number of unique models in the response.""" + + source: BenchmarksAAMetaSource + r"""Data source identifier.""" + + source_url: BenchmarksAAMetaSourceURL + r"""URL of the upstream data source.""" + + version: BenchmarksAAMetaVersion + r"""Dataset version.""" diff --git a/src/openrouter/components/benchmarksaaresponse.py b/src/openrouter/components/benchmarksaaresponse.py new file mode 100644 index 0000000..787ae1c --- /dev/null +++ b/src/openrouter/components/benchmarksaaresponse.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict +from .benchmarksaameta import BenchmarksAAMeta, BenchmarksAAMetaTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class BenchmarksAAResponseTypedDict(TypedDict): + data: List[BenchmarksAAItemTypedDict] + meta: BenchmarksAAMetaTypedDict + + +class BenchmarksAAResponse(BaseModel): + data: List[BenchmarksAAItem] + + meta: BenchmarksAAMeta diff --git a/src/openrouter/components/benchmarksdaitem.py b/src/openrouter/components/benchmarksdaitem.py new file mode 100644 index 0000000..7713e2e --- /dev/null +++ b/src/openrouter/components/benchmarksdaitem.py @@ -0,0 +1,147 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing_extensions import TypedDict + + +class TournamentStatsTypedDict(TypedDict): + r"""Placement distribution from tournament matches.""" + + first_place: Nullable[int] + fourth_place: Nullable[int] + second_place: Nullable[int] + third_place: Nullable[int] + total: Nullable[int] + + +class TournamentStats(BaseModel): + r"""Placement distribution from tournament matches.""" + + first_place: Nullable[int] + + fourth_place: Nullable[int] + + second_place: Nullable[int] + + third_place: Nullable[int] + + total: Nullable[int] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = [ + "first_place", + "fourth_place", + "second_place", + "third_place", + "total", + ] + 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 BenchmarksDAItemTypedDict(TypedDict): + arena: str + r"""Arena this ranking belongs to.""" + avg_generation_time_ms: Nullable[float] + r"""Average generation time in milliseconds.""" + category: str + r"""Category within the arena.""" + display_name: str + r"""Human-readable model name from Design Arena.""" + elo: float + r"""ELO rating from head-to-head arena battles.""" + model_permaslug: str + r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models.""" + pricing: Nullable[BenchmarkPricingTypedDict] + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + tournament_stats: TournamentStatsTypedDict + r"""Placement distribution from tournament matches.""" + win_rate: float + r"""Win rate as a percentage (0–100).""" + + +class BenchmarksDAItem(BaseModel): + arena: str + r"""Arena this ranking belongs to.""" + + avg_generation_time_ms: Nullable[float] + r"""Average generation time in milliseconds.""" + + category: str + r"""Category within the arena.""" + + display_name: str + r"""Human-readable model name from Design Arena.""" + + elo: float + r"""ELO rating from head-to-head arena battles.""" + + model_permaslug: str + r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models.""" + + pricing: Nullable[BenchmarkPricing] + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + tournament_stats: TournamentStats + r"""Placement distribution from tournament matches.""" + + win_rate: float + r"""Win rate as a percentage (0–100).""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["avg_generation_time_ms", "pricing"] + 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/benchmarksdameta.py b/src/openrouter/components/benchmarksdameta.py new file mode 100644 index 0000000..0ca3550 --- /dev/null +++ b/src/openrouter/components/benchmarksdameta.py @@ -0,0 +1,118 @@ +"""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 Literal +from typing_extensions import TypedDict + + +class EloBoundsTypedDict(TypedDict): + r"""ELO range across all returned models for normalization.""" + + max: float + r"""Maximum ELO in the result set.""" + min: float + r"""Minimum ELO in the result set.""" + + +class EloBounds(BaseModel): + r"""ELO range across all returned models for normalization.""" + + max: float + r"""Maximum ELO in the result set.""" + + min: float + r"""Minimum ELO in the result set.""" + + +BenchmarksDAMetaSource = Literal["design-arena",] +r"""Data source identifier.""" + + +BenchmarksDAMetaSourceURL = Literal["https://www.designarena.ai",] +r"""URL of the upstream data source.""" + + +BenchmarksDAMetaVersion = Literal["v1",] +r"""Dataset version.""" + + +class BenchmarksDAMetaTypedDict(TypedDict): + arena: str + r"""The arena filter applied.""" + as_of: str + r"""ISO-8601 timestamp of when this data was generated.""" + category: Nullable[str] + r"""The category filter applied, or null if showing all.""" + citation: str + r"""Required attribution when republishing this data.""" + elo_bounds: EloBoundsTypedDict + r"""ELO range across all returned models for normalization.""" + model_count: int + r"""Number of unique models in the response.""" + source: BenchmarksDAMetaSource + r"""Data source identifier.""" + source_url: BenchmarksDAMetaSourceURL + r"""URL of the upstream data source.""" + version: BenchmarksDAMetaVersion + r"""Dataset version.""" + + +class BenchmarksDAMeta(BaseModel): + arena: str + r"""The arena filter applied.""" + + as_of: str + r"""ISO-8601 timestamp of when this data was generated.""" + + category: Nullable[str] + r"""The category filter applied, or null if showing all.""" + + citation: str + r"""Required attribution when republishing this data.""" + + elo_bounds: EloBounds + r"""ELO range across all returned models for normalization.""" + + model_count: int + r"""Number of unique models in the response.""" + + source: BenchmarksDAMetaSource + r"""Data source identifier.""" + + source_url: BenchmarksDAMetaSourceURL + r"""URL of the upstream data source.""" + + version: BenchmarksDAMetaVersion + r"""Dataset version.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["category"] + 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/benchmarksdaresponse.py b/src/openrouter/components/benchmarksdaresponse.py new file mode 100644 index 0000000..7588fc5 --- /dev/null +++ b/src/openrouter/components/benchmarksdaresponse.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict +from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class BenchmarksDAResponseTypedDict(TypedDict): + data: List[BenchmarksDAItemTypedDict] + meta: BenchmarksDAMetaTypedDict + + +class BenchmarksDAResponse(BaseModel): + data: List[BenchmarksDAItem] + + meta: BenchmarksDAMeta diff --git a/src/openrouter/components/chatfunctiontool.py b/src/openrouter/components/chatfunctiontool.py index ab87fc3..e0f23b3 100644 --- a/src/openrouter/components/chatfunctiontool.py +++ b/src/openrouter/components/chatfunctiontool.py @@ -27,6 +27,10 @@ OpenRouterWebSearchServerTool, OpenRouterWebSearchServerToolTypedDict, ) +from .subagentservertool_openrouter import ( + SubagentServerToolOpenRouter, + SubagentServerToolOpenRouterTypedDict, +) from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict from openrouter.types import ( BaseModel, @@ -129,6 +133,7 @@ class ChatFunctionToolFunction(BaseModel): DatetimeServerToolTypedDict, ImageGenerationServerToolOpenRouterTypedDict, ChatSearchModelsServerToolTypedDict, + SubagentServerToolOpenRouterTypedDict, WebFetchServerToolTypedDict, OpenRouterWebSearchServerToolTypedDict, ChatFunctionToolFunctionTypedDict, @@ -150,6 +155,7 @@ class ChatFunctionToolFunction(BaseModel): Annotated[ ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models") ], + Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")], Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")], Annotated[OpenRouterWebSearchServerTool, Tag("openrouter:web_search")], Annotated[ChatWebSearchShorthand, Tag("web_search")], diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index 97f89d9..f90c290 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -170,6 +170,20 @@ def serialize_model(self, handler): return m +ChatRequestReasoningEffort = Union[ + Literal[ + "xhigh", + "high", + "medium", + "low", + "minimal", + "none", + ], + UnrecognizedStr, +] +r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.""" + + ResponseFormatTypedDict = TypeAliasType( "ResponseFormatTypedDict", Union[ @@ -240,6 +254,8 @@ class ChatRequestTypedDict(TypedDict): r"""Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.""" metadata: NotRequired[Dict[str, str]] r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" + min_p: NotRequired[Nullable[float]] + r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.""" modalities: NotRequired[List[Modality]] r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".""" model: NotRequired[str] @@ -256,6 +272,10 @@ class ChatRequestTypedDict(TypedDict): r"""When multiple model providers are available, optionally indicate your routing preference.""" reasoning: NotRequired[ChatRequestReasoningTypedDict] r"""Configuration options for reasoning models""" + reasoning_effort: NotRequired[Nullable[ChatRequestReasoningEffort]] + r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.""" + repetition_penalty: NotRequired[Nullable[float]] + r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.""" response_format: NotRequired[ResponseFormatTypedDict] r"""Response format configuration""" seed: NotRequired[Nullable[int]] @@ -278,6 +298,10 @@ class ChatRequestTypedDict(TypedDict): r"""Tool choice configuration""" tools: NotRequired[List[ChatFunctionToolTypedDict]] r"""Available tools for function calling""" + top_a: NotRequired[Nullable[float]] + r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.""" + top_k: NotRequired[Nullable[int]] + r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.""" top_logprobs: NotRequired[Nullable[int]] r"""Number of top log probabilities to return (0-20)""" top_p: NotRequired[Nullable[float]] @@ -321,6 +345,9 @@ class ChatRequest(BaseModel): metadata: Optional[Dict[str, str]] = None r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" + min_p: OptionalNullable[float] = UNSET + r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.""" + modalities: Optional[ List[Annotated[Modality, PlainValidator(validate_open_enum(False))]] ] = None @@ -347,6 +374,15 @@ class ChatRequest(BaseModel): reasoning: Optional[ChatRequestReasoning] = None r"""Configuration options for reasoning models""" + reasoning_effort: Annotated[ + OptionalNullable[ChatRequestReasoningEffort], + PlainValidator(validate_open_enum(False)), + ] = UNSET + r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.""" + + repetition_penalty: OptionalNullable[float] = UNSET + r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.""" + response_format: Optional[ResponseFormat] = None r"""Response format configuration""" @@ -383,6 +419,12 @@ class ChatRequest(BaseModel): tools: Optional[List[ChatFunctionTool]] = None r"""Available tools for function calling""" + top_a: OptionalNullable[float] = UNSET + r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.""" + + top_k: OptionalNullable[int] = UNSET + r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.""" + top_logprobs: OptionalNullable[int] = UNSET r"""Number of top log probabilities to return (0-20)""" @@ -407,6 +449,7 @@ def serialize_model(self, handler): "max_completion_tokens", "max_tokens", "metadata", + "min_p", "modalities", "model", "models", @@ -415,6 +458,8 @@ def serialize_model(self, handler): "presence_penalty", "provider", "reasoning", + "reasoning_effort", + "repetition_penalty", "response_format", "seed", "service_tier", @@ -426,6 +471,8 @@ def serialize_model(self, handler): "temperature", "tool_choice", "tools", + "top_a", + "top_k", "top_logprobs", "top_p", "trace", @@ -437,14 +484,19 @@ def serialize_model(self, handler): "logprobs", "max_completion_tokens", "max_tokens", + "min_p", "parallel_tool_calls", "presence_penalty", "provider", + "reasoning_effort", + "repetition_penalty", "seed", "service_tier", "stop", "stream_options", "temperature", + "top_a", + "top_k", "top_logprobs", "top_p", ] diff --git a/src/openrouter/components/chatwebsearchshorthand.py b/src/openrouter/components/chatwebsearchshorthand.py index ee79798..529d7b6 100644 --- a/src/openrouter/components/chatwebsearchshorthand.py +++ b/src/openrouter/components/chatwebsearchshorthand.py @@ -31,20 +31,20 @@ class ChatWebSearchShorthandTypedDict(TypedDict): type: ChatWebSearchShorthandType allowed_domains: NotRequired[List[str]] - r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" + r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains.""" engine: NotRequired[WebSearchEngineEnum] - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" excluded_domains: NotRequired[List[str]] - r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" + r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains.""" max_characters: NotRequired[int] - r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" + r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity).""" max_results: NotRequired[int] - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" max_total_results: NotRequired[int] r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" parameters: NotRequired[WebSearchConfigTypedDict] search_context_size: NotRequired[SearchQualityLevel] - r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" + r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] r"""Approximate user location for location-biased results.""" @@ -57,21 +57,21 @@ class ChatWebSearchShorthand(BaseModel): ] allowed_domains: Optional[List[str]] = None - r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" + r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains.""" engine: Annotated[ Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) ] = None - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" excluded_domains: Optional[List[str]] = None - r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" + r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains.""" max_characters: Optional[int] = None - r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" + r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity).""" max_results: Optional[int] = None - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" max_total_results: Optional[int] = None r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" @@ -81,7 +81,7 @@ class ChatWebSearchShorthand(BaseModel): search_context_size: Annotated[ Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False)) ] = None - r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" + r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: Optional[WebSearchUserLocationServerTool] = None r"""Approximate user location for location-biased results.""" diff --git a/src/openrouter/components/dabenchmarkentry.py b/src/openrouter/components/dabenchmarkentry.py new file mode 100644 index 0000000..35a1a90 --- /dev/null +++ b/src/openrouter/components/dabenchmarkentry.py @@ -0,0 +1,39 @@ +"""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 DABenchmarkEntryTypedDict(TypedDict): + r"""A single Design Arena benchmark entry for a specific arena+category""" + + arena: str + r"""Arena type (e.g. models, builders, agents)""" + category: str + r"""Category within the arena (e.g. website, gamedev, uicomponent)""" + elo: float + r"""ELO rating from head-to-head arena battles""" + rank: int + r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)""" + win_rate: float + r"""Win rate percentage in arena battles""" + + +class DABenchmarkEntry(BaseModel): + r"""A single Design Arena benchmark entry for a specific arena+category""" + + arena: str + r"""Arena type (e.g. models, builders, agents)""" + + category: str + r"""Category within the arena (e.g. website, gamedev, uicomponent)""" + + elo: float + r"""ELO rating from head-to-head arena battles""" + + rank: int + r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)""" + + win_rate: float + r"""Win rate percentage in arena battles""" diff --git a/src/openrouter/components/filedeleteresponse.py b/src/openrouter/components/filedeleteresponse.py new file mode 100644 index 0000000..ee75b85 --- /dev/null +++ b/src/openrouter/components/filedeleteresponse.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +FileDeleteResponseType = Literal["file_deleted",] + + +class FileDeleteResponseTypedDict(TypedDict): + r"""Confirmation that a file was deleted.""" + + id: str + type: FileDeleteResponseType + + +class FileDeleteResponse(BaseModel): + r"""Confirmation that a file was deleted.""" + + id: str + + type: FileDeleteResponseType diff --git a/src/openrouter/components/filelistresponse.py b/src/openrouter/components/filelistresponse.py new file mode 100644 index 0000000..6893299 --- /dev/null +++ b/src/openrouter/components/filelistresponse.py @@ -0,0 +1,64 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .filemetadata import FileMetadata, FileMetadataTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List +from typing_extensions import TypedDict + + +class FileListResponseTypedDict(TypedDict): + r"""A page of files belonging to the requesting workspace.""" + + cursor: Nullable[str] + r"""Opaque cursor for the next page; null when there are no more results.""" + data: List[FileMetadataTypedDict] + first_id: Nullable[str] + has_more: bool + last_id: Nullable[str] + + +class FileListResponse(BaseModel): + r"""A page of files belonging to the requesting workspace.""" + + cursor: Nullable[str] + r"""Opaque cursor for the next page; null when there are no more results.""" + + data: List[FileMetadata] + + first_id: Nullable[str] + + has_more: bool + + last_id: Nullable[str] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["cursor", "first_id", "last_id"] + 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/filemetadata.py b/src/openrouter/components/filemetadata.py new file mode 100644 index 0000000..e128dc9 --- /dev/null +++ b/src/openrouter/components/filemetadata.py @@ -0,0 +1,39 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +FileMetadataType = Literal["file",] + + +class FileMetadataTypedDict(TypedDict): + r"""Metadata describing a stored file.""" + + created_at: str + downloadable: bool + filename: str + id: str + mime_type: str + size_bytes: int + type: FileMetadataType + + +class FileMetadata(BaseModel): + r"""Metadata describing a stored file.""" + + created_at: str + + downloadable: bool + + filename: str + + id: str + + mime_type: str + + size_bytes: int + + type: FileMetadataType diff --git a/src/openrouter/components/inputs_union.py b/src/openrouter/components/inputs_union.py index b409898..04e80eb 100644 --- a/src/openrouter/components/inputs_union.py +++ b/src/openrouter/components/inputs_union.py @@ -104,6 +104,10 @@ OutputSearchModelsServerToolItem, OutputSearchModelsServerToolItemTypedDict, ) +from .outputsubagentservertoolitem import ( + OutputSubagentServerToolItem, + OutputSubagentServerToolItemTypedDict, +) from .outputtexteditorservertoolitem import ( OutputTextEditorServerToolItem, OutputTextEditorServerToolItemTypedDict, @@ -385,47 +389,48 @@ def serialize_model(self, handler): Union[ ItemReferenceItemTypedDict, CompactionItemTypedDict, + LocalShellCallOutputItemTypedDict, OutputFileSearchCallItemTypedDict, EasyInputMessageTypedDict, InputMessageItemTypedDict, - LocalShellCallOutputItemTypedDict, + CustomToolCallOutputItemTypedDict, OutputToolSearchServerToolItemTypedDict, OutputFileSearchServerToolItemTypedDict, OutputWebSearchServerToolItemTypedDict, - CustomToolCallOutputItemTypedDict, OutputImageGenerationCallItemTypedDict, OutputWebSearchCallItemTypedDict, - OutputDatetimeItemTypedDict, + OutputTextEditorServerToolItemTypedDict, OutputMcpServerToolItemTypedDict, - FunctionCallOutputItemTypedDict, - LocalShellCallItemTypedDict, - OutputSearchModelsServerToolItemTypedDict, + OutputApplyPatchServerToolItemTypedDict, ApplyPatchCallItemTypedDict, - McpListToolsItemTypedDict, + OutputDatetimeItemTypedDict, ApplyPatchCallOutputItemTypedDict, McpApprovalResponseItemTypedDict, - OutputBrowserUseServerToolItemTypedDict, McpApprovalRequestItemTypedDict, - OutputTextEditorServerToolItemTypedDict, - OutputApplyPatchServerToolItemTypedDict, - CustomToolCallItemTypedDict, - InputsMessageTypedDict, + McpListToolsItemTypedDict, + OutputBrowserUseServerToolItemTypedDict, + LocalShellCallItemTypedDict, + OutputSearchModelsServerToolItemTypedDict, + FunctionCallOutputItemTypedDict, + ShellCallItemTypedDict, OutputMemoryServerToolItemTypedDict, + OutputCodeInterpreterCallItemTypedDict, + InputsMessageTypedDict, + OutputComputerCallItemTypedDict, OutputCustomToolCallItemTypedDict, - ShellCallItemTypedDict, ShellCallOutputItemTypedDict, - OutputComputerCallItemTypedDict, - OutputCodeInterpreterCallItemTypedDict, - OutputImageGenerationServerToolItemTypedDict, - OutputBashServerToolItemTypedDict, + CustomToolCallItemTypedDict, McpCallItemTypedDict, - OutputFunctionCallItemTypedDict, + OutputBashServerToolItemTypedDict, FunctionCallItemTypedDict, + OutputFunctionCallItemTypedDict, + OutputImageGenerationServerToolItemTypedDict, OutputAdvisorServerToolItemTypedDict, - OutputWebFetchServerToolItemTypedDict, - ReasoningItemTypedDict, OutputCodeInterpreterServerToolItemTypedDict, InputsReasoningTypedDict, + ReasoningItemTypedDict, + OutputSubagentServerToolItemTypedDict, + OutputWebFetchServerToolItemTypedDict, ], ) @@ -435,47 +440,48 @@ def serialize_model(self, handler): Union[ ItemReferenceItem, CompactionItem, + LocalShellCallOutputItem, OutputFileSearchCallItem, EasyInputMessage, InputMessageItem, - LocalShellCallOutputItem, + CustomToolCallOutputItem, OutputToolSearchServerToolItem, OutputFileSearchServerToolItem, OutputWebSearchServerToolItem, - CustomToolCallOutputItem, OutputImageGenerationCallItem, OutputWebSearchCallItem, - OutputDatetimeItem, + OutputTextEditorServerToolItem, OutputMcpServerToolItem, - FunctionCallOutputItem, - LocalShellCallItem, - OutputSearchModelsServerToolItem, + OutputApplyPatchServerToolItem, ApplyPatchCallItem, - McpListToolsItem, + OutputDatetimeItem, ApplyPatchCallOutputItem, McpApprovalResponseItem, - OutputBrowserUseServerToolItem, McpApprovalRequestItem, - OutputTextEditorServerToolItem, - OutputApplyPatchServerToolItem, - CustomToolCallItem, - InputsMessage, + McpListToolsItem, + OutputBrowserUseServerToolItem, + LocalShellCallItem, + OutputSearchModelsServerToolItem, + FunctionCallOutputItem, + ShellCallItem, OutputMemoryServerToolItem, + OutputCodeInterpreterCallItem, + InputsMessage, + OutputComputerCallItem, OutputCustomToolCallItem, - ShellCallItem, ShellCallOutputItem, - OutputComputerCallItem, - OutputCodeInterpreterCallItem, - OutputImageGenerationServerToolItem, - OutputBashServerToolItem, + CustomToolCallItem, McpCallItem, - OutputFunctionCallItem, + OutputBashServerToolItem, FunctionCallItem, + OutputFunctionCallItem, + OutputImageGenerationServerToolItem, OutputAdvisorServerToolItem, - OutputWebFetchServerToolItem, - ReasoningItem, OutputCodeInterpreterServerToolItem, InputsReasoning, + ReasoningItem, + OutputSubagentServerToolItem, + OutputWebFetchServerToolItem, ], ) diff --git a/src/openrouter/components/legacy_websearchservertool.py b/src/openrouter/components/legacy_websearchservertool.py index 3b584a9..b014aea 100644 --- a/src/openrouter/components/legacy_websearchservertool.py +++ b/src/openrouter/components/legacy_websearchservertool.py @@ -27,10 +27,10 @@ class LegacyWebSearchServerToolTypedDict(TypedDict): type: LegacyWebSearchServerToolType engine: NotRequired[WebSearchEngineEnum] - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]] @@ -45,12 +45,12 @@ class LegacyWebSearchServerTool(BaseModel): engine: Annotated[ Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) ] = None - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: OptionalNullable[WebSearchDomainFilter] = UNSET max_results: Optional[int] = None - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: Annotated[ Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) diff --git a/src/openrouter/components/messagesfallbackparam.py b/src/openrouter/components/messagesfallbackparam.py new file mode 100644 index 0000000..05b0419 --- /dev/null +++ b/src/openrouter/components/messagesfallbackparam.py @@ -0,0 +1,33 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable +import pydantic +from pydantic import ConfigDict +from typing import Any, Dict +from typing_extensions import TypedDict + + +class MessagesFallbackParamTypedDict(TypedDict): + r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected.""" + + model: str + + +class MessagesFallbackParam(BaseModel): + r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + model: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index fc1f1db..2f93bcf 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -50,6 +50,7 @@ ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouterTypedDict, ) +from .messagesfallbackparam import MessagesFallbackParam, MessagesFallbackParamTypedDict from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict @@ -1046,6 +1047,8 @@ class MessagesRequestTypedDict(TypedDict): cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" context_management: NotRequired[Nullable[ContextManagementTypedDict]] + fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]] + r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" max_tokens: NotRequired[int] metadata: NotRequired[MetadataTypedDict] models: NotRequired[List[str]] @@ -1088,6 +1091,9 @@ class MessagesRequest(BaseModel): context_management: OptionalNullable[ContextManagement] = UNSET + fallbacks: OptionalNullable[List[MessagesFallbackParam]] = UNSET + r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" + max_tokens: Optional[int] = None metadata: Optional[Metadata] = None @@ -1144,6 +1150,7 @@ def serialize_model(self, handler): optional_fields = [ "cache_control", "context_management", + "fallbacks", "max_tokens", "metadata", "models", @@ -1166,7 +1173,13 @@ def serialize_model(self, handler): "trace", "user", ] - nullable_fields = ["context_management", "messages", "provider", "speed"] + nullable_fields = [ + "context_management", + "fallbacks", + "messages", + "provider", + "speed", + ] null_default_fields = [] serialized = handler(self) diff --git a/src/openrouter/components/model.py b/src/openrouter/components/model.py index 53fc430..637b3fb 100644 --- a/src/openrouter/components/model.py +++ b/src/openrouter/components/model.py @@ -3,6 +3,7 @@ from __future__ import annotations from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict +from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modellinks import ModelLinks, ModelLinksTypedDict from .parameter import Parameter from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict @@ -51,6 +52,8 @@ class ModelTypedDict(TypedDict): r"""List of supported voice identifiers for TTS models. Null for non-TTS models.""" top_provider: TopProviderInfoTypedDict r"""Information about the top provider for this model""" + benchmarks: NotRequired[ModelBenchmarksTypedDict] + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" description: NotRequired[str] r"""Description of the model""" expiration_date: NotRequired[Nullable[str]] @@ -105,6 +108,9 @@ class Model(BaseModel): top_provider: TopProviderInfo r"""Information about the top provider for this model""" + benchmarks: Optional[ModelBenchmarks] = None + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + description: Optional[str] = None r"""Description of the model""" @@ -120,6 +126,7 @@ class Model(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ + "benchmarks", "description", "expiration_date", "hugging_face_id", diff --git a/src/openrouter/components/modelbenchmarks.py b/src/openrouter/components/modelbenchmarks.py new file mode 100644 index 0000000..37d57a2 --- /dev/null +++ b/src/openrouter/components/modelbenchmarks.py @@ -0,0 +1,27 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict +from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict +from openrouter.types import BaseModel +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class ModelBenchmarksTypedDict(TypedDict): + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + + design_arena: List[DABenchmarkEntryTypedDict] + r"""Design Arena ELO rankings across arena+category pairs.""" + artificial_analysis: NotRequired[AABenchmarkEntryTypedDict] + r"""Artificial Analysis benchmark index scores.""" + + +class ModelBenchmarks(BaseModel): + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + + design_arena: List[DABenchmarkEntry] + r"""Design Arena ELO rankings across arena+category pairs.""" + + artificial_analysis: Optional[AABenchmarkEntry] = None + r"""Artificial Analysis benchmark index scores.""" diff --git a/src/openrouter/components/modelresponse.py b/src/openrouter/components/modelresponse.py new file mode 100644 index 0000000..567bdc9 --- /dev/null +++ b/src/openrouter/components/modelresponse.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .model import Model, ModelTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ModelResponseTypedDict(TypedDict): + r"""Single model response""" + + data: ModelTypedDict + r"""Information about an AI model available on OpenRouter""" + + +class ModelResponse(BaseModel): + r"""Single model response""" + + data: Model + r"""Information about an AI model available on OpenRouter""" diff --git a/src/openrouter/components/outputitems.py b/src/openrouter/components/outputitems.py index 8eff2c7..a7d056e 100644 --- a/src/openrouter/components/outputitems.py +++ b/src/openrouter/components/outputitems.py @@ -81,6 +81,10 @@ OutputShellCallOutputItem, OutputShellCallOutputItemTypedDict, ) +from .outputsubagentservertoolitem import ( + OutputSubagentServerToolItem, + OutputSubagentServerToolItemTypedDict, +) from .outputtexteditorservertoolitem import ( OutputTextEditorServerToolItem, OutputTextEditorServerToolItemTypedDict, @@ -138,6 +142,7 @@ OutputReasoningItemTypedDict, OutputFusionServerToolItemTypedDict, OutputAdvisorServerToolItemTypedDict, + OutputSubagentServerToolItemTypedDict, ], ) r"""An output item from the response""" @@ -172,6 +177,7 @@ ], Annotated[OutputMcpServerToolItem, Tag("openrouter:mcp")], Annotated[OutputMemoryServerToolItem, Tag("openrouter:memory")], + Annotated[OutputSubagentServerToolItem, Tag("openrouter:subagent")], Annotated[OutputTextEditorServerToolItem, Tag("openrouter:text_editor")], Annotated[OutputToolSearchServerToolItem, Tag("openrouter:tool_search")], Annotated[OutputWebFetchServerToolItem, Tag("openrouter:web_fetch")], diff --git a/src/openrouter/components/outputsubagentservertoolitem.py b/src/openrouter/components/outputsubagentservertoolitem.py new file mode 100644 index 0000000..35e0665 --- /dev/null +++ b/src/openrouter/components/outputsubagentservertoolitem.py @@ -0,0 +1,55 @@ +"""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 + + +OutputSubagentServerToolItemType = Literal["openrouter:subagent",] + + +class OutputSubagentServerToolItemTypedDict(TypedDict): + r"""An openrouter:subagent server tool output item""" + + status: ToolCallStatus + type: OutputSubagentServerToolItemType + error: NotRequired[str] + r"""Error message when the subagent task did not produce an outcome.""" + id: NotRequired[str] + model: NotRequired[str] + r"""Slug of the worker model that executed the task.""" + outcome: NotRequired[str] + r"""The worker model's result (the outcome text returned to the delegating model).""" + task_description: NotRequired[str] + r"""The task description the delegating model sent to the worker.""" + task_name: NotRequired[str] + r"""The short task identifier the delegating model supplied.""" + + +class OutputSubagentServerToolItem(BaseModel): + r"""An openrouter:subagent server tool output item""" + + status: Annotated[ToolCallStatus, PlainValidator(validate_open_enum(False))] + + type: OutputSubagentServerToolItemType + + error: Optional[str] = None + r"""Error message when the subagent task did not produce an outcome.""" + + id: Optional[str] = None + + model: Optional[str] = None + r"""Slug of the worker model that executed the task.""" + + outcome: Optional[str] = None + r"""The worker model's result (the outcome text returned to the delegating model).""" + + task_description: Optional[str] = None + r"""The task description the delegating model sent to the worker.""" + + task_name: Optional[str] = None + r"""The short task identifier the delegating model supplied.""" diff --git a/src/openrouter/components/preview_20250311_websearchservertool.py b/src/openrouter/components/preview_20250311_websearchservertool.py index 2f0cd46..49029cf 100644 --- a/src/openrouter/components/preview_20250311_websearchservertool.py +++ b/src/openrouter/components/preview_20250311_websearchservertool.py @@ -30,10 +30,10 @@ class Preview20250311WebSearchServerToolTypedDict(TypedDict): type: Preview20250311WebSearchServerToolType engine: NotRequired[WebSearchEngineEnum] - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]] @@ -47,12 +47,12 @@ class Preview20250311WebSearchServerTool(BaseModel): engine: Annotated[ Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) ] = None - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: OptionalNullable[WebSearchDomainFilter] = UNSET max_results: Optional[int] = None - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: Annotated[ Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) diff --git a/src/openrouter/components/preview_websearchservertool.py b/src/openrouter/components/preview_websearchservertool.py index 434b214..c0682b3 100644 --- a/src/openrouter/components/preview_websearchservertool.py +++ b/src/openrouter/components/preview_websearchservertool.py @@ -30,10 +30,10 @@ class PreviewWebSearchServerToolTypedDict(TypedDict): type: PreviewWebSearchServerToolType engine: NotRequired[WebSearchEngineEnum] - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]] @@ -47,12 +47,12 @@ class PreviewWebSearchServerTool(BaseModel): engine: Annotated[ Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) ] = None - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: OptionalNullable[WebSearchDomainFilter] = UNSET max_results: Optional[int] = None - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: Annotated[ Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) diff --git a/src/openrouter/components/rankingsdailymeta.py b/src/openrouter/components/rankingsdailymeta.py index df1ae5d..9562915 100644 --- a/src/openrouter/components/rankingsdailymeta.py +++ b/src/openrouter/components/rankingsdailymeta.py @@ -6,7 +6,7 @@ from typing_extensions import TypedDict -Version = Literal["v1",] +RankingsDailyMetaVersion = Literal["v1",] r"""Dataset version. Field names and grain are stable for the life of `v1`.""" @@ -17,7 +17,7 @@ class RankingsDailyMetaTypedDict(TypedDict): r"""Resolved end of the date window (UTC, inclusive).""" start_date: str r"""Resolved start of the date window (UTC, inclusive).""" - version: Version + version: RankingsDailyMetaVersion r"""Dataset version. Field names and grain are stable for the life of `v1`.""" @@ -31,5 +31,5 @@ class RankingsDailyMeta(BaseModel): start_date: str r"""Resolved start of the date window (UTC, inclusive).""" - version: Version + version: RankingsDailyMetaVersion r"""Dataset version. Field names and grain are stable for the life of `v1`.""" diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 6f285c2..8f4b2a3 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -84,6 +84,10 @@ StopServerToolsWhenConditionTypedDict, ) from .storedprompttemplate import StoredPromptTemplate, StoredPromptTemplateTypedDict +from .subagentservertool_openrouter import ( + SubagentServerToolOpenRouter, + SubagentServerToolOpenRouterTypedDict, +) from .textextendedconfig import TextExtendedConfig, TextExtendedConfigTypedDict from .traceconfig import TraceConfig, TraceConfigTypedDict from .webfetchplugin import WebFetchPlugin, WebFetchPluginTypedDict @@ -217,16 +221,17 @@ def serialize_model(self, handler): CodexLocalShellToolTypedDict, ApplyPatchServerToolTypedDict, ShellServerToolTypedDict, + ImageGenerationServerToolOpenRouterTypedDict, ChatSearchModelsServerToolTypedDict, - WebFetchServerToolTypedDict, ShellServerToolOpenRouterTypedDict, BashServerToolTypedDict, CodeInterpreterServerToolTypedDict, ApplyPatchServerToolOpenRouterTypedDict, WebSearchServerToolOpenRouterTypedDict, - ImageGenerationServerToolOpenRouterTypedDict, + WebFetchServerToolTypedDict, FusionServerToolOpenRouterTypedDict, DatetimeServerToolTypedDict, + SubagentServerToolOpenRouterTypedDict, AdvisorServerToolOpenRouterTypedDict, CustomToolTypedDict, ComputerUseServerToolTypedDict, @@ -234,8 +239,8 @@ def serialize_model(self, handler): FileSearchServerToolTypedDict, PreviewWebSearchServerToolTypedDict, Preview20250311WebSearchServerToolTypedDict, - LegacyWebSearchServerToolTypedDict, WebSearchServerToolTypedDict, + LegacyWebSearchServerToolTypedDict, McpServerToolTypedDict, ImageGenerationServerToolTypedDict, ], @@ -261,6 +266,7 @@ def serialize_model(self, handler): Annotated[ApplyPatchServerTool, Tag("apply_patch")], Annotated[CustomTool, Tag("custom")], Annotated[AdvisorServerToolOpenRouter, Tag("openrouter:advisor")], + Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")], Annotated[DatetimeServerTool, Tag("openrouter:datetime")], Annotated[FusionServerToolOpenRouter, Tag("openrouter:fusion")], Annotated[ diff --git a/src/openrouter/components/searchqualitylevel.py b/src/openrouter/components/searchqualitylevel.py index 27deefd..450aea6 100644 --- a/src/openrouter/components/searchqualitylevel.py +++ b/src/openrouter/components/searchqualitylevel.py @@ -13,4 +13,4 @@ ], UnrecognizedStr, ] -r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" +r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" diff --git a/src/openrouter/components/subagentnestedtool.py b/src/openrouter/components/subagentnestedtool.py new file mode 100644 index 0000000..8e1417b --- /dev/null +++ b/src/openrouter/components/subagentnestedtool.py @@ -0,0 +1,36 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable +import pydantic +from pydantic import ConfigDict +from typing import Any, Dict, Optional +from typing_extensions import NotRequired, TypedDict + + +class SubagentNestedToolTypedDict(TypedDict): + r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself.""" + + type: str + parameters: NotRequired[Dict[str, Nullable[Any]]] + + +class SubagentNestedTool(BaseModel): + r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + type: str + + parameters: Optional[Dict[str, Nullable[Any]]] = None + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] diff --git a/src/openrouter/components/subagentreasoning.py b/src/openrouter/components/subagentreasoning.py new file mode 100644 index 0000000..1eb4e86 --- /dev/null +++ b/src/openrouter/components/subagentreasoning.py @@ -0,0 +1,43 @@ +"""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, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +SubagentReasoningEffort = Union[ + Literal[ + "xhigh", + "high", + "medium", + "low", + "minimal", + "none", + ], + UnrecognizedStr, +] +r"""Reasoning effort level for the subagent call.""" + + +class SubagentReasoningTypedDict(TypedDict): + r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking.""" + + effort: NotRequired[SubagentReasoningEffort] + r"""Reasoning effort level for the subagent call.""" + max_tokens: NotRequired[int] + r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call.""" + + +class SubagentReasoning(BaseModel): + r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking.""" + + effort: Annotated[ + Optional[SubagentReasoningEffort], PlainValidator(validate_open_enum(False)) + ] = None + r"""Reasoning effort level for the subagent call.""" + + max_tokens: Optional[int] = None + r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call.""" diff --git a/src/openrouter/components/subagentservertool_openrouter.py b/src/openrouter/components/subagentservertool_openrouter.py new file mode 100644 index 0000000..a33e769 --- /dev/null +++ b/src/openrouter/components/subagentservertool_openrouter.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .subagentservertoolconfig import ( + SubagentServerToolConfig, + SubagentServerToolConfigTypedDict, +) +from openrouter.types import BaseModel +from typing import Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +SubagentServerToolOpenRouterType = Literal["openrouter:subagent",] + + +class SubagentServerToolOpenRouterTypedDict(TypedDict): + r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools.""" + + type: SubagentServerToolOpenRouterType + parameters: NotRequired[SubagentServerToolConfigTypedDict] + r"""Configuration for the openrouter:subagent server tool.""" + + +class SubagentServerToolOpenRouter(BaseModel): + r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools.""" + + type: SubagentServerToolOpenRouterType + + parameters: Optional[SubagentServerToolConfig] = None + r"""Configuration for the openrouter:subagent server tool.""" diff --git a/src/openrouter/components/subagentservertoolconfig.py b/src/openrouter/components/subagentservertoolconfig.py new file mode 100644 index 0000000..27bb1e4 --- /dev/null +++ b/src/openrouter/components/subagentservertoolconfig.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict +from .subagentreasoning import SubagentReasoning, SubagentReasoningTypedDict +from openrouter.types import BaseModel +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class SubagentServerToolConfigTypedDict(TypedDict): + r"""Configuration for the openrouter:subagent server tool.""" + + instructions: NotRequired[str] + r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own.""" + max_completion_tokens: NotRequired[int] + r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies.""" + max_tool_calls: NotRequired[int] + r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call.""" + model: NotRequired[str] + r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model.""" + reasoning: NotRequired[SubagentReasoningTypedDict] + r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking.""" + temperature: NotRequired[float] + r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies.""" + tools: NotRequired[List[SubagentNestedToolTypedDict]] + r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself.""" + + +class SubagentServerToolConfig(BaseModel): + r"""Configuration for the openrouter:subagent server tool.""" + + instructions: Optional[str] = None + r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own.""" + + max_completion_tokens: Optional[int] = None + r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies.""" + + max_tool_calls: Optional[int] = None + r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call.""" + + model: Optional[str] = None + r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model.""" + + reasoning: Optional[SubagentReasoning] = None + r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking.""" + + temperature: Optional[float] = None + r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies.""" + + tools: Optional[List[SubagentNestedTool]] = None + r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself.""" diff --git a/src/openrouter/components/websearchconfig.py b/src/openrouter/components/websearchconfig.py index 6db24ab..5007c57 100644 --- a/src/openrouter/components/websearchconfig.py +++ b/src/openrouter/components/websearchconfig.py @@ -16,40 +16,40 @@ class WebSearchConfigTypedDict(TypedDict): allowed_domains: NotRequired[List[str]] - r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" + r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains.""" engine: NotRequired[WebSearchEngineEnum] - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" excluded_domains: NotRequired[List[str]] - r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" + r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains.""" max_characters: NotRequired[int] - r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" + r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity).""" max_results: NotRequired[int] - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" max_total_results: NotRequired[int] r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" search_context_size: NotRequired[SearchQualityLevel] - r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" + r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] r"""Approximate user location for location-biased results.""" class WebSearchConfig(BaseModel): allowed_domains: Optional[List[str]] = None - r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" + r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains.""" engine: Annotated[ Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) ] = None - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" excluded_domains: Optional[List[str]] = None - r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" + r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains.""" max_characters: Optional[int] = None - r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" + r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity).""" max_results: Optional[int] = None - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" max_total_results: Optional[int] = None r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" @@ -57,7 +57,7 @@ class WebSearchConfig(BaseModel): search_context_size: Annotated[ Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False)) ] = None - r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" + r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: Optional[WebSearchUserLocationServerTool] = None r"""Approximate user location for location-biased results.""" diff --git a/src/openrouter/components/websearchengine.py b/src/openrouter/components/websearchengine.py index 992db72..5d67b4f 100644 --- a/src/openrouter/components/websearchengine.py +++ b/src/openrouter/components/websearchengine.py @@ -11,6 +11,7 @@ "exa", "firecrawl", "parallel", + "perplexity", ], UnrecognizedStr, ] diff --git a/src/openrouter/components/websearchengineenum.py b/src/openrouter/components/websearchengineenum.py index 90a22b9..aba36c1 100644 --- a/src/openrouter/components/websearchengineenum.py +++ b/src/openrouter/components/websearchengineenum.py @@ -7,12 +7,13 @@ WebSearchEngineEnum = Union[ Literal[ - "auto", "native", "exa", "parallel", "firecrawl", + "perplexity", + "auto", ], UnrecognizedStr, ] -r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" +r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" diff --git a/src/openrouter/components/websearchservertool.py b/src/openrouter/components/websearchservertool.py index 363a4ea..4905809 100644 --- a/src/openrouter/components/websearchservertool.py +++ b/src/openrouter/components/websearchservertool.py @@ -27,10 +27,10 @@ class WebSearchServerToolTypedDict(TypedDict): type: WebSearchServerToolType engine: NotRequired[WebSearchEngineEnum] - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]] @@ -45,12 +45,12 @@ class WebSearchServerTool(BaseModel): engine: Annotated[ Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) ] = None - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" filters: OptionalNullable[WebSearchDomainFilter] = UNSET max_results: Optional[int] = None - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" search_context_size: Annotated[ Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False)) diff --git a/src/openrouter/components/websearchservertoolconfig.py b/src/openrouter/components/websearchservertoolconfig.py index e5aeae2..5ca754c 100644 --- a/src/openrouter/components/websearchservertoolconfig.py +++ b/src/openrouter/components/websearchservertoolconfig.py @@ -18,19 +18,19 @@ class WebSearchServerToolConfigTypedDict(TypedDict): r"""Configuration for the openrouter:web_search server tool""" allowed_domains: NotRequired[List[str]] - r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" + r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains.""" engine: NotRequired[WebSearchEngineEnum] - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" excluded_domains: NotRequired[List[str]] - r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" + r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains.""" max_characters: NotRequired[int] - r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" + r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity).""" max_results: NotRequired[int] - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" max_total_results: NotRequired[int] r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" search_context_size: NotRequired[SearchQualityLevel] - r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" + r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] r"""Approximate user location for location-biased results.""" @@ -39,21 +39,21 @@ class WebSearchServerToolConfig(BaseModel): r"""Configuration for the openrouter:web_search server tool""" allowed_domains: Optional[List[str]] = None - r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains.""" + r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains.""" engine: Annotated[ Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False)) ] = None - r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API.""" + r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results).""" excluded_domains: Optional[List[str]] = None - r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains.""" + r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains.""" max_characters: Optional[int] = None - r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel).""" + r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity).""" max_results: Optional[int] = None - r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.""" + r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search.""" max_total_results: Optional[int] = None r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" @@ -61,7 +61,7 @@ class WebSearchServerToolConfig(BaseModel): search_context_size: Annotated[ Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False)) ] = None - r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set.""" + r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: Optional[WebSearchUserLocationServerTool] = None r"""Approximate user location for location-biased results.""" diff --git a/src/openrouter/datasets.py b/src/openrouter/datasets.py index c483912..c80a941 100644 --- a/src/openrouter/datasets.py +++ b/src/openrouter/datasets.py @@ -426,6 +426,542 @@ async def empty_result(): raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + def get_benchmarks_artificial_analysis( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + max_results: Optional[int] = 50, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BenchmarksAAResponse: + r"""Artificial Analysis Benchmark Indices + + Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + + :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 max_results: Max results to return (1–100, default 50). + :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.GetBenchmarksArtificialAnalysisRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + max_results=max_results, + ) + + req = self._build_request( + method="GET", + path="/datasets/benchmarks/artificial-analysis", + 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.GetBenchmarksArtificialAnalysisGlobals( + 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="getBenchmarksArtificialAnalysis", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "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.BenchmarksAAResponse, 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, "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, "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_benchmarks_artificial_analysis_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + max_results: Optional[int] = 50, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BenchmarksAAResponse: + r"""Artificial Analysis Benchmark Indices + + Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + + :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 max_results: Max results to return (1–100, default 50). + :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.GetBenchmarksArtificialAnalysisRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + max_results=max_results, + ) + + req = self._build_request_async( + method="GET", + path="/datasets/benchmarks/artificial-analysis", + 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.GetBenchmarksArtificialAnalysisGlobals( + 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="getBenchmarksArtificialAnalysis", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "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.BenchmarksAAResponse, 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, "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, "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_benchmarks_design_arena( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + arena: Optional[operations.Arena] = "models", + category: Optional[str] = None, + max_results: Optional[int] = 50, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BenchmarksDAResponse: + r"""Design Arena Benchmark Rankings + + Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + + :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 arena: Arena to query. Defaults to `models`. + :param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories. + :param max_results: Max results to return: per category when no category filter is applied (1–100, default 50). + :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.GetBenchmarksDesignArenaRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + arena=arena, + category=category, + max_results=max_results, + ) + + req = self._build_request( + method="GET", + path="/datasets/benchmarks/design-arena", + 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.GetBenchmarksDesignArenaGlobals( + 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="getBenchmarksDesignArena", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "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.BenchmarksDAResponse, 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, "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, "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_benchmarks_design_arena_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + arena: Optional[operations.Arena] = "models", + category: Optional[str] = None, + max_results: Optional[int] = 50, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.BenchmarksDAResponse: + r"""Design Arena Benchmark Rankings + + Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + + :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 arena: Arena to query. Defaults to `models`. + :param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories. + :param max_results: Max results to return: per category when no category filter is applied (1–100, default 50). + :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.GetBenchmarksDesignArenaRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + arena=arena, + category=category, + max_results=max_results, + ) + + req = self._build_request_async( + method="GET", + path="/datasets/benchmarks/design-arena", + 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.GetBenchmarksDesignArenaGlobals( + 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="getBenchmarksDesignArena", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "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.BenchmarksDAResponse, 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, "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, "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_rankings_daily( self, *, diff --git a/src/openrouter/files.py b/src/openrouter/files.py new file mode 100644 index 0000000..6af040b --- /dev/null +++ b/src/openrouter/files.py @@ -0,0 +1,1498 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +import httpx +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 Files(BaseSDK): + r"""Files endpoints""" + + def list( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + limit: Optional[int] = None, + cursor: Optional[str] = None, + workspace_id: 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, + ) -> Optional[operations.ListFilesResponse]: + r"""List files + + Lists files belonging to the workspace of the authenticating API key. + + :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 limit: Maximum number of files to return (1–1000). + :param cursor: Opaque pagination cursor from a previous response. + :param workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.ListFilesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + cursor=cursor, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/files", + 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.ListFilesGlobals( + 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="listFiles", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + def next_func() -> Optional[operations.ListFilesResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + next_cursor = JSONPath("$.cursor").parse(body) + + if len(next_cursor) == 0: + return None + + next_cursor = next_cursor[0] + if next_cursor is None or str(next_cursor).strip() == "": + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + + return self.list( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + cursor=next_cursor, + workspace_id=workspace_id, + retries=retries, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListFilesResponse( + result=unmarshal_json_response(components.FileListResponse, http_res), + next=next_func, + ) + 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, "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, "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, + limit: Optional[int] = None, + cursor: Optional[str] = None, + workspace_id: 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, + ) -> Optional[operations.ListFilesResponse]: + r"""List files + + Lists files belonging to the workspace of the authenticating API key. + + :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 limit: Maximum number of files to return (1–1000). + :param cursor: Opaque pagination cursor from a previous response. + :param workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.ListFilesRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + cursor=cursor, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/files", + 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.ListFilesGlobals( + 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="listFiles", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + def next_func() -> Awaitable[Optional[operations.ListFilesResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + next_cursor = JSONPath("$.cursor").parse(body) + + if len(next_cursor) == 0: + return empty_result() + + next_cursor = next_cursor[0] + if next_cursor is None or str(next_cursor).strip() == "": + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + + return self.list_async( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + limit=limit, + cursor=next_cursor, + workspace_id=workspace_id, + retries=retries, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.ListFilesResponse( + result=unmarshal_json_response(components.FileListResponse, http_res), + next=next_func, + ) + 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, "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, "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 upload( + self, + *, + file: Union[operations.File, operations.FileTypedDict], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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.FileMetadata: + r"""Upload a file + + Uploads a file to be referenced in future API calls. The file is stored under the workspace of the authenticating API key. Maximum file size: 100 MB. + + :param file: + :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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.UploadFileRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + workspace_id=workspace_id, + request_body=operations.UploadFileRequestBody( + file=utils.get_pydantic_model(file, operations.File), + ), + ) + + req = self._build_request( + method="POST", + path="/files", + 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.UploadFileGlobals( + 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, + "multipart", + operations.UploadFileRequestBody, + ), + 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="uploadFile", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "413", "429", "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.FileMetadata, 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, "413", "application/json"): + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res + ) + raise errors.PayloadTooLargeResponseError(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, "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 upload_async( + self, + *, + file: Union[operations.File, operations.FileTypedDict], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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.FileMetadata: + r"""Upload a file + + Uploads a file to be referenced in future API calls. The file is stored under the workspace of the authenticating API key. Maximum file size: 100 MB. + + :param file: + :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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.UploadFileRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + workspace_id=workspace_id, + request_body=operations.UploadFileRequestBody( + file=utils.get_pydantic_model(file, operations.File), + ), + ) + + req = self._build_request_async( + method="POST", + path="/files", + 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.UploadFileGlobals( + 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, + "multipart", + operations.UploadFileRequestBody, + ), + 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="uploadFile", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "403", "413", "429", "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.FileMetadata, 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, "413", "application/json"): + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res + ) + raise errors.PayloadTooLargeResponseError(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, "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, + *, + file_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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.FileDeleteResponse: + r"""Delete a file + + Deletes a file owned by the requesting workspace. Deletion is irreversible. + + :param file_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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.DeleteFileRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + file_id=file_id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="DELETE", + path="/files/{file_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.DeleteFileGlobals( + 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="deleteFile", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "404", "429", "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.FileDeleteResponse, 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, "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, "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, + *, + file_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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.FileDeleteResponse: + r"""Delete a file + + Deletes a file owned by the requesting workspace. Deletion is irreversible. + + :param file_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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.DeleteFileRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + file_id=file_id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="DELETE", + path="/files/{file_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.DeleteFileGlobals( + 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="deleteFile", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "404", "429", "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.FileDeleteResponse, 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, "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, "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 retrieve( + self, + *, + file_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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.FileMetadata: + r"""Get file metadata + + Retrieves metadata for a single file owned by the requesting workspace. + + :param file_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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.GetFileMetadataRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + file_id=file_id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/files/{file_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.GetFileMetadataGlobals( + 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="getFileMetadata", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "404", "429", "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.FileMetadata, 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, "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, "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 retrieve_async( + self, + *, + file_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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.FileMetadata: + r"""Get file metadata + + Retrieves metadata for a single file owned by the requesting workspace. + + :param file_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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.GetFileMetadataRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + file_id=file_id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/files/{file_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.GetFileMetadataGlobals( + 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="getFileMetadata", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["401", "404", "429", "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.FileMetadata, 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, "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, "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 download( + self, + *, + file_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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, + ) -> httpx.Response: + r"""Download file content + + Downloads the raw bytes of a file. Only files created server-side are downloadable; uploaded files return 400. + + :param file_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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.DownloadFileContentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + file_id=file_id, + workspace_id=workspace_id, + ) + + req = self._build_request( + method="GET", + path="/files/{file_id}/content", + 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/octet-stream", + http_headers=http_headers, + _globals=operations.DownloadFileContentGlobals( + 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="downloadFileContent", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "404", "429", "4XX", "500", "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, "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, "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 download_async( + self, + *, + file_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + workspace_id: 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, + ) -> httpx.Response: + r"""Download file content + + Downloads the raw bytes of a file. Only files created server-side are downloadable; uploaded files return 400. + + :param file_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 workspace_id: Workspace to scope the request to. Defaults to the caller’s default workspace. + :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.DownloadFileContentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + file_id=file_id, + workspace_id=workspace_id, + ) + + req = self._build_request_async( + method="GET", + path="/files/{file_id}/content", + 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/octet-stream", + http_headers=http_headers, + _globals=operations.DownloadFileContentGlobals( + 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="downloadFileContent", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["400", "401", "404", "429", "4XX", "500", "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, "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, "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/models_.py b/src/openrouter/models_.py index b1f9143..7313311 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -12,6 +12,254 @@ class Models(BaseSDK): r"""Model information endpoints""" + def get( + self, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelResponse: + r"""Get a model by its slug + + Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + + :param author: The author/organization of the model + :param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + :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.GetModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request( + method="GET", + path="/model/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModelGlobals( + 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="getModel", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["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.ModelResponse, 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, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelResponse: + r"""Get a model by its slug + + Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + + :param author: The author/organization of the model + :param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + :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.GetModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request_async( + method="GET", + path="/model/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModelGlobals( + 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="getModel", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["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.ModelResponse, 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 list( self, *, @@ -22,6 +270,17 @@ def list( supported_parameters: Optional[str] = None, output_modalities: Optional[str] = None, sort: Optional[operations.GetModelsSort] = None, + q: Optional[str] = None, + input_modalities: Optional[str] = None, + context: Optional[int] = None, + min_price: OptionalNullable[float] = UNSET, + max_price: OptionalNullable[float] = UNSET, + arch: Optional[str] = None, + model_authors: Optional[str] = None, + providers: Optional[str] = None, + distillable: Optional[operations.Distillable] = None, + zdr: Optional[operations.Zdr] = None, + region: Optional[operations.Region] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -40,6 +299,17 @@ def list( :param supported_parameters: Filter models by supported parameter (comma-separated) :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. + :param q: Free-text search by model name or slug. + :param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file. + :param context: Minimum context length (tokens). Models with smaller context are excluded. + :param min_price: Minimum prompt price in $/M tokens. + :param max_price: Maximum prompt price in $/M tokens. + :param arch: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). + :param model_authors: Filter models by the organization that created the model. Comma-separated list of author slugs. + :param providers: Filter models by hosting provider. Comma-separated list of provider names. + :param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them. + :param zdr: When set to \"true\", return only models with zero data retention endpoints. + :param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported. :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 @@ -63,6 +333,17 @@ def list( supported_parameters=supported_parameters, output_modalities=output_modalities, sort=sort, + q=q, + input_modalities=input_modalities, + context=context, + min_price=min_price, + max_price=max_price, + arch=arch, + model_authors=model_authors, + providers=providers, + distillable=distillable, + zdr=zdr, + region=region, ) req = self._build_request( @@ -150,6 +431,17 @@ async def list_async( supported_parameters: Optional[str] = None, output_modalities: Optional[str] = None, sort: Optional[operations.GetModelsSort] = None, + q: Optional[str] = None, + input_modalities: Optional[str] = None, + context: Optional[int] = None, + min_price: OptionalNullable[float] = UNSET, + max_price: OptionalNullable[float] = UNSET, + arch: Optional[str] = None, + model_authors: Optional[str] = None, + providers: Optional[str] = None, + distillable: Optional[operations.Distillable] = None, + zdr: Optional[operations.Zdr] = None, + region: Optional[operations.Region] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -168,6 +460,17 @@ async def list_async( :param supported_parameters: Filter models by supported parameter (comma-separated) :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved. + :param q: Free-text search by model name or slug. + :param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file. + :param context: Minimum context length (tokens). Models with smaller context are excluded. + :param min_price: Minimum prompt price in $/M tokens. + :param max_price: Maximum prompt price in $/M tokens. + :param arch: Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). + :param model_authors: Filter models by the organization that created the model. Comma-separated list of author slugs. + :param providers: Filter models by hosting provider. Comma-separated list of provider names. + :param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them. + :param zdr: When set to \"true\", return only models with zero data retention endpoints. + :param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported. :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 @@ -191,6 +494,17 @@ async def list_async( supported_parameters=supported_parameters, output_modalities=output_modalities, sort=sort, + q=q, + input_modalities=input_modalities, + context=context, + min_price=min_price, + max_price=max_price, + arch=arch, + model_authors=model_authors, + providers=providers, + distillable=distillable, + zdr=zdr, + region=region, ) req = self._build_request_async( diff --git a/src/openrouter/oauth.py b/src/openrouter/oauth.py index ef6eb9a..185de12 100644 --- a/src/openrouter/oauth.py +++ b/src/openrouter/oauth.py @@ -318,6 +318,7 @@ def create_auth_code( key_label: Optional[str] = None, limit: Optional[float] = None, usage_limit_type: Optional[operations.UsageLimitType] = None, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -327,7 +328,7 @@ def create_auth_code( Create an authorization code for the PKCE flow to generate a user-controlled API key - :param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + :param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. :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. @@ -341,6 +342,7 @@ def create_auth_code( :param key_label: Optional custom label for the API key. Defaults to the app name if not provided. :param limit: Credit limit for the API key to be created :param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval. + :param workspace_id: Optional workspace ID to associate the API key with :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 @@ -368,6 +370,7 @@ def create_auth_code( key_label=key_label, limit=limit, usage_limit_type=usage_limit_type, + workspace_id=workspace_id, ), ) @@ -423,7 +426,7 @@ def create_auth_code( ), ), request=req, - error_status_codes=["400", "401", "409", "4XX", "500", "5XX"], + error_status_codes=["400", "401", "403", "409", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -442,6 +445,11 @@ def create_auth_code( 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, "409", "application/json"): response_data = unmarshal_json_response( errors.ConflictResponseErrorData, http_res @@ -480,6 +488,7 @@ async def create_auth_code_async( key_label: Optional[str] = None, limit: Optional[float] = None, usage_limit_type: Optional[operations.UsageLimitType] = None, + workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -489,7 +498,7 @@ async def create_auth_code_async( Create an authorization code for the PKCE flow to generate a user-controlled API key - :param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + :param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. :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. @@ -503,6 +512,7 @@ async def create_auth_code_async( :param key_label: Optional custom label for the API key. Defaults to the app name if not provided. :param limit: Credit limit for the API key to be created :param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval. + :param workspace_id: Optional workspace ID to associate the API key with :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 @@ -530,6 +540,7 @@ async def create_auth_code_async( key_label=key_label, limit=limit, usage_limit_type=usage_limit_type, + workspace_id=workspace_id, ), ) @@ -585,7 +596,7 @@ async def create_auth_code_async( ), ), request=req, - error_status_codes=["400", "401", "409", "4XX", "500", "5XX"], + error_status_codes=["400", "401", "403", "409", "4XX", "500", "5XX"], retry_config=retry_config, ) @@ -604,6 +615,11 @@ async def create_auth_code_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, "409", "application/json"): response_data = unmarshal_json_response( errors.ConflictResponseErrorData, http_res diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 7c6acb8..8013fe6 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -202,6 +202,12 @@ DeleteBYOKKeyRequest, DeleteBYOKKeyRequestTypedDict, ) + from .deletefile import ( + DeleteFileGlobals, + DeleteFileGlobalsTypedDict, + DeleteFileRequest, + DeleteFileRequestTypedDict, + ) from .deleteguardrail import ( DeleteGuardrailGlobals, DeleteGuardrailGlobalsTypedDict, @@ -228,6 +234,12 @@ DeleteWorkspaceRequest, DeleteWorkspaceRequestTypedDict, ) + from .downloadfilecontent import ( + DownloadFileContentGlobals, + DownloadFileContentGlobalsTypedDict, + DownloadFileContentRequest, + DownloadFileContentRequestTypedDict, + ) from .exchangeauthcodeforapikey import ( ExchangeAuthCodeForAPIKeyCodeChallengeMethod, ExchangeAuthCodeForAPIKeyGlobals, @@ -272,6 +284,19 @@ GetAppRankingsSort, Subcategory, ) + from .getbenchmarksartificialanalysis import ( + GetBenchmarksArtificialAnalysisGlobals, + GetBenchmarksArtificialAnalysisGlobalsTypedDict, + GetBenchmarksArtificialAnalysisRequest, + GetBenchmarksArtificialAnalysisRequestTypedDict, + ) + from .getbenchmarksdesignarena import ( + Arena, + GetBenchmarksDesignArenaGlobals, + GetBenchmarksDesignArenaGlobalsTypedDict, + GetBenchmarksDesignArenaRequest, + GetBenchmarksDesignArenaRequestTypedDict, + ) from .getbyokkey import ( GetBYOKKeyGlobals, GetBYOKKeyGlobalsTypedDict, @@ -300,6 +325,12 @@ RateLimit, RateLimitTypedDict, ) + from .getfilemetadata import ( + GetFileMetadataGlobals, + GetFileMetadataGlobalsTypedDict, + GetFileMetadataRequest, + GetFileMetadataRequestTypedDict, + ) from .getgeneration import ( GetGenerationGlobals, GetGenerationGlobalsTypedDict, @@ -322,13 +353,22 @@ GetKeyResponse, GetKeyResponseTypedDict, ) + from .getmodel import ( + GetModelGlobals, + GetModelGlobalsTypedDict, + GetModelRequest, + GetModelRequestTypedDict, + ) from .getmodels import ( + Distillable, GetModelsCategory, GetModelsGlobals, GetModelsGlobalsTypedDict, GetModelsRequest, GetModelsRequestTypedDict, GetModelsSort, + Region, + Zdr, ) from .getobservabilitydestination import ( GetObservabilityDestinationGlobals, @@ -413,6 +453,14 @@ ListEndpointsZdrResponse, ListEndpointsZdrResponseTypedDict, ) + from .listfiles import ( + ListFilesGlobals, + ListFilesGlobalsTypedDict, + ListFilesRequest, + ListFilesRequestTypedDict, + ListFilesResponse, + ListFilesResponseTypedDict, + ) from .listgenerationcontent import ( ListGenerationContentGlobals, ListGenerationContentGlobalsTypedDict, @@ -614,8 +662,19 @@ UpdateWorkspaceRequest, UpdateWorkspaceRequestTypedDict, ) + from .uploadfile import ( + File, + FileTypedDict, + UploadFileGlobals, + UploadFileGlobalsTypedDict, + UploadFileRequest, + UploadFileRequestBody, + UploadFileRequestBodyTypedDict, + UploadFileRequestTypedDict, + ) __all__ = [ + "Arena", "BulkAddWorkspaceMembersGlobals", "BulkAddWorkspaceMembersGlobalsTypedDict", "BulkAddWorkspaceMembersRequest", @@ -745,6 +804,10 @@ "DeleteBYOKKeyGlobalsTypedDict", "DeleteBYOKKeyRequest", "DeleteBYOKKeyRequestTypedDict", + "DeleteFileGlobals", + "DeleteFileGlobalsTypedDict", + "DeleteFileRequest", + "DeleteFileRequestTypedDict", "DeleteGuardrailGlobals", "DeleteGuardrailGlobalsTypedDict", "DeleteGuardrailRequest", @@ -767,12 +830,17 @@ "DimensionTypedDict", "Direction", "DisplayFormat", + "Distillable", "Document", "DocumentRequest", "DocumentRequestTypedDict", "DocumentResponse", "DocumentResponseTypedDict", "DocumentTypedDict", + "DownloadFileContentGlobals", + "DownloadFileContentGlobalsTypedDict", + "DownloadFileContentRequest", + "DownloadFileContentRequestTypedDict", "Embedding", "EmbeddingTypedDict", "EncodingFormat", @@ -785,6 +853,8 @@ "ExchangeAuthCodeForAPIKeyRequestTypedDict", "ExchangeAuthCodeForAPIKeyResponse", "ExchangeAuthCodeForAPIKeyResponseTypedDict", + "File", + "FileTypedDict", "Filter", "FilterTypedDict", "GetAnalyticsMetaData", @@ -807,6 +877,14 @@ "GetBYOKKeyGlobalsTypedDict", "GetBYOKKeyRequest", "GetBYOKKeyRequestTypedDict", + "GetBenchmarksArtificialAnalysisGlobals", + "GetBenchmarksArtificialAnalysisGlobalsTypedDict", + "GetBenchmarksArtificialAnalysisRequest", + "GetBenchmarksArtificialAnalysisRequestTypedDict", + "GetBenchmarksDesignArenaGlobals", + "GetBenchmarksDesignArenaGlobalsTypedDict", + "GetBenchmarksDesignArenaRequest", + "GetBenchmarksDesignArenaRequestTypedDict", "GetCreditsData", "GetCreditsDataTypedDict", "GetCreditsGlobals", @@ -823,6 +901,10 @@ "GetCurrentKeyRequestTypedDict", "GetCurrentKeyResponse", "GetCurrentKeyResponseTypedDict", + "GetFileMetadataGlobals", + "GetFileMetadataGlobalsTypedDict", + "GetFileMetadataRequest", + "GetFileMetadataRequestTypedDict", "GetGenerationGlobals", "GetGenerationGlobalsTypedDict", "GetGenerationRequest", @@ -839,6 +921,10 @@ "GetKeyRequestTypedDict", "GetKeyResponse", "GetKeyResponseTypedDict", + "GetModelGlobals", + "GetModelGlobalsTypedDict", + "GetModelRequest", + "GetModelRequestTypedDict", "GetModelsCategory", "GetModelsGlobals", "GetModelsGlobalsTypedDict", @@ -907,6 +993,12 @@ "ListEndpointsZdrRequestTypedDict", "ListEndpointsZdrResponse", "ListEndpointsZdrResponseTypedDict", + "ListFilesGlobals", + "ListFilesGlobalsTypedDict", + "ListFilesRequest", + "ListFilesRequestTypedDict", + "ListFilesResponse", + "ListFilesResponseTypedDict", "ListGenerationContentGlobals", "ListGenerationContentGlobalsTypedDict", "ListGenerationContentRequest", @@ -1035,6 +1127,7 @@ "QueryAnalyticsResponseTypedDict", "RateLimit", "RateLimitTypedDict", + "Region", "Result", "ResultTypedDict", "Role", @@ -1076,12 +1169,19 @@ "UpdateWorkspaceGlobalsTypedDict", "UpdateWorkspaceRequest", "UpdateWorkspaceRequestTypedDict", + "UploadFileGlobals", + "UploadFileGlobalsTypedDict", + "UploadFileRequest", + "UploadFileRequestBody", + "UploadFileRequestBodyTypedDict", + "UploadFileRequestTypedDict", "UsageLimitType", "Value1", "Value1TypedDict", "Value2", "Value2TypedDict", "ValueType", + "Zdr", ] _dynamic_imports: dict[str, str] = { @@ -1237,6 +1337,10 @@ "DeleteBYOKKeyGlobalsTypedDict": ".deletebyokkey", "DeleteBYOKKeyRequest": ".deletebyokkey", "DeleteBYOKKeyRequestTypedDict": ".deletebyokkey", + "DeleteFileGlobals": ".deletefile", + "DeleteFileGlobalsTypedDict": ".deletefile", + "DeleteFileRequest": ".deletefile", + "DeleteFileRequestTypedDict": ".deletefile", "DeleteGuardrailGlobals": ".deleteguardrail", "DeleteGuardrailGlobalsTypedDict": ".deleteguardrail", "DeleteGuardrailRequest": ".deleteguardrail", @@ -1255,6 +1359,10 @@ "DeleteWorkspaceGlobalsTypedDict": ".deleteworkspace", "DeleteWorkspaceRequest": ".deleteworkspace", "DeleteWorkspaceRequestTypedDict": ".deleteworkspace", + "DownloadFileContentGlobals": ".downloadfilecontent", + "DownloadFileContentGlobalsTypedDict": ".downloadfilecontent", + "DownloadFileContentRequest": ".downloadfilecontent", + "DownloadFileContentRequestTypedDict": ".downloadfilecontent", "ExchangeAuthCodeForAPIKeyCodeChallengeMethod": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyGlobals": ".exchangeauthcodeforapikey", "ExchangeAuthCodeForAPIKeyGlobalsTypedDict": ".exchangeauthcodeforapikey", @@ -1293,6 +1401,15 @@ "GetAppRankingsResponseTypedDict": ".getapprankings", "GetAppRankingsSort": ".getapprankings", "Subcategory": ".getapprankings", + "GetBenchmarksArtificialAnalysisGlobals": ".getbenchmarksartificialanalysis", + "GetBenchmarksArtificialAnalysisGlobalsTypedDict": ".getbenchmarksartificialanalysis", + "GetBenchmarksArtificialAnalysisRequest": ".getbenchmarksartificialanalysis", + "GetBenchmarksArtificialAnalysisRequestTypedDict": ".getbenchmarksartificialanalysis", + "Arena": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaGlobals": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaGlobalsTypedDict": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaRequest": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaRequestTypedDict": ".getbenchmarksdesignarena", "GetBYOKKeyGlobals": ".getbyokkey", "GetBYOKKeyGlobalsTypedDict": ".getbyokkey", "GetBYOKKeyRequest": ".getbyokkey", @@ -1315,6 +1432,10 @@ "GetCurrentKeyResponseTypedDict": ".getcurrentkey", "RateLimit": ".getcurrentkey", "RateLimitTypedDict": ".getcurrentkey", + "GetFileMetadataGlobals": ".getfilemetadata", + "GetFileMetadataGlobalsTypedDict": ".getfilemetadata", + "GetFileMetadataRequest": ".getfilemetadata", + "GetFileMetadataRequestTypedDict": ".getfilemetadata", "GetGenerationGlobals": ".getgeneration", "GetGenerationGlobalsTypedDict": ".getgeneration", "GetGenerationRequest": ".getgeneration", @@ -1331,12 +1452,19 @@ "GetKeyRequestTypedDict": ".getkey", "GetKeyResponse": ".getkey", "GetKeyResponseTypedDict": ".getkey", + "GetModelGlobals": ".getmodel", + "GetModelGlobalsTypedDict": ".getmodel", + "GetModelRequest": ".getmodel", + "GetModelRequestTypedDict": ".getmodel", + "Distillable": ".getmodels", "GetModelsCategory": ".getmodels", "GetModelsGlobals": ".getmodels", "GetModelsGlobalsTypedDict": ".getmodels", "GetModelsRequest": ".getmodels", "GetModelsRequestTypedDict": ".getmodels", "GetModelsSort": ".getmodels", + "Region": ".getmodels", + "Zdr": ".getmodels", "GetObservabilityDestinationGlobals": ".getobservabilitydestination", "GetObservabilityDestinationGlobalsTypedDict": ".getobservabilitydestination", "GetObservabilityDestinationRequest": ".getobservabilitydestination", @@ -1396,6 +1524,12 @@ "ListEndpointsZdrRequestTypedDict": ".listendpointszdr", "ListEndpointsZdrResponse": ".listendpointszdr", "ListEndpointsZdrResponseTypedDict": ".listendpointszdr", + "ListFilesGlobals": ".listfiles", + "ListFilesGlobalsTypedDict": ".listfiles", + "ListFilesRequest": ".listfiles", + "ListFilesRequestTypedDict": ".listfiles", + "ListFilesResponse": ".listfiles", + "ListFilesResponseTypedDict": ".listfiles", "ListGenerationContentGlobals": ".listgenerationcontent", "ListGenerationContentGlobalsTypedDict": ".listgenerationcontent", "ListGenerationContentRequest": ".listgenerationcontent", @@ -1551,6 +1685,14 @@ "UpdateWorkspaceGlobalsTypedDict": ".updateworkspace", "UpdateWorkspaceRequest": ".updateworkspace", "UpdateWorkspaceRequestTypedDict": ".updateworkspace", + "File": ".uploadfile", + "FileTypedDict": ".uploadfile", + "UploadFileGlobals": ".uploadfile", + "UploadFileGlobalsTypedDict": ".uploadfile", + "UploadFileRequest": ".uploadfile", + "UploadFileRequestBody": ".uploadfile", + "UploadFileRequestBodyTypedDict": ".uploadfile", + "UploadFileRequestTypedDict": ".uploadfile", } diff --git a/src/openrouter/operations/createauthkeyscode.py b/src/openrouter/operations/createauthkeyscode.py index d3ef6c4..344b269 100644 --- a/src/openrouter/operations/createauthkeyscode.py +++ b/src/openrouter/operations/createauthkeyscode.py @@ -92,7 +92,7 @@ class CreateAuthKeysCodeGlobals(BaseModel): class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): callback_url: str - r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" + r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.""" code_challenge: NotRequired[str] r"""PKCE code challenge for enhanced security""" code_challenge_method: NotRequired[CreateAuthKeysCodeCodeChallengeMethod] @@ -105,11 +105,13 @@ class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): r"""Credit limit for the API key to be created""" usage_limit_type: NotRequired[UsageLimitType] r"""Optional credit limit reset interval. When set, the credit limit resets on this interval.""" + workspace_id: NotRequired[str] + r"""Optional workspace ID to associate the API key with""" class CreateAuthKeysCodeRequestBody(BaseModel): callback_url: str - r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" + r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.""" code_challenge: Optional[str] = None r"""PKCE code challenge for enhanced security""" @@ -134,6 +136,9 @@ class CreateAuthKeysCodeRequestBody(BaseModel): ] = None r"""Optional credit limit reset interval. When set, the credit limit resets on this interval.""" + workspace_id: Optional[str] = None + r"""Optional workspace ID to associate the API key with""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -143,6 +148,7 @@ def serialize_model(self, handler): "key_label", "limit", "usage_limit_type", + "workspace_id", ] nullable_fields = ["expires_at"] null_default_fields = [] diff --git a/src/openrouter/operations/deletefile.py b/src/openrouter/operations/deletefile.py new file mode 100644 index 0000000..961175c --- /dev/null +++ b/src/openrouter/operations/deletefile.py @@ -0,0 +1,118 @@ +"""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, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteFileGlobalsTypedDict(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 DeleteFileGlobals(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 DeleteFileRequestTypedDict(TypedDict): + file_id: str + 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. + + """ + workspace_id: NotRequired[str] + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" + + +class DeleteFileRequest(BaseModel): + file_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + 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. + + """ + + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" diff --git a/src/openrouter/operations/downloadfilecontent.py b/src/openrouter/operations/downloadfilecontent.py new file mode 100644 index 0000000..3d4be3f --- /dev/null +++ b/src/openrouter/operations/downloadfilecontent.py @@ -0,0 +1,118 @@ +"""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, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DownloadFileContentGlobalsTypedDict(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 DownloadFileContentGlobals(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 DownloadFileContentRequestTypedDict(TypedDict): + file_id: str + 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. + + """ + workspace_id: NotRequired[str] + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" + + +class DownloadFileContentRequest(BaseModel): + file_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + 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. + + """ + + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" diff --git a/src/openrouter/operations/getbenchmarksartificialanalysis.py b/src/openrouter/operations/getbenchmarksartificialanalysis.py new file mode 100644 index 0000000..707ed91 --- /dev/null +++ b/src/openrouter/operations/getbenchmarksartificialanalysis.py @@ -0,0 +1,108 @@ +"""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 GetBenchmarksArtificialAnalysisGlobalsTypedDict(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 GetBenchmarksArtificialAnalysisGlobals(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 GetBenchmarksArtificialAnalysisRequestTypedDict(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. + + """ + max_results: NotRequired[int] + r"""Max results to return (1–100, default 50).""" + + +class GetBenchmarksArtificialAnalysisRequest(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. + + """ + + max_results: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 50 + r"""Max results to return (1–100, default 50).""" diff --git a/src/openrouter/operations/getbenchmarksdesignarena.py b/src/openrouter/operations/getbenchmarksdesignarena.py new file mode 100644 index 0000000..2ac2aed --- /dev/null +++ b/src/openrouter/operations/getbenchmarksdesignarena.py @@ -0,0 +1,141 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + QueryParamMetadata, + validate_open_enum, +) +import pydantic +from pydantic.functional_validators import PlainValidator +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetBenchmarksDesignArenaGlobalsTypedDict(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 GetBenchmarksDesignArenaGlobals(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. + + """ + + +Arena = Union[ + Literal[ + "models", + "builders", + "agents", + ], + UnrecognizedStr, +] +r"""Arena to query. Defaults to `models`.""" + + +class GetBenchmarksDesignArenaRequestTypedDict(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. + + """ + arena: NotRequired[Arena] + r"""Arena to query. Defaults to `models`.""" + category: NotRequired[str] + r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.""" + max_results: NotRequired[int] + r"""Max results to return: per category when no category filter is applied (1–100, default 50).""" + + +class GetBenchmarksDesignArenaRequest(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. + + """ + + arena: Annotated[ + Annotated[Optional[Arena], PlainValidator(validate_open_enum(False))], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = "models" + r"""Arena to query. Defaults to `models`.""" + + category: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.""" + + max_results: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 50 + r"""Max results to return: per category when no category filter is applied (1–100, default 50).""" diff --git a/src/openrouter/operations/getfilemetadata.py b/src/openrouter/operations/getfilemetadata.py new file mode 100644 index 0000000..6a7ddf0 --- /dev/null +++ b/src/openrouter/operations/getfilemetadata.py @@ -0,0 +1,118 @@ +"""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, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetFileMetadataGlobalsTypedDict(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 GetFileMetadataGlobals(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 GetFileMetadataRequestTypedDict(TypedDict): + file_id: str + 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. + + """ + workspace_id: NotRequired[str] + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" + + +class GetFileMetadataRequest(BaseModel): + file_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + 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. + + """ + + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" diff --git a/src/openrouter/operations/getmodel.py b/src/openrouter/operations/getmodel.py new file mode 100644 index 0000000..e450562 --- /dev/null +++ b/src/openrouter/operations/getmodel.py @@ -0,0 +1,114 @@ +"""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 GetModelGlobalsTypedDict(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 GetModelGlobals(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 GetModelRequestTypedDict(TypedDict): + author: str + r"""The author/organization of the model""" + slug: str + r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)""" + 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 GetModelRequest(BaseModel): + author: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The author/organization of the model""" + + slug: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)""" + + 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/getmodels.py b/src/openrouter/operations/getmodels.py index 288c859..7491bf9 100644 --- a/src/openrouter/operations/getmodels.py +++ b/src/openrouter/operations/getmodels.py @@ -1,7 +1,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, UnrecognizedStr +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) from openrouter.utils import ( FieldMetadata, HeaderMetadata, @@ -9,6 +16,7 @@ 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 @@ -96,6 +104,24 @@ class GetModelsGlobals(BaseModel): r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.""" +Distillable = Union[ + Literal[ + "true", + "false", + ], + UnrecognizedStr, +] +r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them.""" + + +Zdr = Literal["true",] +r"""When set to \"true\", return only models with zero data retention endpoints.""" + + +Region = Literal["eu",] +r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.""" + + class GetModelsRequestTypedDict(TypedDict): http_referer: NotRequired[str] r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -118,6 +144,28 @@ class GetModelsRequestTypedDict(TypedDict): r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".""" sort: NotRequired[GetModelsSort] r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.""" + q: NotRequired[str] + r"""Free-text search by model name or slug.""" + input_modalities: NotRequired[str] + r"""Filter models by input modality. Comma-separated list of: text, image, audio, file.""" + context: NotRequired[int] + r"""Minimum context length (tokens). Models with smaller context are excluded.""" + min_price: NotRequired[Nullable[float]] + r"""Minimum prompt price in $/M tokens.""" + max_price: NotRequired[Nullable[float]] + r"""Maximum prompt price in $/M tokens.""" + arch: NotRequired[str] + r"""Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama).""" + model_authors: NotRequired[str] + r"""Filter models by the organization that created the model. Comma-separated list of author slugs.""" + providers: NotRequired[str] + r"""Filter models by hosting provider. Comma-separated list of provider names.""" + distillable: NotRequired[Distillable] + r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them.""" + zdr: NotRequired[Zdr] + r"""When set to \"true\", return only models with zero data retention endpoints.""" + region: NotRequired[Region] + r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.""" class GetModelsRequest(BaseModel): @@ -174,3 +222,118 @@ class GetModelsRequest(BaseModel): FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date). When omitted, the existing default ordering is preserved.""" + + q: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Free-text search by model name or slug.""" + + input_modalities: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter models by input modality. Comma-separated list of: text, image, audio, file.""" + + context: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Minimum context length (tokens). Models with smaller context are excluded.""" + + min_price: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Minimum prompt price in $/M tokens.""" + + max_price: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Maximum prompt price in $/M tokens.""" + + arch: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama).""" + + model_authors: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter models by the organization that created the model. Comma-separated list of author slugs.""" + + providers: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter models by hosting provider. Comma-separated list of provider names.""" + + distillable: Annotated[ + Annotated[Optional[Distillable], PlainValidator(validate_open_enum(False))], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them.""" + + zdr: Annotated[ + Optional[Zdr], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""When set to \"true\", return only models with zero data retention endpoints.""" + + region: Annotated[ + Optional[Region], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "category", + "supported_parameters", + "output_modalities", + "sort", + "q", + "input_modalities", + "context", + "min_price", + "max_price", + "arch", + "model_authors", + "providers", + "distillable", + "zdr", + "region", + ] + nullable_fields = ["min_price", "max_price"] + 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/operations/listfiles.py b/src/openrouter/operations/listfiles.py new file mode 100644 index 0000000..834ff78 --- /dev/null +++ b/src/openrouter/operations/listfiles.py @@ -0,0 +1,138 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import filelistresponse as components_filelistresponse +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 ListFilesGlobalsTypedDict(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 ListFilesGlobals(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 ListFilesRequestTypedDict(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. + + """ + limit: NotRequired[int] + r"""Maximum number of files to return (1–1000).""" + cursor: NotRequired[str] + r"""Opaque pagination cursor from a previous response.""" + workspace_id: NotRequired[str] + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" + + +class ListFilesRequest(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. + + """ + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Maximum number of files to return (1–1000).""" + + cursor: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Opaque pagination cursor from a previous response.""" + + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" + + +class ListFilesResponseTypedDict(TypedDict): + result: components_filelistresponse.FileListResponseTypedDict + + +class ListFilesResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListFilesResponse]], + Callable[[], Awaitable[Optional[ListFilesResponse]]], + ] + + result: components_filelistresponse.FileListResponse diff --git a/src/openrouter/operations/queryanalytics.py b/src/openrouter/operations/queryanalytics.py index fe4a010..698b5f7 100644 --- a/src/openrouter/operations/queryanalytics.py +++ b/src/openrouter/operations/queryanalytics.py @@ -137,7 +137,7 @@ class QueryAnalyticsRequestBodyTypedDict(TypedDict): granularity: NotRequired[str] r"""Time granularity""" group_limit: NotRequired[int] - r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" + r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" limit: NotRequired[int] r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.""" order_by: NotRequired[OrderByTypedDict] @@ -155,7 +155,7 @@ class QueryAnalyticsRequestBody(BaseModel): r"""Time granularity""" group_limit: Optional[int] = None - r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" + r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" limit: Optional[int] = None r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.""" diff --git a/src/openrouter/operations/uploadfile.py b/src/openrouter/operations/uploadfile.py new file mode 100644 index 0000000..579e1df --- /dev/null +++ b/src/openrouter/operations/uploadfile.py @@ -0,0 +1,153 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +import io +from openrouter.types import BaseModel +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + MultipartFormMetadata, + QueryParamMetadata, + RequestMetadata, +) +import pydantic +from typing import IO, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UploadFileGlobalsTypedDict(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 UploadFileGlobals(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 FileTypedDict(TypedDict): + file_name: str + content: Union[bytes, IO[bytes], io.BufferedReader] + content_type: NotRequired[str] + + +class File(BaseModel): + file_name: Annotated[ + str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True) + ] + + content: Annotated[ + Union[bytes, IO[bytes], io.BufferedReader], + pydantic.Field(alias=""), + FieldMetadata(multipart=MultipartFormMetadata(content=True)), + ] + + content_type: Annotated[ + Optional[str], + pydantic.Field(alias="Content-Type"), + FieldMetadata(multipart=True), + ] = None + + +class UploadFileRequestBodyTypedDict(TypedDict): + file: FileTypedDict + + +class UploadFileRequestBody(BaseModel): + file: Annotated[File, FieldMetadata(multipart=MultipartFormMetadata(file=True))] + + +class UploadFileRequestTypedDict(TypedDict): + request_body: UploadFileRequestBodyTypedDict + 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. + + """ + workspace_id: NotRequired[str] + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" + + +class UploadFileRequest(BaseModel): + request_body: Annotated[ + UploadFileRequestBody, + FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")), + ] + + 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. + + """ + + workspace_id: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workspace to scope the request to. Defaults to the caller’s default workspace.""" diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index ab9e6ba..ae12a80 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -625,6 +625,7 @@ def create_presets_chat_completions( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -647,6 +648,10 @@ def create_presets_chat_completions( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -676,6 +681,8 @@ def create_presets_chat_completions( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -709,6 +716,7 @@ def create_presets_chat_completions( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -717,6 +725,8 @@ def create_presets_chat_completions( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -728,6 +738,8 @@ def create_presets_chat_completions( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -769,6 +781,7 @@ def create_presets_chat_completions( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -783,6 +796,8 @@ def create_presets_chat_completions( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -805,6 +820,8 @@ def create_presets_chat_completions( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), @@ -943,6 +960,7 @@ async def create_presets_chat_completions_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -965,6 +983,10 @@ async def create_presets_chat_completions_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -994,6 +1016,8 @@ async def create_presets_chat_completions_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -1027,6 +1051,7 @@ async def create_presets_chat_completions_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -1035,6 +1060,8 @@ async def create_presets_chat_completions_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -1046,6 +1073,8 @@ async def create_presets_chat_completions_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -1087,6 +1116,7 @@ async def create_presets_chat_completions_async( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -1101,6 +1131,8 @@ async def create_presets_chat_completions_async( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -1123,6 +1155,8 @@ async def create_presets_chat_completions_async( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), @@ -1253,6 +1287,12 @@ def create_presets_messages( context_management: OptionalNullable[ Union[components.ContextManagement, components.ContextManagementTypedDict] ] = UNSET, + fallbacks: OptionalNullable[ + Union[ + List[components.MessagesFallbackParam], + List[components.MessagesFallbackParamTypedDict], + ] + ] = UNSET, max_tokens: Optional[int] = None, metadata: Optional[ Union[components.Metadata, components.MetadataTypedDict] @@ -1327,6 +1367,7 @@ def create_presets_messages( :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. :param context_management: + :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: :param metadata: :param models: @@ -1375,6 +1416,9 @@ def create_presets_messages( context_management=utils.get_pydantic_model( context_management, OptionalNullable[components.ContextManagement] ), + fallbacks=utils.get_pydantic_model( + fallbacks, OptionalNullable[List[components.MessagesFallbackParam]] + ), max_tokens=max_tokens, messages=utils.get_pydantic_model( messages, Nullable[List[components.MessagesMessageParam]] @@ -1547,6 +1591,12 @@ async def create_presets_messages_async( context_management: OptionalNullable[ Union[components.ContextManagement, components.ContextManagementTypedDict] ] = UNSET, + fallbacks: OptionalNullable[ + Union[ + List[components.MessagesFallbackParam], + List[components.MessagesFallbackParamTypedDict], + ] + ] = UNSET, max_tokens: Optional[int] = None, metadata: Optional[ Union[components.Metadata, components.MetadataTypedDict] @@ -1621,6 +1671,7 @@ async def create_presets_messages_async( :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. :param context_management: + :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: :param metadata: :param models: @@ -1669,6 +1720,9 @@ async def create_presets_messages_async( context_management=utils.get_pydantic_model( context_management, OptionalNullable[components.ContextManagement] ), + fallbacks=utils.get_pydantic_model( + fallbacks, OptionalNullable[List[components.MessagesFallbackParam]] + ), max_tokens=max_tokens, messages=utils.get_pydantic_model( messages, Nullable[List[components.MessagesMessageParam]] diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index ec179e1..abc46c8 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -25,6 +25,7 @@ from openrouter.datasets import Datasets from openrouter.embeddings import Embeddings from openrouter.endpoints import Endpoints + from openrouter.files import Files from openrouter.generations import Generations from openrouter.guardrails import Guardrails from openrouter.models_ import Models @@ -65,6 +66,8 @@ class OpenRouter(BaseSDK): r"""Text embedding endpoints""" endpoints: "Endpoints" r"""Endpoint information""" + files: "Files" + r"""Files endpoints""" generations: "Generations" r"""Generation history endpoints""" guardrails: "Guardrails" @@ -99,6 +102,7 @@ class OpenRouter(BaseSDK): "datasets": ("openrouter.datasets", "Datasets"), "embeddings": ("openrouter.embeddings", "Embeddings"), "endpoints": ("openrouter.endpoints", "Endpoints"), + "files": ("openrouter.files", "Files"), "generations": ("openrouter.generations", "Generations"), "guardrails": ("openrouter.guardrails", "Guardrails"), "api_keys": ("openrouter.api_keys", "APIKeys"), diff --git a/uv.lock b/uv.lock index 72f33e0..ac18dd7 100644 --- a/uv.lock +++ b/uv.lock @@ -220,7 +220,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.9.2" +version = "0.10.0" source = { editable = "." } dependencies = [ { name = "httpcore" },