From d8b76e8bd4f7b159b0c0341908ce8cb3f0d0eadd Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 18 Jun 2026 21:59:19 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.benchmarks.get_benchmarks()`: **Added** * `open_router.datasets.get_benchmarks_artificial_analysis()`: **Deleted** **Breaking** :warning: * `open_router.datasets.get_benchmarks_design_arena()`: **Deleted** **Breaking** :warning: * `open_router.embeddings.list_models()`: `response.data.[].reasoning` **Added** * `open_router.models.get()`: `response.data.reasoning` **Added** * `open_router.models.list()`: `response.data.[].reasoning` **Added** * `open_router.models.list_for_user()`: `response.data.[].reasoning` **Added** --- .speakeasy/gen.lock | 291 ++-- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 1224 ++++++++--------- .speakeasy/workflow.lock | 12 +- RELEASES.md | 12 +- docs/components/model.md | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/benchmarks.py | 303 ++++ src/openrouter/components/__init__.py | 147 +- src/openrouter/components/benchmarksaameta.py | 53 - .../components/benchmarksaaresponse.py | 19 - src/openrouter/components/benchmarksdameta.py | 118 -- .../components/benchmarksdaresponse.py | 19 - src/openrouter/components/model.py | 7 + src/openrouter/components/modelreasoning.py | 106 ++ ...kpricing.py => unifiedbenchmarkpricing.py} | 4 +- ...ksaaitem.py => unifiedbenchmarksaaitem.py} | 33 +- ...ksdaitem.py => unifiedbenchmarksdaitem.py} | 27 +- .../components/unifiedbenchmarksmeta.py | 95 ++ .../components/unifiedbenchmarksresponse.py | 43 + src/openrouter/datasets.py | 536 -------- src/openrouter/operations/__init__.py | 48 +- ...chmarksdesignarena.py => getbenchmarks.py} | 61 +- .../getbenchmarksartificialanalysis.py | 108 -- src/openrouter/sdk.py | 4 + uv.lock | 2 +- 27 files changed, 1476 insertions(+), 1805 deletions(-) create mode 100644 src/openrouter/benchmarks.py delete mode 100644 src/openrouter/components/benchmarksaameta.py delete mode 100644 src/openrouter/components/benchmarksaaresponse.py delete mode 100644 src/openrouter/components/benchmarksdameta.py delete mode 100644 src/openrouter/components/benchmarksdaresponse.py create mode 100644 src/openrouter/components/modelreasoning.py rename src/openrouter/components/{benchmarkpricing.py => unifiedbenchmarkpricing.py} (87%) rename src/openrouter/components/{benchmarksaaitem.py => unifiedbenchmarksaaitem.py} (78%) rename src/openrouter/components/{benchmarksdaitem.py => unifiedbenchmarksdaitem.py} (83%) create mode 100644 src/openrouter/components/unifiedbenchmarksmeta.py create mode 100644 src/openrouter/components/unifiedbenchmarksresponse.py rename src/openrouter/operations/{getbenchmarksdesignarena.py => getbenchmarks.py} (64%) delete mode 100644 src/openrouter/operations/getbenchmarksartificialanalysis.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 4249b4b3..ff12b81b 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: 8dd32184dc771115ba5e79b3c70e7f6f + docChecksum: 8a12eb05f6d29e6d4369ce71067b4c27 docVersion: 1.0.0 speakeasyVersion: 1.680.0 generationVersion: 2.788.4 - releaseVersion: 0.10.0 - configChecksum: 00a97c5bcdbddf7e591c0a1d7a45e98e + releaseVersion: 0.10.1 + configChecksum: b1687c127d87a1ac114b35dd9b492f3c repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: b6cb6701-b1ae-453f-beb8-2064f09433f4 - pristine_commit_hash: ed0a00c99b7b3b76ed1de023bc8174696435c2cd - pristine_tree_hash: a5b3d8dc9253bb236d709d9f365f5766595d820b + generation_id: 717b0ce2-06e8-4f9e-aded-3cd44ec3efb1 + pristine_commit_hash: 572e3a61274bcd286fe290615ac6976a8ecc4252 + pristine_tree_hash: 7b768060a0f6d7e54a10dda44219006db5253019 features: python: acceptHeaders: 3.0.0 @@ -596,58 +596,6 @@ 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 @@ -1428,6 +1376,10 @@ trackedFiles: id: ec28e83091da last_write_checksum: sha1:d0b6bd3f94972b0d6051fb9518e8eb3a1768a844 pristine_git_object: eec6060113f1177659279ced122473f4ab031a69 + docs/components/data.md: + id: 097aebaf54b6 + last_write_checksum: sha1:d4bb8172cfa195109540922294280699df442878 + pristine_git_object: b819f7fa193e279112258c63fcf5dce2cd6b36a8 docs/components/datacollection.md: id: cacd95d2ebf9 last_write_checksum: sha1:1d9eb4c12467860d5ef9edceb6456a4b9d6de643 @@ -1448,6 +1400,10 @@ trackedFiles: id: 8d84fb41685d last_write_checksum: sha1:fcfbe6740c505b263b90f7de5281d4f506922b05 pristine_git_object: 870296bd3335da46ecdf4ec1722a3d47037a09c9 + docs/components/defaulteffort.md: + id: 08dabde07c1d + last_write_checksum: sha1:96f06eb8b68e44984b691338b99e746fef1253ac + pristine_git_object: f3f07f26e47692dd4e6a728e45f32cfe5795082e docs/components/defaultparameters.md: id: a84477afcaec last_write_checksum: sha1:a20e8b576e341dbcdb91884b8fc83cf4316ab106 @@ -1556,10 +1512,6 @@ 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 @@ -2522,8 +2474,8 @@ trackedFiles: pristine_git_object: d5bbdc95f658be46eebf13f0ba8b9ae3716f72e2 docs/components/model.md: id: 673ad57400cd - last_write_checksum: sha1:517cbce221606bacb2cab7b97e53d316d09a5f17 - pristine_git_object: 8ce3d9d7c9ddc7c270da3a39df079148aa7ff207 + last_write_checksum: sha1:ea20bf9ca8f49a181142f516f1b36758cf5ceac6 + pristine_git_object: edb000fc276b3eec0dbe0bb1e82c4f5d7a72e8c9 docs/components/modelarchitecture.md: id: 79816051e6e8 last_write_checksum: sha1:158b04c79b7a32a2d95e3d3fda8fa6da0ab91cd9 @@ -2548,10 +2500,14 @@ trackedFiles: id: 74607e6a173d last_write_checksum: sha1:445ec227b130763e2509d1a181dd5e3e6d71420a pristine_git_object: 317190772f743d2aba63c4dad770827b46688f6a + docs/components/modelreasoning.md: + id: 47976b46e5b9 + last_write_checksum: sha1:07deec55fe155257ef07086b6dc2fbc7e012e031 + pristine_git_object: 306c0aeb39047768e6c79975996240584a97525b docs/components/modelresponse.md: id: 9d48c3f335b1 - last_write_checksum: sha1:5d8890c41a9f448341037e9915dd6e93df9140cb - pristine_git_object: 2a7433dc87413943d14220ffdfda8b25e59bc9c0 + last_write_checksum: sha1:442bb6c4d21debbceb5a48a9563b07704983123f + pristine_git_object: 2ad6e9dc16fa06d03318e98bc540c7aca0d497ed docs/components/modelscountresponse.md: id: abdad0c1a02a last_write_checksum: sha1:50ae205604eddcbdced268b8cd3e1ac06f0dd7c0 @@ -4524,6 +4480,42 @@ trackedFiles: id: 79b657be05c4 last_write_checksum: sha1:69e58ae8931fc723bbb4aa1212e50b97a83db709 pristine_git_object: 1db2a3a9378d0eeb5de39f1d6621e69bbb7e0953 + docs/components/unifiedbenchmarkpricing.md: + id: 2c0b1127a84f + last_write_checksum: sha1:536d10a0997b62e031564acc91dd3d1dede8ae6b + pristine_git_object: 02271ae5d1e6836b02869391fbc7a08df47aaa31 + docs/components/unifiedbenchmarksaaitem.md: + id: aa98383cedbb + last_write_checksum: sha1:0c5a943891afc1617252650b539aacda66219cb3 + pristine_git_object: 12ee0f9d6c843cabbeea35693eef407c7727e818 + docs/components/unifiedbenchmarksaaitemsource.md: + id: a055d68005b2 + last_write_checksum: sha1:a2d31b611ef768ef91be865e6ad137219baa49c0 + pristine_git_object: 9c7155b69b81eb5b72455656962cd477716a5527 + docs/components/unifiedbenchmarksdaitem.md: + id: 97ff97a53af6 + last_write_checksum: sha1:7e75867184c7835316e3dba6c41f99915d8f66fe + pristine_git_object: 3b882c36e525b3f547b77796a644d7a533d3e275 + docs/components/unifiedbenchmarksdaitemsource.md: + id: e45e347cc983 + last_write_checksum: sha1:7d8c239a56a8fcabf6c8633fd174c88d21bd612c + pristine_git_object: 5690f32ab463b163e96353931423c22499ac17ab + docs/components/unifiedbenchmarksmeta.md: + id: eda2de5d8d6b + last_write_checksum: sha1:87bd1e13792184db19280b3dfd52d2bdfa662c0f + pristine_git_object: 0c7f2b688f132e315d9f118e9f322a09e114ef2e + docs/components/unifiedbenchmarksmetasource.md: + id: 093d733c42fd + last_write_checksum: sha1:279c6b724eba7a372ed091be0a5708d976559242 + pristine_git_object: 7b1d3f13268aa4486b3b9c914a8574a997e73b54 + docs/components/unifiedbenchmarksmetaversion.md: + id: 883a12af05e5 + last_write_checksum: sha1:df710f97d758bb6403da1438fd81221a03142e64 + pristine_git_object: fa7abb7a34e41e9bba65d7e902d1bffbd431a7ba + docs/components/unifiedbenchmarksresponse.md: + id: 711086447b69 + last_write_checksum: sha1:3dc5c9a9383826df432fc634d0818b183fdc3e81 + pristine_git_object: b33db5afa589d28b2bf3914d312913e6f8492be1 docs/components/uniqueinsight.md: id: 8f721a7538ef last_write_checksum: sha1:d1955a3237b8047e074df6a6cf0e158beeac10c0 @@ -4846,8 +4838,8 @@ trackedFiles: pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf docs/operations/arena.md: id: a9de99ef2b33 - last_write_checksum: sha1:72964c86d5b8a31c3144454e0ca717b111a5c4f4 - pristine_git_object: bb57edab7f915ebccc0af37e46c11b7b23f9dfd9 + last_write_checksum: sha1:e512fec90170ea812bad81c221a6537e2ef92f15 + pristine_git_object: 1714dac53f131a38cd5cb11e270e5500b0740280 docs/operations/bulkaddworkspacemembersglobals.md: id: 6cff183f93a1 last_write_checksum: sha1:39941ebc9a51b0189aed03680e2168e25b7c9692 @@ -5272,22 +5264,14 @@ 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/getbenchmarksglobals.md: + id: 18c553c31212 + last_write_checksum: sha1:99f5c115ff5fd28f04cb80fe4dfa280f12c7c68b + pristine_git_object: 215e03e822bc8d9945711a5b08bdb1790617dd3b + docs/operations/getbenchmarksrequest.md: + id: 0a40a540bba0 + last_write_checksum: sha1:1f54c7ebf3f8cf6a4da9ea292294187792b0c614 + pristine_git_object: e9088a6e0d7573ec4723f0bf912ddd30bd2eb485 docs/operations/getbyokkeyglobals.md: id: 82a8cd8db21c last_write_checksum: sha1:4490949622267f537def903fa3efe64142925739 @@ -5828,10 +5812,18 @@ trackedFiles: id: 354b29241c52 last_write_checksum: sha1:baf6f1195eeabcb4742fec427127f2c33ffd9b3c pristine_git_object: c4ba8c79c6ba3021472583b922c3ef01c4115bf4 + docs/operations/source.md: + id: 8d5b4a7ef752 + last_write_checksum: sha1:e46913a18472448a48f87fc83f400ef7e9624977 + pristine_git_object: aeba9c144e6043108e3b6eb4446518f00f7927e5 docs/operations/subcategory.md: id: "169243175101" last_write_checksum: sha1:ddf3195ab7768df3095efa4cc86ea7b5ca3504f3 pristine_git_object: 912cc5d754a041cfdddbad5c704505a3f7da1cec + docs/operations/tasktype.md: + id: f741399fcc2a + last_write_checksum: sha1:e3b9c5b4a2b103ee4c7f60e7c8eb25b8a351c970 + pristine_git_object: f978421391efaf8d7b0b449cbcba9b82a93d182a docs/operations/timerange.md: id: a5ee8c05a917 last_write_checksum: sha1:00b61805899422b836494a24088ec33674316714 @@ -5948,6 +5940,10 @@ trackedFiles: id: e2bd25998427 last_write_checksum: sha1:82bec11fedf21eed760739e1adb08fec06239279 pristine_git_object: 6e72f51df9e9811cee424032f7dba0887e15afec + docs/sdks/benchmarks/README.md: + id: 61c16262af9b + last_write_checksum: sha1:0ebef898413dbfb2b853ca4cb6af668ee823714b + pristine_git_object: cc91680b1792bbb52eca1ef2aadebd4e49f393c9 docs/sdks/betaanalytics/README.md: id: e037af84b386 last_write_checksum: sha1:78a1ed27ae55ac9b6e6926e2587adeda0de65aa3 @@ -5966,8 +5962,8 @@ trackedFiles: pristine_git_object: 1837ff59343eb87482e8750c1fb5d2b5f89aae6a docs/sdks/datasets/README.md: id: deb5d90f4faf - last_write_checksum: sha1:a3585d8d399421584c3f65610c59fe5dfbf897ab - pristine_git_object: f097289cff8c229c70c4f9e3e934f28372f69167 + last_write_checksum: sha1:c09c0c118def84591a90132f77b67f40ae9e3d1e + pristine_git_object: afcf796dfd4d793bbfe7bcd3bdd81e5fe908de94 docs/sdks/embeddings/README.md: id: 15b5b04486c1 last_write_checksum: sha1:c2ed15521af31873f56e7813292aa30c5adf94e4 @@ -6042,8 +6038,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:ccf5925a473a1eb527cec02639f862b79b601251 - pristine_git_object: 396bd51f9c1428f03560f3e7988edc99edc698e8 + last_write_checksum: sha1:8223abd8e7463dfa2b2c1097670bb28b2ec73e68 + pristine_git_object: b98c0280ffbb42638747b1064375fa36f467223c scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6070,8 +6066,8 @@ trackedFiles: pristine_git_object: 07ace03229fd3267623c8f48665d2c3a67c3565d src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:017dc1ec43588b31eee23532d74d4421993dd874 - pristine_git_object: be619e3be1aa8d27deef5752ecc9ff09ccd4cd9f + last_write_checksum: sha1:856bdf17b7de36f6e1abd0b56f55bbc6093e4c68 + pristine_git_object: ade61995259031f3789ff71f0cfd1d6ae4b39395 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:6d47d1ab3da9cb4ac9f0a2bfe442f1a82a614f35 @@ -6084,6 +6080,10 @@ trackedFiles: id: c5733c5a1e12 last_write_checksum: sha1:71f242fd9955e5a17a8d055e2210cc2708bb94fc pristine_git_object: fcffdcc6eaa61a4b79f7f1f76458eeb27e8f896d + src/openrouter/benchmarks.py: + id: 178d2ad8d706 + last_write_checksum: sha1:1848fee2325139d8d0332bee42ea2a88ce6d6fa1 + pristine_git_object: 9be3aea8a1564cf0305c0b210a6134768e9f2678 src/openrouter/beta.py: id: fffdf54fd8f5 last_write_checksum: sha1:7999d9294e23e166c6b27236262f1fb40139a4d1 @@ -6102,8 +6102,8 @@ trackedFiles: pristine_git_object: a1894915bd32aee65f019885634eb7908970a046 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:56e0c315ac8fe611bf70b465a91341acbbe34534 - pristine_git_object: 2c07302c12f51cdf053e306906ac30862e925246 + last_write_checksum: sha1:805bb2df1d5fe49556f426348971e5ccdc08aa56 + pristine_git_object: eca63a922d8154ae9106e8f8b5aaf16dbc580afd src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:1b6b66672fb80dccdc39843a98bdef6d7d804364 @@ -6340,34 +6340,6 @@ 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 @@ -7178,8 +7150,8 @@ trackedFiles: pristine_git_object: 1257b38d2001f34078cd1b052c20264e81a95e57 src/openrouter/components/model.py: id: cef3adaa772b - last_write_checksum: sha1:53eb4a044a7bf546225416bb08597df46a3b60a2 - pristine_git_object: 637b3fbe54ddcc454750d8de702045ee690c3333 + last_write_checksum: sha1:53f544fe39ae08cde33f99c5d0bb4b6cc1555301 + pristine_git_object: c0345109fb1717ea27010605984c27e1137426fd src/openrouter/components/modelarchitecture.py: id: b37ac27e512b last_write_checksum: sha1:e1dd41aa140b2ca2c3bbf15abf74e034d42b0166 @@ -7196,6 +7168,10 @@ trackedFiles: id: b8759a1a4787 last_write_checksum: sha1:69b2c991666848f4790e5136c67553733cc68a54 pristine_git_object: c197cb2c527296adff2c3cfd9e49bcbc48087ce7 + src/openrouter/components/modelreasoning.py: + id: 58bb3f2d75e0 + last_write_checksum: sha1:3da126ae596520b6d4f0edcc7fb8e4f786f686c7 + pristine_git_object: b71947b65e2054b23ff2094a270763720e740d96 src/openrouter/components/modelresponse.py: id: 023136e6dedf last_write_checksum: sha1:af84587984cbe6341f59f176b08df43096ac48c6 @@ -7936,6 +7912,26 @@ trackedFiles: id: 7d9755fc8395 last_write_checksum: sha1:d614e72cc67bf6c4da7f57cf0f4367de726ec06d pristine_git_object: 0fc3c7c3991891ae00ae2f624df78d21e0ae05a8 + src/openrouter/components/unifiedbenchmarkpricing.py: + id: b08adf1a31d0 + last_write_checksum: sha1:e8d1cb425c61a7094f50a73e59cec6d64dc34204 + pristine_git_object: bad387cea54fcab00e8a7fe54780dd97a29d72c3 + src/openrouter/components/unifiedbenchmarksaaitem.py: + id: cc8382ac1af5 + last_write_checksum: sha1:39fc6f0409234ec30e6bbdba2736e278abda8756 + pristine_git_object: a01518d4c996f16bd740489684b20a9682db0f0e + src/openrouter/components/unifiedbenchmarksdaitem.py: + id: 946501943ce2 + last_write_checksum: sha1:22bbe61dd833db3da96796ebfdcd3141dd0ed126 + pristine_git_object: 0bb8159d555e263bd875bd42e1cf0e552c3573b5 + src/openrouter/components/unifiedbenchmarksmeta.py: + id: ca02b44f633a + last_write_checksum: sha1:51ddebd33c93d098e9c61a8b78bbc3c7dddd9d41 + pristine_git_object: c336e5f881c0b244d7e8e77af130a7c9bcad7290 + src/openrouter/components/unifiedbenchmarksresponse.py: + id: 4f7bbccaba03 + last_write_checksum: sha1:1c1195908154b530fb82e0782a9cab884e833aa9 + pristine_git_object: a1daaa7ca0c2794e4317902ea856dc88475acce8 src/openrouter/components/unprocessableentityresponseerrordata.py: id: e8ca4a51f994 last_write_checksum: sha1:d9ff0dea491e12d5ccb28607eb65f00fe8d694aa @@ -8106,8 +8102,8 @@ trackedFiles: pristine_git_object: 0a376fb8ee2df0be8546458e0008a2fbc0fd492a src/openrouter/datasets.py: id: 2378f80d1d6a - last_write_checksum: sha1:16857b6d0c5e815cfacb6db6eef804dd37493a38 - pristine_git_object: c80a941f2da9bc4c71561fb804ca4e64dfb7c31b + last_write_checksum: sha1:057b0dde4e051f2cf5cd9fd5b82bbe45eb8fafc5 + pristine_git_object: c483912549b3243f73b300bcea343914e66ef211 src/openrouter/embeddings.py: id: 0374ace39067 last_write_checksum: sha1:8622e7717ef639f2ee452d295c4b2c957a2fe13f @@ -8238,8 +8234,8 @@ trackedFiles: pristine_git_object: 37ee42a638f5fce69fc7db1e6b86efb51f381582 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:5b56b8c29c9360d44a121cdb78811b323c2f5093 - pristine_git_object: 8b12f08941bfd82eabf06beb651eaced69f48158 + last_write_checksum: sha1:d0572cc16c500a9dba895239890bc01414b339a6 + pristine_git_object: 650e7d0faaf2b32b7c96dd196b6e8c412c573795 src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:2b9c73dd8a24d6c479d50118a309e4e0969ca7ea @@ -8368,14 +8364,10 @@ 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/getbenchmarks.py: + id: 5fb88644491e + last_write_checksum: sha1:450e522cd4e5b332328f8567dbbbf61f4f47e20e + pristine_git_object: 6a36cea63dac2f7702b23421a8def30dd4578e80 src/openrouter/operations/getbyokkey.py: id: d141452bd88a last_write_checksum: sha1:16c33afc84cd0d3a68e977e739a59d14dfd3bd44 @@ -8594,8 +8586,8 @@ trackedFiles: pristine_git_object: 944aff9aa812fff9b702d8735a37ea279d915a1d src/openrouter/sdk.py: id: ee9846c4c9c5 - last_write_checksum: sha1:b2d1f64ba5783c98dc31e15e23966d83abaa2d9d - pristine_git_object: abc46c8355ba5cd0fee2e8e1536ac90eda7aa1b4 + last_write_checksum: sha1:3c56a0b380306e3fd0c16cdc5119123681112ef6 + pristine_git_object: 1105dc4218ffe9bb0f0ad814c2e77000497867e0 src/openrouter/sdkconfiguration.py: id: 55773bb98d7c last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001 @@ -10042,5 +10034,30 @@ examples: application/json: {"error": {"code": 404, "message": "Resource not found"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getBenchmarks: + speakeasy-default-get-benchmarks: + parameters: + query: + source: "artificial-analysis" + max_results: 20 + responses: + "200": + application/json: {"data": [{"agentic_index": 58.3, "coding_index": 65.8, "display_name": "GPT-4o", "intelligence_index": 71.2, "model_permaslug": "openai/gpt-4o", "pricing": {"completion": "0.00001", "prompt": "0.0000025"}, "source": "artificial-analysis"}], "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", "task_type": null, "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"}} examplesVersion: 1.0.2 -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.workspaces.set_budget()`: **Added**\n* `open_router.o_auth.create_auth_code()`: \n * `request.workspace_id` **Added**\n * `error.status[403]` **Added**\n* `open_router.files.download()`: **Added**\n* `open_router.models.get()`: **Added**\n* `open_router.workspaces.list_budgets()`: **Added**\n* `open_router.workspaces.delete_budget()`: **Added**\n* `open_router.datasets.get_benchmarks_artificial_analysis()`: **Added**\n* `open_router.beta.analytics.query_analytics()`: `response.data.warnings` **Added**\n* `open_router.files.delete()`: **Added**\n* `open_router.files.retrieve()`: **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` **Changed**\n* `open_router.datasets.get_benchmarks_design_arena()`: **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.benchmarks.get_benchmarks()`: **Added** + * `open_router.datasets.get_benchmarks_artificial_analysis()`: **Deleted** **Breaking** :warning: + * `open_router.datasets.get_benchmarks_design_arena()`: **Deleted** **Breaking** :warning: + * `open_router.embeddings.list_models()`: `response.data.[].reasoning` **Added** + * `open_router.models.get()`: `response.data.reasoning` **Added** + * `open_router.models.list()`: `response.data.[].reasoning` **Added** + * `open_router.models.list_for_user()`: `response.data.[].reasoning` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 652ef6cc..dec9772a 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.10.0 + version: 0.10.1 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 0efe6ba9..238714f4 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -3642,349 +3642,6 @@ 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 @@ -12151,6 +11808,15 @@ components: image: '0' prompt: '0.00003' request: '0' + reasoning: + default_effort: medium + default_enabled: true + mandatory: false + supported_efforts: + - high + - medium + - low + - minimal supported_parameters: - temperature - top_p @@ -12213,6 +11879,8 @@ components: $ref: '#/components/schemas/PerRequestLimits' pricing: $ref: '#/components/schemas/PublicPricing' + reasoning: + $ref: '#/components/schemas/ModelReasoning' supported_parameters: description: List of supported parameters for this model items: @@ -12377,6 +12045,43 @@ components: description: Model to use for completion example: openai/gpt-4 type: string + ModelReasoning: + description: Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models. + example: + default_effort: medium + default_enabled: true + mandatory: false + supported_efforts: + - high + - medium + - low + - minimal + properties: + default_effort: + allOf: + - $ref: '#/components/schemas/ReasoningEffort' + - description: >- + Default reasoning effort when the client enables reasoning without specifying effort. Maps to `reasoning.effort` in chat requests. When `"none"`, prefer omitting effort unless the user explicitly disables reasoning. + default_enabled: + description: Default reasoning enabled state when the client does not set `reasoning.enabled`. + type: boolean + mandatory: + description: When true, reasoning cannot be disabled and effort "none" is rejected. + type: boolean + supported_efforts: + description: >- + Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted. + items: + $ref: '#/components/schemas/ReasoningEffort' + nullable: true + type: array + supports_max_tokens: + description: >- + Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise. + type: boolean + required: + - mandatory + type: object ModelResponse: description: Single model response example: @@ -20326,73 +20031,331 @@ components: required: - is_moderated type: object - TraceConfig: - additionalProperties: - nullable: true - description: >- - 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. + TraceConfig: + additionalProperties: + nullable: true + description: >- + 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. + example: + trace_id: trace-abc123 + trace_name: my-app-trace + properties: + generation_name: + type: string + parent_span_id: + type: string + span_name: + type: string + trace_id: + type: string + trace_name: + type: string + type: object + Truncation: + enum: + - auto + - disabled + - null + example: auto + nullable: true + type: string + x-speakeasy-unknown-values: allow + UnauthorizedResponse: + description: Unauthorized - Authentication required or invalid credentials + example: + error: + code: 401 + message: Missing Authentication header + properties: + error: + $ref: '#/components/schemas/UnauthorizedResponseErrorData' + openrouter_metadata: + additionalProperties: + nullable: true + nullable: true + type: object + user_id: + nullable: true + type: string + required: + - error + type: object + UnauthorizedResponseErrorData: + description: Error data for UnauthorizedResponse + example: + code: 401 + message: Missing Authentication header + properties: + code: + type: integer + message: + type: string + metadata: + additionalProperties: + nullable: true + nullable: true + type: object + required: + - code + - message + type: object + UnifiedBenchmarkPricing: + 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 + UnifiedBenchmarksAAItem: + example: + agentic_index: 58.3 + coding_index: 65.8 + display_name: GPT-4o + intelligence_index: 71.2 + model_permaslug: openai/gpt-4o + pricing: + completion: '0.00001' + prompt: '0.0000025' + source: artificial-analysis + properties: + 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 + display_name: + description: Model name as listed on Artificial Analysis. + example: GPT-4o + type: string + 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/UnifiedBenchmarkPricing' + source: + description: Benchmark source discriminator. + enum: + - artificial-analysis + type: string + required: + - source + - model_permaslug + - display_name + - intelligence_index + - coding_index + - agentic_index + - pricing + type: object + UnifiedBenchmarksDAItem: + 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' + source: design-arena + 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 mapped; otherwise the upstream Design Arena model id. + example: anthropic/claude-sonnet-4 + type: string + pricing: + $ref: '#/components/schemas/UnifiedBenchmarkPricing' + source: + description: Benchmark source discriminator. + enum: + - design-arena + type: string + 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: + - source + - model_permaslug + - display_name + - arena + - category + - elo + - win_rate + - avg_generation_time_ms + - tournament_stats + - pricing + type: object + UnifiedBenchmarksMeta: example: - trace_id: trace-abc123 - trace_name: my-app-trace + 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 + task_type: null + version: v1 properties: - generation_name: - type: string - parent_span_id: + as_of: + description: ISO-8601 timestamp of when this data was last updated. + example: '2026-06-03T12:00:00Z' type: string - span_name: + citation: + description: Required attribution when republishing this data. + example: 'Source: Artificial Analysis (artificialanalysis.ai) via OpenRouter (openrouter.ai/rankings).' type: string - trace_id: + model_count: + description: Number of unique models in the response. + type: integer + source: + description: The source filter applied. + enum: + - artificial-analysis + - design-arena + example: artificial-analysis type: string - trace_name: + x-speakeasy-unknown-values: allow + source_url: + description: URL of the upstream data source. + example: https://artificialanalysis.ai type: string - type: object - Truncation: - enum: - - auto - - disabled - - null - example: auto - nullable: true - type: string - x-speakeasy-unknown-values: allow - UnauthorizedResponse: - description: Unauthorized - Authentication required or invalid credentials - example: - error: - code: 401 - message: Missing Authentication header - properties: - error: - $ref: '#/components/schemas/UnauthorizedResponseErrorData' - openrouter_metadata: - additionalProperties: - nullable: true - nullable: true - type: object - user_id: + task_type: + description: The task_type filter applied, or null if showing all. nullable: true type: string + version: + description: Dataset version. + enum: + - v1 + type: string required: - - error + - as_of + - version + - source + - source_url + - citation + - model_count + - task_type type: object - UnauthorizedResponseErrorData: - description: Error data for UnauthorizedResponse + UnifiedBenchmarksResponse: example: - code: 401 - message: Missing Authentication header + data: + - agentic_index: 58.3 + coding_index: 65.8 + display_name: GPT-4o + intelligence_index: 71.2 + model_permaslug: openai/gpt-4o + pricing: + completion: '0.00001' + prompt: '0.0000025' + source: artificial-analysis + 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 + task_type: null + version: v1 properties: - code: - type: integer - message: - type: string - metadata: - additionalProperties: - nullable: true - nullable: true - type: object + data: + items: + discriminator: + mapping: + artificial-analysis: '#/components/schemas/UnifiedBenchmarksAAItem' + design-arena: '#/components/schemas/UnifiedBenchmarksDAItem' + propertyName: source + oneOf: + - $ref: '#/components/schemas/UnifiedBenchmarksAAItem' + - $ref: '#/components/schemas/UnifiedBenchmarksDAItem' + type: array + meta: + $ref: '#/components/schemas/UnifiedBenchmarksMeta' required: - - code - - message + - data + - meta type: object UnprocessableEntityResponse: description: Unprocessable Entity - Semantic validation failure @@ -22882,44 +22845,195 @@ paths: application/json: example: data: - app_id: 12345 - created_at: '2025-08-24T10:30:00Z' - id: auth_code_xyz789 + app_id: 12345 + created_at: '2025-08-24T10:30:00Z' + id: auth_code_xyz789 + schema: + example: + data: + app_id: 12345 + created_at: '2025-08-24T10:30:00Z' + id: auth_code_xyz789 + properties: + data: + description: Auth code data + example: + app_id: 12345 + created_at: '2025-08-24T10:30:00Z' + id: auth_code_xyz789 + properties: + app_id: + description: The application ID associated with this auth code + example: 12345 + type: integer + created_at: + description: ISO 8601 timestamp of when the auth code was created + example: '2025-08-24T10:30:00Z' + type: string + id: + description: The authorization code ID to use in the exchange request + example: auth_code_xyz789 + type: string + required: + - id + - app_id + - created_at + type: object + required: + - data + type: object + description: Successfully created authorization code + '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 + '409': + content: + application/json: + example: + error: + code: 409 + message: Resource conflict. Please try again later. + schema: + $ref: '#/components/schemas/ConflictResponse' + description: Conflict - Resource conflict or concurrent modification + '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: Create authorization code + tags: + - OAuth + x-speakeasy-name-override: createAuthCode + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /benchmarks: + get: + description: >- + Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + operationId: getBenchmarks + parameters: + - description: Benchmark source to query. Determines the shape of the returned items. + in: query + name: source + required: true + schema: + description: Benchmark source to query. Determines the shape of the returned items. + enum: + - artificial-analysis + - design-arena + example: artificial-analysis + type: string + x-speakeasy-unknown-values: allow + - description: >- + Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category. + in: query + name: task_type + required: false + schema: + description: >- + Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category. + enum: + - coding + - intelligence + - agentic + example: coding + type: string + x-speakeasy-unknown-values: allow + - description: 'Design Arena only: arena to query. Defaults to `models` when source is `design-arena`.' + in: query + name: arena + required: false + schema: + description: 'Design Arena only: arena to query. Defaults to `models` when source is `design-arena`.' + enum: + - models + - builders + - agents + example: models + type: string + x-speakeasy-unknown-values: allow + - description: >- + Design Arena only: 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: >- + Design Arena only: 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 (1–100, default 50). + in: query + name: max_results + required: false + schema: + 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: + - agentic_index: 58.3 + coding_index: 65.8 + display_name: GPT-4o + intelligence_index: 71.2 + model_permaslug: openai/gpt-4o + pricing: + completion: '0.00001' + prompt: '0.0000025' + source: artificial-analysis + 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 + task_type: null + version: v1 schema: - example: - data: - app_id: 12345 - created_at: '2025-08-24T10:30:00Z' - id: auth_code_xyz789 - properties: - data: - description: Auth code data - example: - app_id: 12345 - created_at: '2025-08-24T10:30:00Z' - id: auth_code_xyz789 - properties: - app_id: - description: The application ID associated with this auth code - example: 12345 - type: integer - created_at: - description: ISO 8601 timestamp of when the auth code was created - example: '2025-08-24T10:30:00Z' - type: string - id: - description: The authorization code ID to use in the exchange request - example: auth_code_xyz789 - type: string - required: - - id - - app_id - - created_at - type: object - required: - - data - type: object - description: Successfully created authorization code + $ref: '#/components/schemas/UnifiedBenchmarksResponse' + description: Benchmark results filtered by the specified source and optional task type. '400': content: application/json: @@ -22940,26 +23054,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': + '429': content: application/json: example: error: - code: 409 - message: Resource conflict. Please try again later. + code: 429 + message: Rate limit exceeded schema: - $ref: '#/components/schemas/ConflictResponse' - description: Conflict - Resource conflict or concurrent modification + $ref: '#/components/schemas/TooManyRequestsResponse' + description: Too Many Requests - Rate limit exceeded '500': content: application/json: @@ -22970,10 +23074,9 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' description: Internal Server Error - Unexpected server error - summary: Create authorization code + summary: List Benchmarks tags: - - OAuth - x-speakeasy-name-override: createAuthCode + - Benchmarks parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" @@ -24049,219 +24152,6 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" - /datasets/benchmarks/artificial-analysis: - get: - 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: Max results to return (1–100, default 50). - in: query - name: max_results - required: false - schema: - 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: |- @@ -28725,7 +28615,7 @@ paths: id: openai/gpt-4 knowledge_cutoff: null links: - details: /api/v1/models/openai/gpt-5.4/endpoints + details: /api/v1/models/openai/gpt-4/endpoints name: GPT-4 per_request_limits: null pricing: @@ -32681,6 +32571,8 @@ tags: name: Anthropic Messages - description: BYOK endpoints name: BYOK + - description: Benchmarks endpoints + name: Benchmarks - description: Chat completion endpoints name: Chat - description: Credit management endpoints diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8c161448..89d274d5 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:716ece4a1211eac2ee0e7e5836c7b484cff9bb002bd4e676d9ecad8317ee7941 - sourceBlobDigest: sha256:12d3dc8e7150ab2c4c5e3d613b01cb5e4dcce52b329eea89ca1fdc656d6fe045 + sourceRevisionDigest: sha256:6ca77315c3cd31ab7e308e010b26b7c9eb366b11b78ea9c71179facc4daaf97b + sourceBlobDigest: sha256:8bada810c7c5ddb302c51dbbbb36dd0c9a45c4ba1c5e44af1646f69fc2a38751 tags: - latest - - speakeasy-sdk-regen-1781312282 + - speakeasy-sdk-regen-1781819857 - 1.0.0 targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:716ece4a1211eac2ee0e7e5836c7b484cff9bb002bd4e676d9ecad8317ee7941 - sourceBlobDigest: sha256:12d3dc8e7150ab2c4c5e3d613b01cb5e4dcce52b329eea89ca1fdc656d6fe045 + sourceRevisionDigest: sha256:6ca77315c3cd31ab7e308e010b26b7c9eb366b11b78ea9c71179facc4daaf97b + sourceBlobDigest: sha256:8bada810c7c5ddb302c51dbbbb36dd0c9a45c4ba1c5e44af1646f69fc2a38751 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:e7d6f4de48a7c63cf15f3a8378f952277cd4c59373c28c61909497853fa769e2 + codeSamplesRevisionDigest: sha256:80ceff338c097e19bf3951fd00e8010fc7c102b916a684eeec33d507b7a3844f workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.680.0 diff --git a/RELEASES.md b/RELEASES.md index 3c7e1bf4..f59c6de1 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -28,4 +28,14 @@ Based on: ### Generated - [python v0.10.0] . ### Releases -- [PyPI v0.10.0] https://pypi.org/project/openrouter/0.10.0 - . \ No newline at end of file +- [PyPI v0.10.0] https://pypi.org/project/openrouter/0.10.0 - . + +## 2026-06-18 21:57:15 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.10.1] . +### Releases +- [PyPI v0.10.1] https://pypi.org/project/openrouter/0.10.1 - . \ No newline at end of file diff --git a/docs/components/model.md b/docs/components/model.md index 8ce3d9d7..edb000fc 100644 --- a/docs/components/model.md +++ b/docs/components/model.md @@ -22,6 +22,7 @@ Information about an AI model available on OpenRouter | `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"
} | +| `reasoning` | [Optional[components.ModelReasoning]](../components/modelreasoning.md) | :heavy_minus_sign: | Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models. | {
"default_effort": "medium",
"default_enabled": true,
"mandatory": false,
"supported_efforts": [
"high",
"medium",
"low",
"minimal"
]
} | | `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/pyproject.toml b/pyproject.toml index 396bd51f..b98c0280 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.10.0" +version = "0.10.1" 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 be619e3b..ade61995 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.10.0" +__version__: str = "0.10.1" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.788.4" -__user_agent__: str = "speakeasy-sdk/python 0.10.0 2.788.4 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.10.1 2.788.4 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/benchmarks.py b/src/openrouter/benchmarks.py new file mode 100644 index 00000000..9be3aea8 --- /dev/null +++ b/src/openrouter/benchmarks.py @@ -0,0 +1,303 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from openrouter import components, errors, operations, utils +from openrouter._hooks import HookContext +from openrouter.types import OptionalNullable, UNSET +from openrouter.utils import get_security_from_env +from openrouter.utils.unmarshal_json_response import unmarshal_json_response +from typing import Any, Mapping, Optional + + +class Benchmarks(BaseSDK): + r"""Benchmarks endpoints""" + + def get_benchmarks( + self, + *, + source: operations.Source, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + task_type: Optional[operations.TaskType] = None, + arena: Optional[operations.Arena] = None, + 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.UnifiedBenchmarksResponse: + r"""List Benchmarks + + Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + + :param source: Benchmark source to query. Determines the shape of the returned items. + :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 task_type: Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category. + :param arena: Design Arena only: arena to query. Defaults to `models` when source is `design-arena`. + :param category: Design Arena only: 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 (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.GetBenchmarksRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + source=source, + task_type=task_type, + arena=arena, + category=category, + max_results=max_results, + ) + + req = self._build_request( + method="GET", + path="/benchmarks", + 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.GetBenchmarksGlobals( + 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="getBenchmarks", + 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.UnifiedBenchmarksResponse, 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_async( + self, + *, + source: operations.Source, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + task_type: Optional[operations.TaskType] = None, + arena: Optional[operations.Arena] = None, + 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.UnifiedBenchmarksResponse: + r"""List Benchmarks + + Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account. + + :param source: Benchmark source to query. Determines the shape of the returned items. + :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 task_type: Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category. + :param arena: Design Arena only: arena to query. Defaults to `models` when source is `design-arena`. + :param category: Design Arena only: 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 (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.GetBenchmarksRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + source=source, + task_type=task_type, + arena=arena, + category=category, + max_results=max_results, + ) + + req = self._build_request_async( + method="GET", + path="/benchmarks", + 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.GetBenchmarksGlobals( + 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="getBenchmarks", + 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.UnifiedBenchmarksResponse, 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) diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 2c07302c..eca63a92 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -276,38 +276,6 @@ 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, @@ -1436,6 +1404,7 @@ from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modelgroup import ModelGroup from .modellinks import ModelLinks, ModelLinksTypedDict + from .modelreasoning import DefaultEffort, ModelReasoning, ModelReasoningTypedDict from .modelresponse import ModelResponse, ModelResponseTypedDict from .modelscountresponse import ( ModelsCountResponse, @@ -2348,6 +2317,34 @@ UnauthorizedResponseErrorData, UnauthorizedResponseErrorDataTypedDict, ) + from .unifiedbenchmarkpricing import ( + UnifiedBenchmarkPricing, + UnifiedBenchmarkPricingTypedDict, + ) + from .unifiedbenchmarksaaitem import ( + UnifiedBenchmarksAAItem, + UnifiedBenchmarksAAItemSource, + UnifiedBenchmarksAAItemTypedDict, + ) + from .unifiedbenchmarksdaitem import ( + TournamentStats, + TournamentStatsTypedDict, + UnifiedBenchmarksDAItem, + UnifiedBenchmarksDAItemSource, + UnifiedBenchmarksDAItemTypedDict, + ) + from .unifiedbenchmarksmeta import ( + UnifiedBenchmarksMeta, + UnifiedBenchmarksMetaSource, + UnifiedBenchmarksMetaTypedDict, + UnifiedBenchmarksMetaVersion, + ) + from .unifiedbenchmarksresponse import ( + Data, + DataTypedDict, + UnifiedBenchmarksResponse, + UnifiedBenchmarksResponseTypedDict, + ) from .unprocessableentityresponseerrordata import ( UnprocessableEntityResponseErrorData, UnprocessableEntityResponseErrorDataTypedDict, @@ -2728,26 +2725,6 @@ "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", @@ -3069,13 +3046,16 @@ "CustomToolTypedDict", "DABenchmarkEntry", "DABenchmarkEntryTypedDict", + "Data", "DataCollection", "DataRegion", + "DataTypedDict", "DatetimeServerTool", "DatetimeServerToolConfig", "DatetimeServerToolConfigTypedDict", "DatetimeServerToolType", "DatetimeServerToolTypedDict", + "DefaultEffort", "DefaultParameters", "DefaultParametersTypedDict", "DeleteBYOKKeyResponse", @@ -3120,8 +3100,6 @@ "EditCompact20260112TypedDict", "EditTypeInputTokens", "EditTypedDict", - "EloBounds", - "EloBoundsTypedDict", "EndpointInfo", "EndpointInfoTypedDict", "EndpointStatus", @@ -3518,6 +3496,8 @@ "ModelGroup", "ModelLinks", "ModelLinksTypedDict", + "ModelReasoning", + "ModelReasoningTypedDict", "ModelResponse", "ModelResponseTypedDict", "ModelTypedDict", @@ -4277,6 +4257,20 @@ "URLCitationTypedDict", "UnauthorizedResponseErrorData", "UnauthorizedResponseErrorDataTypedDict", + "UnifiedBenchmarkPricing", + "UnifiedBenchmarkPricingTypedDict", + "UnifiedBenchmarksAAItem", + "UnifiedBenchmarksAAItemSource", + "UnifiedBenchmarksAAItemTypedDict", + "UnifiedBenchmarksDAItem", + "UnifiedBenchmarksDAItemSource", + "UnifiedBenchmarksDAItemTypedDict", + "UnifiedBenchmarksMeta", + "UnifiedBenchmarksMetaSource", + "UnifiedBenchmarksMetaTypedDict", + "UnifiedBenchmarksMetaVersion", + "UnifiedBenchmarksResponse", + "UnifiedBenchmarksResponseTypedDict", "UniqueInsight", "UniqueInsightTypedDict", "UnprocessableEntityResponseErrorData", @@ -4569,30 +4563,6 @@ "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", @@ -5459,6 +5429,9 @@ "ModelGroup": ".modelgroup", "ModelLinks": ".modellinks", "ModelLinksTypedDict": ".modellinks", + "DefaultEffort": ".modelreasoning", + "ModelReasoning": ".modelreasoning", + "ModelReasoningTypedDict": ".modelreasoning", "ModelResponse": ".modelresponse", "ModelResponseTypedDict": ".modelresponse", "ModelsCountResponse": ".modelscountresponse", @@ -6127,6 +6100,24 @@ "Truncation": ".truncation", "UnauthorizedResponseErrorData": ".unauthorizedresponseerrordata", "UnauthorizedResponseErrorDataTypedDict": ".unauthorizedresponseerrordata", + "UnifiedBenchmarkPricing": ".unifiedbenchmarkpricing", + "UnifiedBenchmarkPricingTypedDict": ".unifiedbenchmarkpricing", + "UnifiedBenchmarksAAItem": ".unifiedbenchmarksaaitem", + "UnifiedBenchmarksAAItemSource": ".unifiedbenchmarksaaitem", + "UnifiedBenchmarksAAItemTypedDict": ".unifiedbenchmarksaaitem", + "TournamentStats": ".unifiedbenchmarksdaitem", + "TournamentStatsTypedDict": ".unifiedbenchmarksdaitem", + "UnifiedBenchmarksDAItem": ".unifiedbenchmarksdaitem", + "UnifiedBenchmarksDAItemSource": ".unifiedbenchmarksdaitem", + "UnifiedBenchmarksDAItemTypedDict": ".unifiedbenchmarksdaitem", + "UnifiedBenchmarksMeta": ".unifiedbenchmarksmeta", + "UnifiedBenchmarksMetaSource": ".unifiedbenchmarksmeta", + "UnifiedBenchmarksMetaTypedDict": ".unifiedbenchmarksmeta", + "UnifiedBenchmarksMetaVersion": ".unifiedbenchmarksmeta", + "Data": ".unifiedbenchmarksresponse", + "DataTypedDict": ".unifiedbenchmarksresponse", + "UnifiedBenchmarksResponse": ".unifiedbenchmarksresponse", + "UnifiedBenchmarksResponseTypedDict": ".unifiedbenchmarksresponse", "UnprocessableEntityResponseErrorData": ".unprocessableentityresponseerrordata", "UnprocessableEntityResponseErrorDataTypedDict": ".unprocessableentityresponseerrordata", "UpdateBYOKKeyRequest": ".updatebyokkeyrequest", diff --git a/src/openrouter/components/benchmarksaameta.py b/src/openrouter/components/benchmarksaameta.py deleted file mode 100644 index 9d751f4a..00000000 --- a/src/openrouter/components/benchmarksaameta.py +++ /dev/null @@ -1,53 +0,0 @@ -"""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 deleted file mode 100644 index 787ae1ca..00000000 --- a/src/openrouter/components/benchmarksaaresponse.py +++ /dev/null @@ -1,19 +0,0 @@ -"""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/benchmarksdameta.py b/src/openrouter/components/benchmarksdameta.py deleted file mode 100644 index 0ca3550d..00000000 --- a/src/openrouter/components/benchmarksdameta.py +++ /dev/null @@ -1,118 +0,0 @@ -"""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 deleted file mode 100644 index 7588fc52..00000000 --- a/src/openrouter/components/benchmarksdaresponse.py +++ /dev/null @@ -1,19 +0,0 @@ -"""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/model.py b/src/openrouter/components/model.py index 637b3fbe..c0345109 100644 --- a/src/openrouter/components/model.py +++ b/src/openrouter/components/model.py @@ -5,6 +5,7 @@ from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modellinks import ModelLinks, ModelLinksTypedDict +from .modelreasoning import ModelReasoning, ModelReasoningTypedDict from .parameter import Parameter from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict from .publicpricing import PublicPricing, PublicPricingTypedDict @@ -62,6 +63,8 @@ class ModelTypedDict(TypedDict): r"""Hugging Face model identifier, if applicable""" knowledge_cutoff: NotRequired[Nullable[str]] r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown.""" + reasoning: NotRequired[ModelReasoningTypedDict] + r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models.""" class Model(BaseModel): @@ -123,6 +126,9 @@ class Model(BaseModel): knowledge_cutoff: OptionalNullable[str] = UNSET r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown.""" + reasoning: Optional[ModelReasoning] = None + r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -131,6 +137,7 @@ def serialize_model(self, handler): "expiration_date", "hugging_face_id", "knowledge_cutoff", + "reasoning", ] nullable_fields = [ "context_length", diff --git a/src/openrouter/components/modelreasoning.py b/src/openrouter/components/modelreasoning.py new file mode 100644 index 00000000..b71947b6 --- /dev/null +++ b/src/openrouter/components/modelreasoning.py @@ -0,0 +1,106 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .reasoningeffort import ReasoningEffort +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import validate_open_enum +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +DefaultEffort = Union[ + Literal[ + "xhigh", + "high", + "medium", + "low", + "minimal", + "none", + ], + UnrecognizedStr, +] +r"""Default reasoning effort when the client enables reasoning without specifying effort. Maps to `reasoning.effort` in chat requests. When `\"none\"`, prefer omitting effort unless the user explicitly disables reasoning.""" + + +class ModelReasoningTypedDict(TypedDict): + r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models.""" + + mandatory: bool + r"""When true, reasoning cannot be disabled and effort \"none\" is rejected.""" + default_effort: NotRequired[Nullable[DefaultEffort]] + default_enabled: NotRequired[bool] + r"""Default reasoning enabled state when the client does not set `reasoning.enabled`.""" + supported_efforts: NotRequired[Nullable[List[Nullable[ReasoningEffort]]]] + r"""Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted.""" + supports_max_tokens: NotRequired[bool] + r"""Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise.""" + + +class ModelReasoning(BaseModel): + r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models.""" + + mandatory: bool + r"""When true, reasoning cannot be disabled and effort \"none\" is rejected.""" + + default_effort: Annotated[ + OptionalNullable[DefaultEffort], PlainValidator(validate_open_enum(False)) + ] = UNSET + + default_enabled: Optional[bool] = None + r"""Default reasoning enabled state when the client does not set `reasoning.enabled`.""" + + supported_efforts: OptionalNullable[ + List[ + Annotated[ + Nullable[ReasoningEffort], PlainValidator(validate_open_enum(False)) + ] + ] + ] = UNSET + r"""Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted.""" + + supports_max_tokens: Optional[bool] = None + r"""Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "default_effort", + "default_enabled", + "supported_efforts", + "supports_max_tokens", + ] + nullable_fields = ["default_effort", "supported_efforts"] + 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/benchmarkpricing.py b/src/openrouter/components/unifiedbenchmarkpricing.py similarity index 87% rename from src/openrouter/components/benchmarkpricing.py rename to src/openrouter/components/unifiedbenchmarkpricing.py index 3524f786..bad387ce 100644 --- a/src/openrouter/components/benchmarkpricing.py +++ b/src/openrouter/components/unifiedbenchmarkpricing.py @@ -5,7 +5,7 @@ from typing_extensions import TypedDict -class BenchmarkPricingTypedDict(TypedDict): +class UnifiedBenchmarkPricingTypedDict(TypedDict): r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" completion: str @@ -14,7 +14,7 @@ class BenchmarkPricingTypedDict(TypedDict): r"""Cost per input token (USD, decimal string).""" -class BenchmarkPricing(BaseModel): +class UnifiedBenchmarkPricing(BaseModel): r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" completion: str diff --git a/src/openrouter/components/benchmarksaaitem.py b/src/openrouter/components/unifiedbenchmarksaaitem.py similarity index 78% rename from src/openrouter/components/benchmarksaaitem.py rename to src/openrouter/components/unifiedbenchmarksaaitem.py index 2855ffe1..a01518d4 100644 --- a/src/openrouter/components/benchmarksaaitem.py +++ b/src/openrouter/components/unifiedbenchmarksaaitem.py @@ -1,46 +1,59 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict +from .unifiedbenchmarkpricing import ( + UnifiedBenchmarkPricing, + UnifiedBenchmarkPricingTypedDict, +) from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL from pydantic import model_serializer +from typing import Literal from typing_extensions import TypedDict -class BenchmarksAAItemTypedDict(TypedDict): - aa_name: str - r"""Model name as listed on Artificial Analysis.""" +UnifiedBenchmarksAAItemSource = Literal["artificial-analysis",] +r"""Benchmark source discriminator.""" + + +class UnifiedBenchmarksAAItemTypedDict(TypedDict): 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.""" + display_name: str + r"""Model name as listed on Artificial Analysis.""" 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] + pricing: Nullable[UnifiedBenchmarkPricingTypedDict] r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + source: UnifiedBenchmarksAAItemSource + r"""Benchmark source discriminator.""" -class BenchmarksAAItem(BaseModel): - aa_name: str - r"""Model name as listed on Artificial Analysis.""" - +class UnifiedBenchmarksAAItem(BaseModel): 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.""" + display_name: str + r"""Model name as listed on Artificial Analysis.""" + 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] + pricing: Nullable[UnifiedBenchmarkPricing] r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + source: UnifiedBenchmarksAAItemSource + r"""Benchmark source discriminator.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [] diff --git a/src/openrouter/components/benchmarksdaitem.py b/src/openrouter/components/unifiedbenchmarksdaitem.py similarity index 83% rename from src/openrouter/components/benchmarksdaitem.py rename to src/openrouter/components/unifiedbenchmarksdaitem.py index 7713e2e8..0bb8159d 100644 --- a/src/openrouter/components/benchmarksdaitem.py +++ b/src/openrouter/components/unifiedbenchmarksdaitem.py @@ -1,12 +1,20 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict +from .unifiedbenchmarkpricing import ( + UnifiedBenchmarkPricing, + UnifiedBenchmarkPricingTypedDict, +) from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL from pydantic import model_serializer +from typing import Literal from typing_extensions import TypedDict +UnifiedBenchmarksDAItemSource = Literal["design-arena",] +r"""Benchmark source discriminator.""" + + class TournamentStatsTypedDict(TypedDict): r"""Placement distribution from tournament matches.""" @@ -67,7 +75,7 @@ def serialize_model(self, handler): return m -class BenchmarksDAItemTypedDict(TypedDict): +class UnifiedBenchmarksDAItemTypedDict(TypedDict): arena: str r"""Arena this ranking belongs to.""" avg_generation_time_ms: Nullable[float] @@ -79,16 +87,18 @@ class BenchmarksDAItemTypedDict(TypedDict): 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"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id.""" + pricing: Nullable[UnifiedBenchmarkPricingTypedDict] r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + source: UnifiedBenchmarksDAItemSource + r"""Benchmark source discriminator.""" tournament_stats: TournamentStatsTypedDict r"""Placement distribution from tournament matches.""" win_rate: float r"""Win rate as a percentage (0–100).""" -class BenchmarksDAItem(BaseModel): +class UnifiedBenchmarksDAItem(BaseModel): arena: str r"""Arena this ranking belongs to.""" @@ -105,11 +115,14 @@ class BenchmarksDAItem(BaseModel): 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.""" + r"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id.""" - pricing: Nullable[BenchmarkPricing] + pricing: Nullable[UnifiedBenchmarkPricing] r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + source: UnifiedBenchmarksDAItemSource + r"""Benchmark source discriminator.""" + tournament_stats: TournamentStats r"""Placement distribution from tournament matches.""" diff --git a/src/openrouter/components/unifiedbenchmarksmeta.py b/src/openrouter/components/unifiedbenchmarksmeta.py new file mode 100644 index 00000000..c336e5f8 --- /dev/null +++ b/src/openrouter/components/unifiedbenchmarksmeta.py @@ -0,0 +1,95 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from openrouter.utils import validate_open_enum +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import Literal, Union +from typing_extensions import Annotated, TypedDict + + +UnifiedBenchmarksMetaSource = Union[ + Literal[ + "artificial-analysis", + "design-arena", + ], + UnrecognizedStr, +] +r"""The source filter applied.""" + + +UnifiedBenchmarksMetaVersion = Literal["v1",] +r"""Dataset version.""" + + +class UnifiedBenchmarksMetaTypedDict(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: UnifiedBenchmarksMetaSource + r"""The source filter applied.""" + source_url: str + r"""URL of the upstream data source.""" + task_type: Nullable[str] + r"""The task_type filter applied, or null if showing all.""" + version: UnifiedBenchmarksMetaVersion + r"""Dataset version.""" + + +class UnifiedBenchmarksMeta(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: Annotated[ + UnifiedBenchmarksMetaSource, PlainValidator(validate_open_enum(False)) + ] + r"""The source filter applied.""" + + source_url: str + r"""URL of the upstream data source.""" + + task_type: Nullable[str] + r"""The task_type filter applied, or null if showing all.""" + + version: UnifiedBenchmarksMetaVersion + r"""Dataset version.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["task_type"] + 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/unifiedbenchmarksresponse.py b/src/openrouter/components/unifiedbenchmarksresponse.py new file mode 100644 index 00000000..a1daaa7c --- /dev/null +++ b/src/openrouter/components/unifiedbenchmarksresponse.py @@ -0,0 +1,43 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .unifiedbenchmarksaaitem import ( + UnifiedBenchmarksAAItem, + UnifiedBenchmarksAAItemTypedDict, +) +from .unifiedbenchmarksdaitem import ( + UnifiedBenchmarksDAItem, + UnifiedBenchmarksDAItemTypedDict, +) +from .unifiedbenchmarksmeta import UnifiedBenchmarksMeta, UnifiedBenchmarksMetaTypedDict +from openrouter.types import BaseModel +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag +from typing import List, Union +from typing_extensions import Annotated, TypeAliasType, TypedDict + + +DataTypedDict = TypeAliasType( + "DataTypedDict", + Union[UnifiedBenchmarksAAItemTypedDict, UnifiedBenchmarksDAItemTypedDict], +) + + +Data = Annotated[ + Union[ + Annotated[UnifiedBenchmarksAAItem, Tag("artificial-analysis")], + Annotated[UnifiedBenchmarksDAItem, Tag("design-arena")], + ], + Discriminator(lambda m: get_discriminator(m, "source", "source")), +] + + +class UnifiedBenchmarksResponseTypedDict(TypedDict): + data: List[DataTypedDict] + meta: UnifiedBenchmarksMetaTypedDict + + +class UnifiedBenchmarksResponse(BaseModel): + data: List[Data] + + meta: UnifiedBenchmarksMeta diff --git a/src/openrouter/datasets.py b/src/openrouter/datasets.py index c80a941f..c4839125 100644 --- a/src/openrouter/datasets.py +++ b/src/openrouter/datasets.py @@ -426,542 +426,6 @@ 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/operations/__init__.py b/src/openrouter/operations/__init__.py index 8b12f089..650e7d0f 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -290,18 +290,14 @@ GetAppRankingsSort, Subcategory, ) - from .getbenchmarksartificialanalysis import ( - GetBenchmarksArtificialAnalysisGlobals, - GetBenchmarksArtificialAnalysisGlobalsTypedDict, - GetBenchmarksArtificialAnalysisRequest, - GetBenchmarksArtificialAnalysisRequestTypedDict, - ) - from .getbenchmarksdesignarena import ( + from .getbenchmarks import ( Arena, - GetBenchmarksDesignArenaGlobals, - GetBenchmarksDesignArenaGlobalsTypedDict, - GetBenchmarksDesignArenaRequest, - GetBenchmarksDesignArenaRequestTypedDict, + GetBenchmarksGlobals, + GetBenchmarksGlobalsTypedDict, + GetBenchmarksRequest, + GetBenchmarksRequestTypedDict, + Source, + TaskType, ) from .getbyokkey import ( GetBYOKKeyGlobals, @@ -899,14 +895,10 @@ "GetBYOKKeyGlobalsTypedDict", "GetBYOKKeyRequest", "GetBYOKKeyRequestTypedDict", - "GetBenchmarksArtificialAnalysisGlobals", - "GetBenchmarksArtificialAnalysisGlobalsTypedDict", - "GetBenchmarksArtificialAnalysisRequest", - "GetBenchmarksArtificialAnalysisRequestTypedDict", - "GetBenchmarksDesignArenaGlobals", - "GetBenchmarksDesignArenaGlobalsTypedDict", - "GetBenchmarksDesignArenaRequest", - "GetBenchmarksDesignArenaRequestTypedDict", + "GetBenchmarksGlobals", + "GetBenchmarksGlobalsTypedDict", + "GetBenchmarksRequest", + "GetBenchmarksRequestTypedDict", "GetCreditsData", "GetCreditsDataTypedDict", "GetCreditsGlobals", @@ -1163,7 +1155,9 @@ "SendChatCompletionRequestRequestTypedDict", "SendChatCompletionRequestResponse", "SendChatCompletionRequestResponseTypedDict", + "Source", "Subcategory", + "TaskType", "TimeRange", "TimeRangeTypedDict", "TypeImageURL", @@ -1435,15 +1429,13 @@ "GetAppRankingsResponseTypedDict": ".getapprankings", "GetAppRankingsSort": ".getapprankings", "Subcategory": ".getapprankings", - "GetBenchmarksArtificialAnalysisGlobals": ".getbenchmarksartificialanalysis", - "GetBenchmarksArtificialAnalysisGlobalsTypedDict": ".getbenchmarksartificialanalysis", - "GetBenchmarksArtificialAnalysisRequest": ".getbenchmarksartificialanalysis", - "GetBenchmarksArtificialAnalysisRequestTypedDict": ".getbenchmarksartificialanalysis", - "Arena": ".getbenchmarksdesignarena", - "GetBenchmarksDesignArenaGlobals": ".getbenchmarksdesignarena", - "GetBenchmarksDesignArenaGlobalsTypedDict": ".getbenchmarksdesignarena", - "GetBenchmarksDesignArenaRequest": ".getbenchmarksdesignarena", - "GetBenchmarksDesignArenaRequestTypedDict": ".getbenchmarksdesignarena", + "Arena": ".getbenchmarks", + "GetBenchmarksGlobals": ".getbenchmarks", + "GetBenchmarksGlobalsTypedDict": ".getbenchmarks", + "GetBenchmarksRequest": ".getbenchmarks", + "GetBenchmarksRequestTypedDict": ".getbenchmarks", + "Source": ".getbenchmarks", + "TaskType": ".getbenchmarks", "GetBYOKKeyGlobals": ".getbyokkey", "GetBYOKKeyGlobalsTypedDict": ".getbyokkey", "GetBYOKKeyRequest": ".getbyokkey", diff --git a/src/openrouter/operations/getbenchmarksdesignarena.py b/src/openrouter/operations/getbenchmarks.py similarity index 64% rename from src/openrouter/operations/getbenchmarksdesignarena.py rename to src/openrouter/operations/getbenchmarks.py index 2ac2aed2..6a36cea6 100644 --- a/src/openrouter/operations/getbenchmarksdesignarena.py +++ b/src/openrouter/operations/getbenchmarks.py @@ -14,7 +14,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict -class GetBenchmarksDesignArenaGlobalsTypedDict(TypedDict): +class GetBenchmarksGlobalsTypedDict(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. @@ -30,7 +30,7 @@ class GetBenchmarksDesignArenaGlobalsTypedDict(TypedDict): """ -class GetBenchmarksDesignArenaGlobals(BaseModel): +class GetBenchmarksGlobals(BaseModel): http_referer: Annotated[ Optional[str], pydantic.Field(alias="HTTP-Referer"), @@ -60,6 +60,27 @@ class GetBenchmarksDesignArenaGlobals(BaseModel): """ +Source = Union[ + Literal[ + "artificial-analysis", + "design-arena", + ], + UnrecognizedStr, +] +r"""Benchmark source to query. Determines the shape of the returned items.""" + + +TaskType = Union[ + Literal[ + "coding", + "intelligence", + "agentic", + ], + UnrecognizedStr, +] +r"""Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category.""" + + Arena = Union[ Literal[ "models", @@ -68,10 +89,12 @@ class GetBenchmarksDesignArenaGlobals(BaseModel): ], UnrecognizedStr, ] -r"""Arena to query. Defaults to `models`.""" +r"""Design Arena only: arena to query. Defaults to `models` when source is `design-arena`.""" -class GetBenchmarksDesignArenaRequestTypedDict(TypedDict): +class GetBenchmarksRequestTypedDict(TypedDict): + source: Source + r"""Benchmark source to query. Determines the shape of the returned items.""" 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. @@ -85,15 +108,23 @@ class GetBenchmarksDesignArenaRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ + task_type: NotRequired[TaskType] + r"""Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category.""" arena: NotRequired[Arena] - r"""Arena to query. Defaults to `models`.""" + r"""Design Arena only: arena to query. Defaults to `models` when source is `design-arena`.""" category: NotRequired[str] - r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.""" + r"""Design Arena only: 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).""" + r"""Max results to return (1–100, default 50).""" -class GetBenchmarksDesignArenaRequest(BaseModel): +class GetBenchmarksRequest(BaseModel): + source: Annotated[ + Annotated[Source, PlainValidator(validate_open_enum(False))], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Benchmark source to query. Determines the shape of the returned items.""" + http_referer: Annotated[ Optional[str], pydantic.Field(alias="HTTP-Referer"), @@ -122,20 +153,26 @@ class GetBenchmarksDesignArenaRequest(BaseModel): """ + task_type: Annotated[ + Annotated[Optional[TaskType], PlainValidator(validate_open_enum(False))], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category.""" + 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`.""" + ] = None + r"""Design Arena only: arena to query. Defaults to `models` when source is `design-arena`.""" 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.""" + r"""Design Arena only: 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).""" + r"""Max results to return (1–100, default 50).""" diff --git a/src/openrouter/operations/getbenchmarksartificialanalysis.py b/src/openrouter/operations/getbenchmarksartificialanalysis.py deleted file mode 100644 index 707ed912..00000000 --- a/src/openrouter/operations/getbenchmarksartificialanalysis.py +++ /dev/null @@ -1,108 +0,0 @@ -"""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/sdk.py b/src/openrouter/sdk.py index abc46c83..1105dc42 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -18,6 +18,7 @@ if TYPE_CHECKING: from openrouter.analytics import Analytics from openrouter.api_keys import APIKeys + from openrouter.benchmarks import Benchmarks from openrouter.beta import Beta from openrouter.byok import Byok from openrouter.chat import Chat @@ -55,6 +56,8 @@ class OpenRouter(BaseSDK): r"""Speech-to-text endpoints""" o_auth: "OAuth" r"""OAuth authentication endpoints""" + benchmarks: "Benchmarks" + r"""Benchmarks endpoints""" byok: "Byok" r"""BYOK endpoints""" chat: "Chat" @@ -96,6 +99,7 @@ class OpenRouter(BaseSDK): "tts": ("openrouter.tts", "Tts"), "stt": ("openrouter.stt", "Stt"), "o_auth": ("openrouter.oauth", "OAuth"), + "benchmarks": ("openrouter.benchmarks", "Benchmarks"), "byok": ("openrouter.byok", "Byok"), "chat": ("openrouter.chat", "Chat"), "credits": ("openrouter.credits", "Credits"), diff --git a/uv.lock b/uv.lock index ac18dd79..0bfff321 100644 --- a/uv.lock +++ b/uv.lock @@ -220,7 +220,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.10.0" +version = "0.10.1" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 6c83145dee0609599f47f4526d1befbb724af026 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2026 21:59:37 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow