diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 04f8f75..ce8192b 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 5f7e8ca6bc0d259c803c0a9f1d076595 + docChecksum: 874a04cb037a3344f1aa6d2ed5d1da3c docVersion: 1.0.0 speakeasyVersion: 1.680.0 generationVersion: 2.788.4 - releaseVersion: 0.9.2 - configChecksum: f906b25652bcc83a52d1c74e5018c02e + releaseVersion: 0.9.3 + configChecksum: 7bf04f90580aa61c8c654af11bae478e repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 01e70c93-1c74-4268-a847-77bcb8354f3c - pristine_commit_hash: 27acb9e68a5dcb4165451c0c99cccb6828dc0f0f - pristine_tree_hash: b01e1f8716abc3b4a335b139a12550ef1c267853 + generation_id: d4a3bb73-b6e9-474e-9a0a-a88eff755331 + pristine_commit_hash: eeeda07127cf08f4ac1b58abe8e19a87a1603fa5 + pristine_tree_hash: c8ce94a5fee00fea963dbd998de8119c45605473 features: python: acceptHeaders: 3.0.0 @@ -74,6 +74,10 @@ trackedFiles: id: 3aed33ce6e6f last_write_checksum: sha1:d70160e42e737f03bca79873bae8e91ae2b585d1 pristine_git_object: 9c1506b8f539140db04b239d7a84d8b599747932 + docs/components/aabenchmarkentry.md: + id: f90294cbb4a3 + last_write_checksum: sha1:86a3b23d00014cdee0eea44dcdbaf965117a6e35 + pristine_git_object: f4d05c6ca2c90f231fc59abd56b907a02fcd3dc1 docs/components/action.md: id: 6b3978ee918f last_write_checksum: sha1:9d4cd420c5cd5ea25837e2c6db447d5ecb600b7a @@ -582,6 +586,26 @@ 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/benchmarksdaitem.md: + id: a921b9b462b2 + last_write_checksum: sha1:51b045b1525937e43d122e7e944e305393957000 + pristine_git_object: 6ef28c047743208fd9694ff3f5fb6797ed2bec39 + docs/components/benchmarksdameta.md: + id: 396a3643066d + last_write_checksum: sha1:66ef7825517bd36297c051657da9d222c5f125e4 + pristine_git_object: 2e787756d04a3f4d7d907a62a18e4dfd96df1acb + 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 @@ -836,8 +860,8 @@ trackedFiles: pristine_git_object: ca73483767de32b3d83b7f9e2741011e26ac8e59 docs/components/chatrequest.md: id: 5e0fa9a2cb13 - last_write_checksum: sha1:58ccd62998278ca595b2d308bff8d974ac32a317 - pristine_git_object: 8c5a706618a5c35ebf4ea32fd6de9893adc3ac3d + last_write_checksum: sha1:a0f55b1bb0073e6cbdc69d687115729737a9cf3e + pristine_git_object: 6c832606b0e983d2efd7cc6e3bec98d70e7fc603 docs/components/chatrequesteffort.md: id: 244b6cbbd2e1 last_write_checksum: sha1:232d283adecdffb3fd73e052f4913320c9d0b997 @@ -850,6 +874,10 @@ trackedFiles: id: dbec0ff3ecbc last_write_checksum: sha1:f749dd845cea3d45a0fd3f4a39e3f1edb5f8f54e pristine_git_object: baa1fb1a1f855f0ea648d44b8cb4c52185efe77d + docs/components/chatrequestreasoningeffort.md: + id: d91e84590d64 + last_write_checksum: sha1:e05ffa6a13566055170ad3490b2114c7f8215c70 + pristine_git_object: ab2eb8e2084efaee1528e74f2de35166d9bbf05e docs/components/chatrequestservicetier.md: id: deaf591bec38 last_write_checksum: sha1:8fa53b0f868c99934b83719b7c0b6b44b1f960eb @@ -1354,6 +1382,10 @@ trackedFiles: id: 5fabd69a4a9d last_write_checksum: sha1:900733b615df411575d56ac31008d2059e75e1be pristine_git_object: 173b9852b2b997cdbd6308ccfc7c8aa3659dea04 + docs/components/dabenchmarkentry.md: + id: ec28e83091da + last_write_checksum: sha1:d0b6bd3f94972b0d6051fb9518e8eb3a1768a844 + pristine_git_object: eec6060113f1177659279ced122473f4ab031a69 docs/components/datacollection.md: id: cacd95d2ebf9 last_write_checksum: sha1:1d9eb4c12467860d5ef9edceb6456a4b9d6de643 @@ -1478,6 +1510,10 @@ trackedFiles: id: 099ed6a1de82 last_write_checksum: sha1:41580565bc483b2ca1cdb981e15d324f8060f504 pristine_git_object: 8463c0cdd55e1d75e23e3d7362f0dbfeca1985c0 + docs/components/elobounds.md: + id: a274cbd2e74e + last_write_checksum: sha1:516698f2d4c018cb0e999981d34f4d4d782a2382 + pristine_git_object: 101203ebc6a380cabc8c7767c3d9a775bbf16dda docs/components/endpointinfo.md: id: 98e0e75e1121 last_write_checksum: sha1:5563b32279aeafa2725d1547df1d0f517e53789d @@ -2322,6 +2358,10 @@ trackedFiles: id: 02e41844a8ea last_write_checksum: sha1:a6cf799a1fa3dcd873532c14cfa673658ceb32b5 pristine_git_object: b72f8916b4236118a46566bf81ed1d4c466ed882 + docs/components/messagesfallbackparam.md: + id: dfcbb7b1e2e6 + last_write_checksum: sha1:53d5e4a1468a7678fe5f0a3b643807c01868c9ae + pristine_git_object: ef4923e715bbb2fa8a00b2d0ed6025e36280dfa0 docs/components/messagesmessageparam.md: id: 4f67bcb5ba0d last_write_checksum: sha1:cf46c4085fd571135f33f1f4eae994d49775d140 @@ -2372,8 +2412,8 @@ trackedFiles: pristine_git_object: 6a8883bfc55e71980d691e2b9bda395dc40397e0 docs/components/messagesrequest.md: id: e479a7035a9d - last_write_checksum: sha1:3ca14c934dd303e0d3da2efac9160cca1448eedc - pristine_git_object: 86c616e20899fc4410a0902368d2304fd5067b30 + last_write_checksum: sha1:7f34c120832595fda47c0a0740558fd1778775de + pristine_git_object: ef9fe199bf4fe157d4e0a141e0a68fb072e94163 docs/components/messagesrequestplugin.md: id: 6c74af3351ff last_write_checksum: sha1:ae5c77653f405c1074121821ac97ff6a78c2f76f @@ -2412,8 +2452,8 @@ trackedFiles: pristine_git_object: d5bbdc95f658be46eebf13f0ba8b9ae3716f72e2 docs/components/model.md: id: 673ad57400cd - last_write_checksum: sha1:e628f3670edde9ecdd3b5c227c95b8f3f6c2620f - pristine_git_object: 55f6fe4664787c9dd50ae653851a2d42b70ba7e2 + last_write_checksum: sha1:517cbce221606bacb2cab7b97e53d316d09a5f17 + pristine_git_object: 8ce3d9d7c9ddc7c270da3a39df079148aa7ff207 docs/components/modelarchitecture.md: id: 79816051e6e8 last_write_checksum: sha1:158b04c79b7a32a2d95e3d3fda8fa6da0ab91cd9 @@ -2422,6 +2462,10 @@ trackedFiles: id: 3518ad912450 last_write_checksum: sha1:e4745000d4820fa66c7b7994e676b061fbf38d96 pristine_git_object: eabbbe356d5ed319279e02b0aa032253b67e3bb0 + docs/components/modelbenchmarks.md: + id: a1ad8feb3ff8 + last_write_checksum: sha1:b310d3dae053e14f917b06f6c825d6bc3aa33741 + pristine_git_object: 0c62dd14d0578a9892e5d7316112075ff63afde7 docs/components/modelenum.md: id: 578e84498f95 last_write_checksum: sha1:e4c89141e391bb02c8b01ef243e414603937b527 @@ -2434,6 +2478,10 @@ trackedFiles: id: 74607e6a173d last_write_checksum: sha1:445ec227b130763e2509d1a181dd5e3e6d71420a pristine_git_object: 317190772f743d2aba63c4dad770827b46688f6a + docs/components/modelresponse.md: + id: 9d48c3f335b1 + last_write_checksum: sha1:5d8890c41a9f448341037e9915dd6e93df9140cb + pristine_git_object: 2a7433dc87413943d14220ffdfda8b25e59bc9c0 docs/components/modelscountresponse.md: id: abdad0c1a02a last_write_checksum: sha1:50ae205604eddcbdced268b8cd3e1ac06f0dd7c0 @@ -3540,8 +3588,12 @@ trackedFiles: pristine_git_object: 54e6cc87d517e482c1ac183ccf82c0140f081d24 docs/components/rankingsdailymeta.md: id: 6e0da9cd4001 - last_write_checksum: sha1:51cd8cda99b6dedd6d2a2c96d8c18e72b2371986 - pristine_git_object: fea99fcf6d54cf6e8676eff7883b643f8deaab2c + last_write_checksum: sha1:b8d4b19c912849fdb8bcb368ab8fd69e79c8d95c + pristine_git_object: 29de269bdb6ef7a68d6611ca47122d56c50e63b8 + docs/components/rankingsdailymetaversion.md: + id: 3d7a17ae95b6 + last_write_checksum: sha1:9e2999b047c2e7ef2828c0d710f7428fd88496f7 + pristine_git_object: 6bf107f0b3c03140e6d4e894204a21564c51eca2 docs/components/rankingsdailyresponse.md: id: f8764b589bb4 last_write_checksum: sha1:4d31d93b0df4cf990f541cc7f08649f8cb438c43 @@ -3906,10 +3958,18 @@ trackedFiles: id: cd398c147ce2 last_write_checksum: sha1:fa4c5eb6413b1b3439019994e24aeb1555b6db0b pristine_git_object: d1c78e0ac7ea698f51c656b0e273878f1e434de1 + docs/components/sourceenum.md: + id: 090b309951c8 + last_write_checksum: sha1:d996db94106f11abe4d4bad4a1fc798e202b7cc6 + pristine_git_object: c2e38bd24fab7d0b85a17969d3008a79efd17373 docs/components/sourcetype.md: id: bd6802987652 last_write_checksum: sha1:4584a8d072c0977ab588a830991c8c0ebe0fc285 pristine_git_object: 7a5e671a65aae56cebe75e622bd37a6187bd74d6 + docs/components/sourceurl.md: + id: 8e85579b2f66 + last_write_checksum: sha1:bbf2a0a1c17eec91b9116fb10cc9f08a9d2085eb + pristine_git_object: b1ba92243540c149805480d1403a3b2b1523912e docs/components/speechrequest.md: id: c5cba48286f8 last_write_checksum: sha1:956140ea1f1ae63bf64fb9ca7e300c836c2c3eaf @@ -4194,6 +4254,10 @@ trackedFiles: id: c9e56036dd80 last_write_checksum: sha1:4b25308beba5c14f49058889aabd27bcf025c184 pristine_git_object: e66d615faf440dba26e666f28cb740a477df6e84 + docs/components/tournamentstats.md: + id: 0be10d528a1a + last_write_checksum: sha1:38e369f7141807de906f2af88d0c4956884319c6 + pristine_git_object: b27126b18386e224874a4186e801bb6c4fdcf818 docs/components/traceconfig.md: id: 639fd1f6f967 last_write_checksum: sha1:560d3f57a9f103eee587ab1f260548161658675f @@ -4426,10 +4490,6 @@ trackedFiles: id: 0a9da5ac382d last_write_checksum: sha1:76ec453c1e767ce0f8c76afc0617cdc7ff29b60c pristine_git_object: cf10c9e56352e1ef074e794b915639774a0de872 - docs/components/version.md: - id: 7507f00a20fb - last_write_checksum: sha1:64a942b733da255793b182b90030ef9514db6e27 - pristine_git_object: f76abbca9198ac1083a5983ac69dcfc9a87561b1 docs/components/videogenerationrequest.md: id: cacead3ac9fe last_write_checksum: sha1:c87d8d7a7ce900738b6a536f863a34cf36854506 @@ -4666,6 +4726,10 @@ trackedFiles: id: 4343ac43161c last_write_checksum: sha1:562c0f21e308ad10c27f85f75704c15592c6929d pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf + docs/operations/arena.md: + id: a9de99ef2b33 + last_write_checksum: sha1:72964c86d5b8a31c3144454e0ca717b111a5c4f4 + pristine_git_object: bb57edab7f915ebccc0af37e46c11b7b23f9dfd9 docs/operations/bulkaddworkspacemembersglobals.md: id: 6cff183f93a1 last_write_checksum: sha1:39941ebc9a51b0189aed03680e2168e25b7c9692 @@ -4760,8 +4824,8 @@ trackedFiles: pristine_git_object: 6dc06174a0f72d4b4d0f22bc88a3f8a941e7666f docs/operations/createauthkeyscoderequestbody.md: id: 402f2065cf8a - last_write_checksum: sha1:df4a827cb17240f62bfa31c2f72444a7dd49d7ac - pristine_git_object: 787c57a4d6bd2134c71d88a83044aee60cd9cc83 + last_write_checksum: sha1:514edc63e97c5d347e3533e5590b7e8b30d29c67 + pristine_git_object: cfb186be3d8039ec501a39fece92ff6ff1ffe9a4 docs/operations/createauthkeyscoderesponse.md: id: 6c92952aa6b6 last_write_checksum: sha1:9f9f0dd11d268a8bb27e9f6f99ce41da757e23fc @@ -5058,6 +5122,14 @@ trackedFiles: id: f6276c91ff17 last_write_checksum: sha1:9c80418c5384e63542ea16aa336c3bfe54c23b64 pristine_git_object: f0d402fbc8b66cc075706e056fd152e41e141c3f + docs/operations/getbenchmarksdesignarenaglobals.md: + id: 4e2f927bea8b + last_write_checksum: sha1:76d2ff4919b87f05d3672f5b660033d2c9e689a2 + pristine_git_object: d6c6cad08146378c7794aa8af56234a01cf0df71 + docs/operations/getbenchmarksdesignarenarequest.md: + id: aea9fe0d448c + last_write_checksum: sha1:433d65b3a6d7fe0b3e4a824a8ca9f9a36593a6be + pristine_git_object: 73202a7094b97faf481947434a8253f72eb872b6 docs/operations/getbyokkeyglobals.md: id: 82a8cd8db21c last_write_checksum: sha1:4490949622267f537def903fa3efe64142925739 @@ -5130,6 +5202,14 @@ trackedFiles: id: c145b1a0dd5f last_write_checksum: sha1:c315584d278f8f91f4437479ef8e95ce48b3130c pristine_git_object: 72e8055b7d9b0de224ea423fab24a5614d6e9da3 + docs/operations/getmodelglobals.md: + id: 8bf42bb29760 + last_write_checksum: sha1:015159b3fab18f2122ba256831314a96c88085de + pristine_git_object: 5c12ffab153909fbf0b235c63500d36f09bc6259 + docs/operations/getmodelrequest.md: + id: 81d572026a85 + last_write_checksum: sha1:87ba489a1703e58e49c19ff6f29a416f9441a378 + pristine_git_object: ebc160f8b88bbe2208da932a31248fa0eb726d83 docs/operations/getmodelscategory.md: id: 30e7c8fb695d last_write_checksum: sha1:aab2e450286bc960f0aa5a856e29b6b2f2feaaa1 @@ -5528,8 +5608,8 @@ trackedFiles: pristine_git_object: d8c88120bf89df54fc08efc3de0ae50c291cad39 docs/operations/queryanalyticsrequestbody.md: id: d462ba943863 - last_write_checksum: sha1:1d2c5928d852134b8f46f890710d8ea3fa4afb47 - pristine_git_object: 8b20d84e52c0e3bf788ac6edef549e39538669c8 + last_write_checksum: sha1:d61b9cb983826a5e4dc9c5fef29e29d7c3ccd848 + pristine_git_object: 87a4d54f500b26455023c24ac6b5f26b9efad510 docs/operations/queryanalyticsresponse.md: id: 662c24789418 last_write_checksum: sha1:88a8ceb4ceaad18c15e6b22450205d1562b17064 @@ -5656,24 +5736,24 @@ trackedFiles: pristine_git_object: 6e72f51df9e9811cee424032f7dba0887e15afec docs/sdks/betaanalytics/README.md: id: e037af84b386 - last_write_checksum: sha1:9375a62a38b542ab12a694dc8be8993d2982181f - pristine_git_object: 4c593aa7680dac5f237b405d7eaa21c3e1e7706b + last_write_checksum: sha1:78a1ed27ae55ac9b6e6926e2587adeda0de65aa3 + pristine_git_object: 7f19e372b77803949f2afb8dd86b4794556e9c7e docs/sdks/byok/README.md: id: 511ba2ae7a1b last_write_checksum: sha1:ef72e4c9cae06d60f4c2f2ad0578747d39e1d5ef pristine_git_object: a6f5335576f02b6108482dcd54e066b34a7c586f docs/sdks/chat/README.md: id: 393193527c2c - last_write_checksum: sha1:ee1db1ffd0e27ed3b8730031bd4359e0ada7dabd - pristine_git_object: 6ef196052d45156ac3427e72889d5fcd4b246e28 + last_write_checksum: sha1:0b40d973610ed193d6faafc7f4f0bfad06c78225 + pristine_git_object: 08b736f0782487ac73f87d4f008079ebc00eab48 docs/sdks/credits/README.md: id: 81608135c0ff last_write_checksum: sha1:abca02bc25760be47f80100a7cce6bb711202aef pristine_git_object: 1837ff59343eb87482e8750c1fb5d2b5f89aae6a docs/sdks/datasets/README.md: id: deb5d90f4faf - last_write_checksum: sha1:c09c0c118def84591a90132f77b67f40ae9e3d1e - pristine_git_object: afcf796dfd4d793bbfe7bcd3bdd81e5fe908de94 + last_write_checksum: sha1:64f1656c701995a43548ea77c1f8aeb3242f3f19 + pristine_git_object: a98669eccd83210072996e7c2785abfce08b2cb9 docs/sdks/embeddings/README.md: id: 15b5b04486c1 last_write_checksum: sha1:c2ed15521af31873f56e7813292aa30c5adf94e4 @@ -5692,12 +5772,12 @@ trackedFiles: pristine_git_object: 427dac57b47fbb136a16eb1ab7732c1ff61d7c2e docs/sdks/models/README.md: id: b35bdf4bc7ed - last_write_checksum: sha1:5e810aa08ca47adf984749b54820797f11905d98 - pristine_git_object: 4875c608ca2e0c3d598daf9eeaeda610fc587b75 + last_write_checksum: sha1:8c060786a4190f461dbf8f69df7d89a42cbc3bd1 + pristine_git_object: 0f18358593f06721308bfc7d3a258fb5c0ab6f5d docs/sdks/oauth/README.md: id: 80ad2c1a7b62 - last_write_checksum: sha1:bec31275e907bdf1f888ad7e2a6af916b84d5103 - pristine_git_object: 562e2e83f65a925b834b591ede742db3050d3cce + last_write_checksum: sha1:fa2f5ff922871256afcaccb054fbaf2882cc6b92 + pristine_git_object: f093aec0f2faaa1bcede7a60f50fe45832f2c153 docs/sdks/observability/README.md: id: bab967736831 last_write_checksum: sha1:88065c2ad18b9ab74228a89bac655b05dbc11991 @@ -5708,8 +5788,8 @@ trackedFiles: pristine_git_object: 867781001d3d7c6e755bcd3024268d831d154732 docs/sdks/presets/README.md: id: ead9668ae1dd - last_write_checksum: sha1:94365626300b73b78ac9cdfcac1e85833a862fc9 - pristine_git_object: 8ec4f55c51a6b59577b683323276d1ffdd824c63 + last_write_checksum: sha1:340a33451b0f832a07ed068df7ce71707e80484d + pristine_git_object: f31181e6253ccc15aaf6edf21fb489e49a0ec9ce docs/sdks/providers/README.md: id: b02aa45c0093 last_write_checksum: sha1:576c938477d66de01f39db88b50caea41a6812d3 @@ -5744,8 +5824,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:62d35f2ecbe840540100da937920ee63980a1e12 - pristine_git_object: 9e4606d0c68e092819b9d86eb23859bd85c5ede7 + last_write_checksum: sha1:037dc75ed3b298623d12c2a31e0451768600a3c9 + pristine_git_object: dfda0a9b514520b0f4f1e5fe687460a77b09c0c6 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -5772,8 +5852,8 @@ trackedFiles: pristine_git_object: 07ace03229fd3267623c8f48665d2c3a67c3565d src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:dd226a1c87253767a3a41d735f600db8980faa45 - pristine_git_object: fcebde34f88b9450f406b1563d00942dbd6d7b80 + last_write_checksum: sha1:dfbe860f829385a6e7f2dee66fa4f8ee650d8fad + pristine_git_object: 603bda23e3174c8430781ddf6fbd35e4e0717a42 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:6d47d1ab3da9cb4ac9f0a2bfe442f1a82a614f35 @@ -5792,20 +5872,24 @@ trackedFiles: pristine_git_object: 9c02cc64163adf027507af763e7b612d3b704adb src/openrouter/beta_analytics.py: id: 81988b170188 - last_write_checksum: sha1:289c9aad2d6787aabc6fa84952748de6189f7180 - pristine_git_object: 6c56ac11235d3ba9752ccc75299be655a9678ef5 + last_write_checksum: sha1:56eec7f30bf7d6cce1548863eae879b339b2a76b + pristine_git_object: 9db10e868aa38e1c38036d55416f7bb39c71bc0d src/openrouter/byok.py: id: bec352462ae1 last_write_checksum: sha1:2508c32fac403ebb6dbd65eab53601d88039fbc0 pristine_git_object: 9c2b675374900474076991a713a40ad119ee8b17 src/openrouter/chat.py: id: 723fdce15c1d - last_write_checksum: sha1:134121bd2f0c3e5e928ac783c705ce3ba7377ee6 - pristine_git_object: 3b47457b9e9bb17942a99aa1ae297195ab62aa39 + last_write_checksum: sha1:045ca733908a82e099a0c2a76c6c498025827391 + pristine_git_object: a1894915bd32aee65f019885634eb7908970a046 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:ed8fa9af5ffd2d90eb89d0acba5ebf9a774b89f8 - pristine_git_object: ebf1361a13695019951e306d9dce69367a3a62f8 + last_write_checksum: sha1:4e578170a2423dc538d7036f72127a523ba8b043 + pristine_git_object: 756b7b6ca269fde45922fa6ef8bd5ee585ad83a2 + src/openrouter/components/aabenchmarkentry.py: + id: e2e0f0b48c82 + last_write_checksum: sha1:1b6b66672fb80dccdc39843a98bdef6d7d804364 + pristine_git_object: dcf36134b499bea29d47a0aa4df1eb2963955f75 src/openrouter/components/activityitem.py: id: 3bbe7d35f459 last_write_checksum: sha1:32b873ba5c0a9dbf5f0cf32c0217ce17395ae69e @@ -6034,6 +6118,22 @@ 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/benchmarksdaitem.py: + id: 575945def054 + last_write_checksum: sha1:7cd6079757b7be8f6e3add94eb05d68cf7c73bc4 + pristine_git_object: 7713e2e8acdc2a75742873408b2238c163acba91 + src/openrouter/components/benchmarksdameta.py: + id: dd1d01a44665 + last_write_checksum: sha1:c2df3409cdeeee830cf32b44cfe3d7e2e0e1dd27 + pristine_git_object: 6d0179ccf340757a2f98af26eb29beaa721756f8 + 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 @@ -6188,8 +6288,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:b1b13e3f1cfe602fa882a746270ad3fd3cf0020c - pristine_git_object: 97f89d96cc2b0c370e64317c3cf1b7d102e81d69 + last_write_checksum: sha1:65012c617dd06019eb4bf62d04c434ebfb23adcc + pristine_git_object: f90c290577966b6fc85afaf1634b2413b02661b6 src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:b44dc25412b1206cc188d9516191a273d0f3e4dc @@ -6418,6 +6518,10 @@ trackedFiles: id: 533940b12cd2 last_write_checksum: sha1:9702dd53b6f12e5fbc9b6d8d8b19fbaa4cb712a1 pristine_git_object: c8201422a35e2c12c9e4321c3622f95f76a3234a + src/openrouter/components/dabenchmarkentry.py: + id: 5f5745cbfe75 + last_write_checksum: sha1:4416b41c6ca98d790893113ed5f6c3e0157e74dd + pristine_git_object: 35a1a90cf109062a379cead396c3d7b94cc7f810 src/openrouter/components/datetimeservertool.py: id: 444350bd66f4 last_write_checksum: sha1:ce9c7aba930c6a8764ca762052912d6533ccf53a @@ -6798,6 +6902,10 @@ trackedFiles: id: e36ad7b5263e last_write_checksum: sha1:4aeab70302022153c511d68625d64d91d699fd3d pristine_git_object: d52ac13f673f5998b315547f515aac509ff7157a + src/openrouter/components/messagesfallbackparam.py: + id: 53ba6717a4cc + last_write_checksum: sha1:8652a951a6b53396444aa1d5202736cf4f96143b + pristine_git_object: 05b041967edf0ab2d8458f9f0fc3577f0a55fcfc src/openrouter/components/messagesmessageparam.py: id: ed8bbab6720d last_write_checksum: sha1:0f53182e86a40e39319eba4da2cbfc14cbd97a3e @@ -6808,20 +6916,24 @@ trackedFiles: pristine_git_object: a5410bd961e2ce450b97e6a5702a336731b2e0ab src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:66dafe0b56379f70dd281f374e940f92dbfb225f - pristine_git_object: fc1f1dbb56c1de4cfd5d28058201ca5309a0e3cb + last_write_checksum: sha1:a03c557fca983279521c04f710310f09195a5d6f + pristine_git_object: 2f93bcfcd69ae20ca260631e4d218db6f5b5ee8f src/openrouter/components/metadatalevel.py: id: 0eede47eef62 last_write_checksum: sha1:b4e7e6fc4e9016b65008e9ebbfcc6f018fe89ced pristine_git_object: 1257b38d2001f34078cd1b052c20264e81a95e57 src/openrouter/components/model.py: id: cef3adaa772b - last_write_checksum: sha1:091b93cae931939e83e2fdcbf86f72ff36e9344a - pristine_git_object: 53fc43004c15681897f637536c1f8a023bee953c + last_write_checksum: sha1:53eb4a044a7bf546225416bb08597df46a3b60a2 + pristine_git_object: 637b3fbe54ddcc454750d8de702045ee690c3333 src/openrouter/components/modelarchitecture.py: id: b37ac27e512b last_write_checksum: sha1:e1dd41aa140b2ca2c3bbf15abf74e034d42b0166 pristine_git_object: 2da26c7abc1b7e2b895a056c72d90bf8c8efa6b4 + src/openrouter/components/modelbenchmarks.py: + id: efd0b01b6775 + last_write_checksum: sha1:c3b59fc04f0b3852bc525ad281c50b694e989738 + pristine_git_object: 1ec0c428b550d9248a0bcc9b05fcf2b2b368220d src/openrouter/components/modelgroup.py: id: ffb5492b0d39 last_write_checksum: sha1:75da0e0a977d4fd2908506683548c7a8c878b869 @@ -6830,6 +6942,10 @@ trackedFiles: id: b8759a1a4787 last_write_checksum: sha1:69b2c991666848f4790e5136c67553733cc68a54 pristine_git_object: c197cb2c527296adff2c3cfd9e49bcbc48087ce7 + src/openrouter/components/modelresponse.py: + id: 023136e6dedf + last_write_checksum: sha1:af84587984cbe6341f59f176b08df43096ac48c6 + pristine_git_object: 567bdc9a4181271486d015c3f9be12e33b51d12a src/openrouter/components/modelscountresponse.py: id: c08f960ac611 last_write_checksum: sha1:82669f5aa9379f6c90393ea0b78f2bafdce545df @@ -7252,8 +7368,8 @@ trackedFiles: pristine_git_object: 7325fa4619692b4c395e6b6d068519bd37d4b063 src/openrouter/components/rankingsdailymeta.py: id: 067dec7d316a - last_write_checksum: sha1:56d4331dc516624c2c7084c26b5043b0a0458a57 - pristine_git_object: df1ae5d889c2b8d5608964f9da92be651be6cb67 + last_write_checksum: sha1:2993b72319acc7dd79ae670539ce5dcea3dd9353 + pristine_git_object: 956291592f17cfd10c446185349d81711cdb1384 src/openrouter/components/rankingsdailyresponse.py: id: dcdb3308ad5d last_write_checksum: sha1:e7c0e4a022ad6aedd4ed21bbc0eb0160b1dae70a @@ -7700,8 +7816,8 @@ trackedFiles: pristine_git_object: 0a376fb8ee2df0be8546458e0008a2fbc0fd492a src/openrouter/datasets.py: id: 2378f80d1d6a - last_write_checksum: sha1:057b0dde4e051f2cf5cd9fd5b82bbe45eb8fafc5 - pristine_git_object: c483912549b3243f73b300bcea343914e66ef211 + last_write_checksum: sha1:d49731478f07f8ac96b6b378c5c9602b849ab9ca + pristine_git_object: 8f426301e08ef2f444e40bd63838b92dc00c7d7c src/openrouter/embeddings.py: id: 0374ace39067 last_write_checksum: sha1:8622e7717ef639f2ee452d295c4b2c957a2fe13f @@ -7816,20 +7932,20 @@ trackedFiles: pristine_git_object: 701741bbf61e70c9dd84199249f2aa1192c30a18 src/openrouter/models_.py: id: 4e1ae1fe5b98 - last_write_checksum: sha1:ef0acdf22acb146b77781d968cc2cd366a507831 - pristine_git_object: b1f9143134e2e282d5beedd6ceb79c3dd68ceeb5 + last_write_checksum: sha1:360796739e9e9af38b658940c062a422613e1f4b + pristine_git_object: 7ac4bd102217f6e152b809937fc60ac21d13071e src/openrouter/oauth.py: id: 1948ce27255b - last_write_checksum: sha1:e847767a0718afa3d0cac8a3d0735d95e6892265 - pristine_git_object: ef6eb9aa10d9b067d96dad78a1d34f939c1091e8 + last_write_checksum: sha1:6e9e90e8807d1b654b5a4699319953795c357286 + pristine_git_object: ed47357b58ded880697a6529b9a2f94bf74dcdea src/openrouter/observability.py: id: 6a17f32d3f33 last_write_checksum: sha1:1e31c36f61ec2a2c224c6ad0b0f5b2a09e758a3b pristine_git_object: 37ee42a638f5fce69fc7db1e6b86efb51f381582 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:cd29da201ac98881ca09ef4a62294d6802396c6d - pristine_git_object: 7c6acb80d98f0a89d7c63848e52a29a00e097d59 + last_write_checksum: sha1:be2ff42a9f0b3c15038919bce8a0917c54382bde + pristine_git_object: ef9b98cac2a75e6e52b701328f0530247dc031d3 src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:2b9c73dd8a24d6c479d50118a309e4e0969ca7ea @@ -7864,8 +7980,8 @@ trackedFiles: pristine_git_object: 01441144f8433569cb0846df23bbafc9b790a1de src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 - last_write_checksum: sha1:de809cb9a55efb7b22d033bace50344bf53696f4 - pristine_git_object: d3ef6c4b8374be3dfa5d807f879a430e50dc444e + last_write_checksum: sha1:9162280af6ebdf60cc09909970048f6afbff183b + pristine_git_object: d4c074daee85dba4a43fd8d293859c29df7e3321 src/openrouter/operations/createbyokkey.py: id: eaeefa9fe0c2 last_write_checksum: sha1:856828a03093b93a93edcc907531057f473e3447 @@ -7946,6 +8062,10 @@ trackedFiles: id: 5ffd23dafcc1 last_write_checksum: sha1:c9011252cc7862d8c35b4ff2f3c82003c98953de pristine_git_object: d19ef64ed4dcc19027c95ba19c9b37ed301ebb72 + src/openrouter/operations/getbenchmarksdesignarena.py: + id: b05492401be4 + last_write_checksum: sha1:fa36e7a28e19c67d8b72060ce85fa6c83e3b7ca9 + pristine_git_object: 2ac2aed2e814ba1a8dc6ad49d05ae582a42f149d src/openrouter/operations/getbyokkey.py: id: d141452bd88a last_write_checksum: sha1:16c33afc84cd0d3a68e977e739a59d14dfd3bd44 @@ -7970,6 +8090,10 @@ trackedFiles: id: d9769da90865 last_write_checksum: sha1:511b994a0bd1241856b06184f05433bec3a16733 pristine_git_object: d2370a94a10fadec861d31e6fd1a9b2566e94d22 + src/openrouter/operations/getmodel.py: + id: 90c926cd726f + last_write_checksum: sha1:f09d4d15678f12e6110cad664349f392f3ef9ff2 + pristine_git_object: e45056283604220d3395365bedfbaa1d1df13095 src/openrouter/operations/getmodels.py: id: 5bd5dfcb0125 last_write_checksum: sha1:77daf349415cd86fce63b94fbee5344850b01c79 @@ -8088,8 +8212,8 @@ trackedFiles: pristine_git_object: 236dc188826db184deca4a749dab47e58c3dd637 src/openrouter/operations/queryanalytics.py: id: d76c63ff66f6 - last_write_checksum: sha1:3e1f7dffb9441705fcbe353ee1e1a46d3ca02b8f - pristine_git_object: fe4a010c49d57a5de816988706b10ea31bb935ef + last_write_checksum: sha1:e05ee800c16323bc17ac79f06977144990ec0b17 + pristine_git_object: 698b5f7c4639bd7309a3d2ad4fd8cf5c31b717bf src/openrouter/operations/sendchatcompletionrequest.py: id: d9fee71bb577 last_write_checksum: sha1:130a25fdb3f44490b68ca99153c0cccba25db87e @@ -8120,8 +8244,8 @@ trackedFiles: pristine_git_object: ad2e7f86b6138cf2b2137345155e2b3a5784fb46 src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:13029d26c65600f4b0198f294bdccd29fb71d7b3 - pristine_git_object: ab9e6ba6afa040493f70c882b152a994d1eee7d1 + last_write_checksum: sha1:e8ce79b2a8f66c69a5b4ae926cc57d7751044f3b + pristine_git_object: ae12a80da2520719fd06717796b8b8cc4a7d9354 src/openrouter/providers.py: id: debc4c48f149 last_write_checksum: sha1:f39f155f26e6f5e4fb5b7e0f577a8c49536f6bb3 @@ -9410,5 +9534,44 @@ examples: application/json: {"error": {"code": 404, "message": "Resource not found"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getBenchmarksDesignArena: + speakeasy-default-get-benchmarks-design-arena: + parameters: + query: + arena: "models" + max_results: 20 + responses: + "200": + application/json: {"data": [{"arena": "models", "avg_generation_time_ms": 3200, "category": "codecategories", "display_name": "Claude Sonnet 4", "elo": 1423, "model_permaslug": "anthropic/claude-sonnet-4", "pricing": {"completion": "0.000015", "prompt": "0.000003"}, "tournament_stats": {"first_place": 12, "fourth_place": 2, "second_place": 8, "third_place": 5, "total": 27}, "win_rate": 72}], "meta": {"arena": "models", "as_of": "2026-06-03T12:00:00Z", "category": null, "citation": "Source: Design Arena (www.designarena.ai) via OpenRouter (openrouter.ai/rankings).", "elo_bounds": {"max": 1600, "min": 900}, "model_count": 1, "source": "design-arena", "source_url": "https://www.designarena.ai", "version": "v1"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getModel: + speakeasy-default-get-model: + parameters: + path: + author: "openai" + slug: "gpt-4" + responses: + "200": + application/json: {"data": {"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": {}, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-5.4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens"], "supported_voices": null, "top_provider": {"is_moderated": true}}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request` **Changed** **Breaking** :warning:\n * `response` **Changed**\n * `error` **Changed**\n* `open_router.video_generation.generate()`: \n * `request` **Changed** **Breaking** :warning:\n * `error.openrouter_metadata` **Added**\n* `open_router.beta.responses.send()`: \n * `request` **Changed** **Breaking** :warning:\n * `response` **Changed** **Breaking** :warning:\n * `error` **Changed**\n* `open_router.rerank.rerank()`: \n * `request.documents.[]` **Changed** **Breaking** :warning:\n * `response.results.[].document` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.generations.get_generation()`: \n * `response.data` **Changed** **Breaking** :warning:\n * `error.openrouter_metadata` **Added**\n* `open_router.o_auth.create_auth_code()`: `error.openrouter_metadata` **Added**\n* `open_router.endpoints.list()`: `error.openrouter_metadata` **Added**\n* `open_router.embeddings.list_models()`: \n * `response.data.[].supported_voices` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.byok.update()`: **Added**\n* `open_router.datasets.get_app_rankings()`: **Added**\n* `open_router.datasets.get_rankings_daily()`: **Added**\n* `open_router.generations.list_generation_content()`: **Added**\n* `open_router.observability.list()`: **Added**\n* `open_router.observability.create()`: **Added**\n* `open_router.observability.delete()`: **Added**\n* `open_router.observability.get()`: **Added**\n* `open_router.observability.update()`: **Added**\n* `open_router.presets.list()`: **Added**\n* `open_router.presets.get()`: **Added**\n* `open_router.presets.create_presets_chat_completions()`: **Added**\n* `open_router.presets.create_presets_messages()`: **Added**\n* `open_router.presets.create_presets_responses()`: **Added**\n* `open_router.presets.list_versions()`: **Added**\n* `open_router.presets.get_version()`: **Added**\n* `open_router.workspaces.list()`: **Added**\n* `open_router.workspaces.create()`: **Added**\n* `open_router.workspaces.delete()`: **Added**\n* `open_router.workspaces.get()`: **Added**\n* `open_router.workspaces.update()`: **Added**\n* `open_router.workspaces.bulk_add_members()`: **Added**\n* `open_router.workspaces.bulk_remove_members()`: **Added**\n* `open_router.analytics.get_user_activity()`: `error.openrouter_metadata` **Added**\n* `open_router.o_auth.exchange_auth_code_for_api_key()`: `error.openrouter_metadata` **Added**\n* `open_router.beta.analytics.get_analytics_meta()`: **Added**\n* `open_router.byok.create()`: **Added**\n* `open_router.credits.get_credits()`: `error.openrouter_metadata` **Added**\n* `open_router.embeddings.generate()`: \n * `request.input.[array].[].content.[]` **Changed**\n * `response.usage.prompt_tokens_details` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.byok.get()`: **Added**\n* `open_router.byok.delete()`: **Added**\n* `open_router.guardrails.list_guardrail_key_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.byok.list()`: **Added**\n* `open_router.guardrails.list()`: \n * `request.workspace_id` **Added**\n * `response.data.[]` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.guardrails.create()`: \n * `request` **Changed**\n * `response.data` **Changed**\n * `error` **Changed**\n* `open_router.guardrails.delete()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.get()`: \n * `response.data` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.guardrails.update()`: \n * `request` **Changed**\n * `response.data` **Changed**\n * `error.openrouter_metadata` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_assign_keys()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_unassign_keys()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.list_guardrail_member_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_assign_members()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.bulk_unassign_members()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.list_key_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.guardrails.list_member_assignments()`: `error.openrouter_metadata` **Added**\n* `open_router.api_keys.get_current_key_metadata()`: `error.openrouter_metadata` **Added**\n* `open_router.api_keys.list()`: \n * `request.workspace_id` **Added**\n * `response.data.[].workspace_id` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.api_keys.create()`: \n * `request.workspace_id` **Added**\n * `response.data.workspace_id` **Added**\n * `error` **Changed**\n* `open_router.api_keys.delete()`: `error.openrouter_metadata` **Added**\n* `open_router.api_keys.get()`: \n * `response.data.workspace_id` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.api_keys.update()`: \n * `response.data.workspace_id` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.models.list()`: \n * `request.sort` **Added**\n * `response.data.[].supported_voices` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.models.count()`: `error.openrouter_metadata` **Added**\n* `open_router.models.list_for_user()`: \n * `response.data.[].supported_voices` **Added**\n * `error.openrouter_metadata` **Added**\n* `open_router.organization.list_members()`: `error.openrouter_metadata` **Added**\n* `open_router.providers.list()`: `error.openrouter_metadata` **Added**\n* `open_router.stt.create_transcription()`: **Added**\n* `open_router.tts.create_speech()`: **Added**\n* `open_router.beta.analytics.query_analytics()`: **Added**\n* `open_router.video_generation.get_generation()`: `error.openrouter_metadata` **Added**\n* `open_router.video_generation.get_video_content()`: `error.openrouter_metadata` **Added**\n* `open_router.video_generation.list_videos_models()`: `error.openrouter_metadata` **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.datasets.get_benchmarks_design_arena()`: **Added** + * `open_router.models.get()`: **Added** + * `open_router.chat.send()`: `request` **Changed** + * `open_router.embeddings.list_models()`: `response.data.[].benchmarks` **Added** + * `open_router.models.list()`: `response.data.[].benchmarks` **Added** + * `open_router.models.list_for_user()`: `response.data.[].benchmarks` **Added** + * `open_router.presets.create_presets_chat_completions()`: `request` **Changed** + * `open_router.presets.create_presets_messages()`: `request.fallbacks` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index a104a8b..6ed7b1c 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.9.2 + version: 0.9.3 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index c34dd86..9a8b15b 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -23,6 +23,36 @@ components: description: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. schemas: + AABenchmarkEntry: + description: Artificial Analysis benchmark index scores. + example: + agentic_index: 55.8 + coding_index: 63.2 + intelligence_index: 71.4 + properties: + agentic_index: + description: Artificial Analysis Agentic Index score + example: 55.8 + format: double + nullable: true + type: number + coding_index: + description: Artificial Analysis Coding Index score + example: 63.2 + format: double + nullable: true + type: number + intelligence_index: + description: Artificial Analysis Intelligence Index score + example: 71.4 + format: double + nullable: true + type: number + required: + - intelligence_index + - coding_index + - agentic_index + type: object ActivityItem: example: byok_usage_inference: 0.012 @@ -1210,6 +1240,8 @@ components: allOf: - $ref: '#/components/schemas/AnthropicBaseUsageIteration' - properties: + model: + type: string type: enum: - message @@ -3598,6 +3630,230 @@ 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 + 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 @@ -4624,6 +4880,13 @@ components: session_id: session-456 user_id: user-123 type: object + min_p: + description: >- + Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. + example: 0.1 + format: double + nullable: true + type: number modalities: description: Output modalities for the response. Supported values are "text", "image", and "audio". example: @@ -4704,6 +4967,28 @@ components: summary: $ref: '#/components/schemas/ChatReasoningSummaryVerbosityEnum' type: object + reasoning_effort: + description: >- + Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + enum: + - xhigh + - high + - medium + - low + - minimal + - none + - null + example: medium + nullable: true + type: string + x-speakeasy-unknown-values: allow + repetition_penalty: + description: >- + Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. + example: 1 + format: double + nullable: true + type: number response_format: description: Response format configuration discriminator: @@ -4785,6 +5070,19 @@ components: items: $ref: '#/components/schemas/ChatFunctionTool' type: array + top_a: + description: >- + Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter. + example: 0 + format: double + nullable: true + type: number + top_k: + description: >- + Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. + example: 40 + nullable: true + type: integer top_logprobs: description: Number of top log probabilities to return (0-20) example: 5 @@ -6710,6 +7008,44 @@ components: id: ctco-abc123 output: patch applied successfully type: custom_tool_call_output + DABenchmarkEntry: + description: A single Design Arena benchmark entry for a specific arena+category + example: + arena: models + category: website + elo: 1385.2 + rank: 5 + win_rate: 62.5 + properties: + arena: + description: Arena type (e.g. models, builders, agents) + example: models + type: string + category: + description: Category within the arena (e.g. website, gamedev, uicomponent) + example: website + type: string + elo: + description: ELO rating from head-to-head arena battles + example: 1385.2 + format: double + type: number + rank: + description: Rank position within this arena+category among models available on OpenRouter (1 = highest ELO) + example: 5 + type: integer + win_rate: + description: Win rate percentage in arena battles + example: 62.5 + format: double + type: number + required: + - arena + - category + - elo + - win_rate + - rank + type: object DatetimeServerTool: description: 'OpenRouter built-in server tool: returns the current date and time' example: @@ -10465,6 +10801,19 @@ components: - type - error type: object + MessagesFallbackParam: + additionalProperties: + nullable: true + description: >- + Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected. + example: + model: claude-opus-4-8 + properties: + model: + type: string + required: + - model + type: object MessagesMessageParam: description: Anthropic message with OpenRouter extensions example: @@ -10810,6 +11159,15 @@ components: type: object type: array type: object + fallbacks: + description: >- + Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. + example: + - model: claude-opus-4-8 + items: + $ref: '#/components/schemas/MessagesFallbackParam' + nullable: true + type: array max_tokens: type: integer messages: @@ -11541,6 +11899,8 @@ components: properties: architecture: $ref: '#/components/schemas/ModelArchitecture' + benchmarks: + $ref: '#/components/schemas/ModelBenchmarks' canonical_slug: description: Canonical slug for the model example: openai/gpt-4 @@ -11681,6 +12041,34 @@ components: - input_modalities - output_modalities type: object + ModelBenchmarks: + description: Third-party benchmark rankings for this model. Omitted when no benchmark data is available. + example: + artificial_analysis: + agentic_index: 55.8 + coding_index: 63.2 + intelligence_index: 71.4 + design_arena: + - arena: models + category: website + elo: 1385.2 + rank: 5 + win_rate: 62.5 + properties: + artificial_analysis: + $ref: '#/components/schemas/AABenchmarkEntry' + design_arena: + description: Design Arena ELO rankings across arena+category pairs. + example: + - arena: models + category: website + elo: 1385.2 + rank: 5 + win_rate: 62.5 + items: + $ref: '#/components/schemas/DABenchmarkEntry' + type: array + type: object ModelGroup: description: Tokenizer type used by the model enum: @@ -11723,6 +12111,43 @@ components: description: Model to use for completion example: openai/gpt-4 type: string + ModelResponse: + description: Single model response + example: + data: + architecture: + input_modalities: + - text + instruct_type: chatml + modality: text->text + output_modalities: + - text + tokenizer: GPT + context_length: 8192 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + id: openai/gpt-4 + name: GPT-4 + per_request_limits: null + pricing: + completion: '0.00006' + image: '0' + prompt: '0.00003' + request: '0' + supported_parameters: + - temperature + - top_p + - max_tokens + top_provider: + context_length: 8192 + is_moderated: true + max_completion_tokens: 4096 + properties: + data: + $ref: '#/components/schemas/Model' + required: + - data + type: object ModelsCountResponse: description: Model count data example: @@ -21339,7 +21764,7 @@ paths: type: string group_limit: description: >- - Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. + Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. example: 100 type: integer limit: @@ -21889,7 +22314,7 @@ paths: properties: callback_url: description: >- - The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. example: https://myapp.com/auth/callback format: uri type: string @@ -23109,6 +23534,131 @@ paths: - $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: |- @@ -26838,6 +27388,92 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /model/{author}/{slug}: + get: + description: >- + Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + operationId: getModel + parameters: + - description: The author/organization of the model + in: path + name: author + required: true + schema: + description: The author/organization of the model + example: openai + type: string + - description: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + in: path + name: slug + required: true + schema: + description: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + example: gpt-4 + type: string + responses: + '200': + content: + application/json: + example: + data: + architecture: + input_modalities: + - text + instruct_type: chatml + modality: text->text + output_modalities: + - text + tokenizer: GPT + context_length: 8192 + created: 1692901234 + description: GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. + id: openai/gpt-4 + name: GPT-4 + per_request_limits: null + pricing: + completion: '0.00006' + image: '0' + prompt: '0.00003' + request: '0' + supported_parameters: + - temperature + - top_p + - max_tokens + top_provider: + context_length: 8192 + is_moderated: true + max_completion_tokens: 4096 + schema: + $ref: '#/components/schemas/ModelResponse' + description: Returns the model details + '404': + content: + application/json: + example: + error: + code: 404 + message: Resource not found + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist + '500': + content: + application/json: + example: + error: + code: 500 + message: Internal Server Error + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: Get a model by its slug + tags: + - Models + x-speakeasy-name-override: get + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /models: get: operationId: getModels diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8d478ad..7c59c5f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,20 +2,20 @@ speakeasyVersion: 1.680.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08108f43d4fba1406b4c8f624792054965c95a14819f442262663cb25ce6cc25 - sourceBlobDigest: sha256:47fc5915e6a9ff29fca019515d6491adce926407ebb47cee480feb77cfb68f03 + sourceRevisionDigest: sha256:0c057b11853d0279c97576805eb299291f6961c8357901f0be780ba8f13d3bfe + sourceBlobDigest: sha256:458e357a018f233258bafc1a3ee9aed70522c99e86f0b4ff8353b4678e378379 tags: - latest - - speakeasy-sdk-regen-1776991284 + - speakeasy-sdk-regen-1776818276 - 1.0.0 targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:08108f43d4fba1406b4c8f624792054965c95a14819f442262663cb25ce6cc25 - sourceBlobDigest: sha256:47fc5915e6a9ff29fca019515d6491adce926407ebb47cee480feb77cfb68f03 + sourceRevisionDigest: sha256:0c057b11853d0279c97576805eb299291f6961c8357901f0be780ba8f13d3bfe + sourceBlobDigest: sha256:458e357a018f233258bafc1a3ee9aed70522c99e86f0b4ff8353b4678e378379 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:3c7b0aef799130660fd4017ab9113e6fd3e06a80cff6a540043b9b34dc22facf + codeSamplesRevisionDigest: sha256:170a753766c0575b5ce980eb107591da5c5357c922d8bb11c795af947a193af4 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.680.0 diff --git a/RELEASES.md b/RELEASES.md index a5b6b37..82a22e7 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -18,4 +18,14 @@ Based on: ### Generated - [python v0.9.2] . ### Releases -- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - . \ No newline at end of file +- [PyPI v0.9.2] https://pypi.org/project/openrouter/0.9.2 - . + +## 2026-06-12 00:58:58 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.680.0 (2.788.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.9.3] . +### Releases +- [PyPI v0.9.3] https://pypi.org/project/openrouter/0.9.3 - . \ No newline at end of file diff --git a/docs/components/model.md b/docs/components/model.md index 55f6fe4..8ce3d9d 100644 --- a/docs/components/model.md +++ b/docs/components/model.md @@ -5,22 +5,23 @@ Information about an AI model available on OpenRouter ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `architecture` | [components.ModelArchitecture](../components/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {
"input_modalities": [
"text"
],
"instruct_type": "chatml",
"modality": "text-\u003etext",
"output_modalities": [
"text"
],
"tokenizer": "GPT"
} | -| `canonical_slug` | *str* | :heavy_check_mark: | Canonical slug for the model | openai/gpt-4 | -| `context_length` | *Nullable[int]* | :heavy_check_mark: | Maximum context length in tokens | 8192 | -| `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 | -| `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"temperature": 0.7,
"top_k": 0,
"top_p": 0.9
} | -| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. | -| `expiration_date` | *OptionalNullable[str]* | :heavy_minus_sign: | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 | -| `hugging_face_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Hugging Face model identifier, if applicable | microsoft/DialoGPT-medium | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 | -| `knowledge_cutoff` | *OptionalNullable[str]* | :heavy_minus_sign: | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 | -| `links` | [components.ModelLinks](../components/modellinks.md) | :heavy_check_mark: | Related API endpoints and resources for this model. | {
"details": "/api/v1/models/openai/gpt-5.4/endpoints"
} | -| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 | -| `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {
"completion_tokens": 1000,
"prompt_tokens": 1000
} | -| `pricing` | [components.PublicPricing](../components/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {
"completion": "0.00006",
"image": "0",
"prompt": "0.00003",
"request": "0"
} | -| `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | | -| `supported_voices` | List[*str*] | :heavy_check_mark: | List of supported voice identifiers for TTS models. Null for non-TTS models. | | -| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `architecture` | [components.ModelArchitecture](../components/modelarchitecture.md) | :heavy_check_mark: | Model architecture information | {
"input_modalities": [
"text"
],
"instruct_type": "chatml",
"modality": "text-\u003etext",
"output_modalities": [
"text"
],
"tokenizer": "GPT"
} | +| `benchmarks` | [Optional[components.ModelBenchmarks]](../components/modelbenchmarks.md) | :heavy_minus_sign: | Third-party benchmark rankings for this model. Omitted when no benchmark data is available. | {
"artificial_analysis": {
"agentic_index": 55.8,
"coding_index": 63.2,
"intelligence_index": 71.4
},
"design_arena": [
{
"arena": "models",
"category": "website",
"elo": 1385.2,
"rank": 5,
"win_rate": 62.5
}
]
} | +| `canonical_slug` | *str* | :heavy_check_mark: | Canonical slug for the model | openai/gpt-4 | +| `context_length` | *Nullable[int]* | :heavy_check_mark: | Maximum context length in tokens | 8192 | +| `created` | *int* | :heavy_check_mark: | Unix timestamp of when the model was created | 1692901234 | +| `default_parameters` | [Nullable[components.DefaultParameters]](../components/defaultparameters.md) | :heavy_check_mark: | Default parameters for this model | {
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"temperature": 0.7,
"top_k": 0,
"top_p": 0.9
} | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the model | GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy. | +| `expiration_date` | *OptionalNullable[str]* | :heavy_minus_sign: | The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration. | 2025-06-01 | +| `hugging_face_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Hugging Face model identifier, if applicable | microsoft/DialoGPT-medium | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the model | openai/gpt-4 | +| `knowledge_cutoff` | *OptionalNullable[str]* | :heavy_minus_sign: | The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown. | 2024-10-01 | +| `links` | [components.ModelLinks](../components/modellinks.md) | :heavy_check_mark: | Related API endpoints and resources for this model. | {
"details": "/api/v1/models/openai/gpt-5.4/endpoints"
} | +| `name` | *str* | :heavy_check_mark: | Display name of the model | GPT-4 | +| `per_request_limits` | [Nullable[components.PerRequestLimits]](../components/perrequestlimits.md) | :heavy_check_mark: | Per-request token limits | {
"completion_tokens": 1000,
"prompt_tokens": 1000
} | +| `pricing` | [components.PublicPricing](../components/publicpricing.md) | :heavy_check_mark: | Pricing information for the model | {
"completion": "0.00006",
"image": "0",
"prompt": "0.00003",
"request": "0"
} | +| `supported_parameters` | List[[components.Parameter](../components/parameter.md)] | :heavy_check_mark: | List of supported parameters for this model | | +| `supported_voices` | List[*str*] | :heavy_check_mark: | List of supported voice identifiers for TTS models. Null for non-TTS models. | | +| `top_provider` | [components.TopProviderInfo](../components/topproviderinfo.md) | :heavy_check_mark: | Information about the top provider for this model | {
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
} | \ No newline at end of file diff --git a/docs/operations/createauthkeyscoderequestbody.md b/docs/operations/createauthkeyscoderequestbody.md index 787c57a..cfb186b 100644 --- a/docs/operations/createauthkeyscoderequestbody.md +++ b/docs/operations/createauthkeyscoderequestbody.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | -| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | -| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | -| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | 2027-12-31T23:59:59Z | -| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | -| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | -| `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. | https://myapp.com/auth/callback | +| `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | +| `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | 2027-12-31T23:59:59Z | +| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | +| `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | +| `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | \ No newline at end of file diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index 6ef1960..08b736f 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -61,6 +61,7 @@ with OpenRouter( | `max_completion_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens in completion | 100 | | `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. | 100 | | `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | {
"session_id": "session-456",
"user_id": "user-123"
} | +| `min_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. | 0.1 | | `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text", "image", and "audio". | [
"text",
"image"
] | | `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | openai/gpt-4 | | `models` | List[*str*] | :heavy_minus_sign: | Models to use for completion | [
"openai/gpt-4",
"openai/gpt-4o"
] | @@ -69,6 +70,8 @@ with OpenRouter( | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | {
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.md) | :heavy_minus_sign: | Configuration options for reasoning models | {
"effort": "medium",
"summary": "concise"
} | +| `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../../components/chatrequestreasoningeffort.md) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | +| `repetition_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. | 1 | | `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | Response format configuration | {
"type": "json_object"
} | | `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | 42 | | `service_tier` | [OptionalNullable[components.ChatRequestServiceTier]](../../components/chatrequestservicetier.md) | :heavy_minus_sign: | The service tier to use for processing this request. | auto | @@ -80,6 +83,8 @@ with OpenRouter( | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | 0.7 | | `tool_choice` | [Optional[components.ChatToolChoice]](../../components/chattoolchoice.md) | :heavy_minus_sign: | Tool choice configuration | auto | | `tools` | List[[components.ChatFunctionTool](../../components/chatfunctiontool.md)] | :heavy_minus_sign: | Available tools for function calling | [
{
"function": {
"description": "Get weather",
"name": "get_weather"
},
"type": "function"
}
] | +| `top_a` | *OptionalNullable[float]* | :heavy_minus_sign: | Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter. | 0 | +| `top_k` | *OptionalNullable[int]* | :heavy_minus_sign: | Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. | 40 | | `top_logprobs` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | 5 | | `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | 1 | | `trace` | [Optional[components.TraceConfig]](../../components/traceconfig.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | {
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | diff --git a/docs/sdks/models/README.md b/docs/sdks/models/README.md index 4875c60..0f18358 100644 --- a/docs/sdks/models/README.md +++ b/docs/sdks/models/README.md @@ -6,10 +6,60 @@ Model information endpoints ### Available Operations +* [get](#get) - Get a model by its slug * [list](#list) - List all models and their properties * [count](#count) - Get total count of available models * [list_for_user](#list_for_user) - List models filtered by user provider preferences, privacy settings, and guardrails +## get + +Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + +### Example Usage + + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.models.get(author="openai", slug="gpt-4") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `author` | *str* | :heavy_check_mark: | The author/organization of the model | openai | +| `slug` | *str* | :heavy_check_mark: | The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) | gpt-4 | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ModelResponse](../../components/modelresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + ## list List all models and their properties diff --git a/docs/sdks/oauth/README.md b/docs/sdks/oauth/README.md index 562e2e8..f093aec 100644 --- a/docs/sdks/oauth/README.md +++ b/docs/sdks/oauth/README.md @@ -90,7 +90,7 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. | https://myapp.com/auth/callback | +| `callback_url` | *str* | :heavy_check_mark: | The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. | https://myapp.com/auth/callback | | `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | diff --git a/pyproject.toml b/pyproject.toml index 9e4606d..dfda0a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.9.2" +version = "0.9.3" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index fcebde3..603bda2 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.9.2" +__version__: str = "0.9.3" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.788.4" -__user_agent__: str = "speakeasy-sdk/python 0.9.2 2.788.4 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.9.3 2.788.4 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/beta_analytics.py b/src/openrouter/beta_analytics.py index 6c56ac1..9db10e8 100644 --- a/src/openrouter/beta_analytics.py +++ b/src/openrouter/beta_analytics.py @@ -302,7 +302,7 @@ def query_analytics( :param dimensions: :param filters: :param granularity: Time granularity - :param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. + :param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. :param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. :param order_by: :param time_range: @@ -480,7 +480,7 @@ async def query_analytics_async( :param dimensions: :param filters: :param granularity: Time granularity - :param group_limit: Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. + :param group_limit: Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified. :param limit: Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations. :param order_by: :param time_range: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index 3b47457..a189491 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -48,6 +48,7 @@ def send( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -70,6 +71,10 @@ def send( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -99,6 +104,8 @@ def send( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -132,6 +139,7 @@ def send( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -140,6 +148,8 @@ def send( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -151,6 +161,8 @@ def send( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -194,6 +206,7 @@ def send( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -216,6 +229,10 @@ def send( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -245,6 +262,8 @@ def send( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -278,6 +297,7 @@ def send( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -286,6 +306,8 @@ def send( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -297,6 +319,8 @@ def send( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -339,6 +363,7 @@ def send( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -361,6 +386,10 @@ def send( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -390,6 +419,8 @@ def send( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -423,6 +454,7 @@ def send( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -431,6 +463,8 @@ def send( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -442,6 +476,8 @@ def send( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -484,6 +520,7 @@ def send( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -498,6 +535,8 @@ def send( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -520,6 +559,8 @@ def send( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), @@ -764,6 +805,7 @@ async def send_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -786,6 +828,10 @@ async def send_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -815,6 +861,8 @@ async def send_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -848,6 +896,7 @@ async def send_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -856,6 +905,8 @@ async def send_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -867,6 +918,8 @@ async def send_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -910,6 +963,7 @@ async def send_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -932,6 +986,10 @@ async def send_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -961,6 +1019,8 @@ async def send_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -994,6 +1054,7 @@ async def send_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -1002,6 +1063,8 @@ async def send_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -1013,6 +1076,8 @@ async def send_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -1055,6 +1120,7 @@ async def send_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -1077,6 +1143,10 @@ async def send_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -1106,6 +1176,8 @@ async def send_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -1139,6 +1211,7 @@ async def send_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -1147,6 +1220,8 @@ async def send_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -1158,6 +1233,8 @@ async def send_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -1200,6 +1277,7 @@ async def send_async( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -1214,6 +1292,8 @@ async def send_async( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -1236,6 +1316,8 @@ async def send_async( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index ebf1361..756b7b6 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -6,6 +6,7 @@ import sys if TYPE_CHECKING: + from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict from .activityitem import ActivityItem, ActivityItemTypedDict from .activityresponse import ActivityResponse, ActivityResponseTypedDict from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict @@ -270,6 +271,26 @@ BashServerToolEnvironment, BashServerToolEnvironmentTypedDict, ) + from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict + from .benchmarksdaitem import ( + BenchmarksDAItem, + BenchmarksDAItemTypedDict, + TournamentStats, + TournamentStatsTypedDict, + ) + from .benchmarksdameta import ( + BenchmarksDAMeta, + BenchmarksDAMetaTypedDict, + BenchmarksDAMetaVersion, + EloBounds, + EloBoundsTypedDict, + SourceEnum, + SourceURL, + ) + from .benchmarksdaresponse import ( + BenchmarksDAResponse, + BenchmarksDAResponseTypedDict, + ) from .bulkaddworkspacemembersrequest import ( BulkAddWorkspaceMembersRequest, BulkAddWorkspaceMembersRequestTypedDict, @@ -434,6 +455,7 @@ ChatRequestPlugin, ChatRequestPluginTypedDict, ChatRequestReasoning, + ChatRequestReasoningEffort, ChatRequestReasoningTypedDict, ChatRequestServiceTier, ChatRequestTypedDict, @@ -727,6 +749,7 @@ CustomToolCallOutputItemTypeInputImage, CustomToolCallOutputItemTypedDict, ) + from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict from .datetimeservertool import ( DatetimeServerTool, DatetimeServerToolType, @@ -1218,6 +1241,10 @@ MessagesAdvisorToolResultBlockType, MessagesAdvisorToolResultBlockTypedDict, ) + from .messagesfallbackparam import ( + MessagesFallbackParam, + MessagesFallbackParamTypedDict, + ) from .messagesmessageparam import ( ContentCompaction, ContentCompactionTypedDict, @@ -1373,8 +1400,10 @@ ModelArchitectureInstructType, ModelArchitectureTypedDict, ) + from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modelgroup import ModelGroup from .modellinks import ModelLinks, ModelLinksTypedDict + from .modelresponse import ModelResponse, ModelResponseTypedDict from .modelscountresponse import ( ModelsCountResponse, ModelsCountResponseData, @@ -1973,7 +2002,7 @@ from .rankingsdailymeta import ( RankingsDailyMeta, RankingsDailyMetaTypedDict, - Version, + RankingsDailyMetaVersion, ) from .rankingsdailyresponse import ( RankingsDailyResponse, @@ -2427,6 +2456,8 @@ ) __all__ = [ + "AABenchmarkEntry", + "AABenchmarkEntryTypedDict", "APIType", "Action", "ActionEnum", @@ -2627,6 +2658,15 @@ "BashServerToolEnvironmentTypedDict", "BashServerToolType", "BashServerToolTypedDict", + "BenchmarkPricing", + "BenchmarkPricingTypedDict", + "BenchmarksDAItem", + "BenchmarksDAItemTypedDict", + "BenchmarksDAMeta", + "BenchmarksDAMetaTypedDict", + "BenchmarksDAMetaVersion", + "BenchmarksDAResponse", + "BenchmarksDAResponseTypedDict", "BulkAddWorkspaceMembersRequest", "BulkAddWorkspaceMembersRequestTypedDict", "BulkAddWorkspaceMembersResponse", @@ -2736,6 +2776,7 @@ "ChatRequestPlugin", "ChatRequestPluginTypedDict", "ChatRequestReasoning", + "ChatRequestReasoningEffort", "ChatRequestReasoningTypedDict", "ChatRequestServiceTier", "ChatRequestTypedDict", @@ -2945,6 +2986,8 @@ "CustomToolCallOutputItemTypedDict", "CustomToolTypeCustom", "CustomToolTypedDict", + "DABenchmarkEntry", + "DABenchmarkEntryTypedDict", "DataCollection", "DataRegion", "DatetimeServerTool", @@ -2994,6 +3037,8 @@ "EditCompact20260112TypedDict", "EditTypeInputTokens", "EditTypedDict", + "EloBounds", + "EloBoundsTypedDict", "EndpointInfo", "EndpointInfoTypedDict", "EndpointStatus", @@ -3331,6 +3376,8 @@ "MessagesAdvisorToolResultBlock", "MessagesAdvisorToolResultBlockType", "MessagesAdvisorToolResultBlockTypedDict", + "MessagesFallbackParam", + "MessagesFallbackParamTypedDict", "MessagesMessageParam", "MessagesMessageParamContentUnion1", "MessagesMessageParamContentUnion1TypedDict", @@ -3372,10 +3419,14 @@ "ModelArchitecture", "ModelArchitectureInstructType", "ModelArchitectureTypedDict", + "ModelBenchmarks", + "ModelBenchmarksTypedDict", "ModelEnum", "ModelGroup", "ModelLinks", "ModelLinksTypedDict", + "ModelResponse", + "ModelResponseTypedDict", "ModelTypedDict", "ModelsCountResponse", "ModelsCountResponseData", @@ -3808,6 +3859,7 @@ "RankingsDailyItemTypedDict", "RankingsDailyMeta", "RankingsDailyMetaTypedDict", + "RankingsDailyMetaVersion", "RankingsDailyResponse", "RankingsDailyResponseTypedDict", "Reason", @@ -3957,7 +4009,9 @@ "SortTypedDict", "SourceContent", "SourceContentTypedDict", + "SourceEnum", "SourceType", + "SourceURL", "SpeechRequest", "SpeechRequestProvider", "SpeechRequestProviderTypedDict", @@ -4066,6 +4120,8 @@ "ToolWebSearch20260209TypedDict", "TopProviderInfo", "TopProviderInfoTypedDict", + "TournamentStats", + "TournamentStatsTypedDict", "TraceConfig", "TraceConfigTypedDict", "Trigger", @@ -4144,7 +4200,6 @@ "Variables", "VariablesTypedDict", "Verbosity", - "Version", "VideoGenerationRequest", "VideoGenerationRequestProvider", "VideoGenerationRequestProviderTypedDict", @@ -4214,6 +4269,8 @@ ] _dynamic_imports: dict[str, str] = { + "AABenchmarkEntry": ".aabenchmarkentry", + "AABenchmarkEntryTypedDict": ".aabenchmarkentry", "ActivityItem": ".activityitem", "ActivityItemTypedDict": ".activityitem", "ActivityResponse": ".activityresponse", @@ -4396,6 +4453,21 @@ "BashServerToolEngine": ".bashservertoolengine", "BashServerToolEnvironment": ".bashservertoolenvironment", "BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment", + "BenchmarkPricing": ".benchmarkpricing", + "BenchmarkPricingTypedDict": ".benchmarkpricing", + "BenchmarksDAItem": ".benchmarksdaitem", + "BenchmarksDAItemTypedDict": ".benchmarksdaitem", + "TournamentStats": ".benchmarksdaitem", + "TournamentStatsTypedDict": ".benchmarksdaitem", + "BenchmarksDAMeta": ".benchmarksdameta", + "BenchmarksDAMetaTypedDict": ".benchmarksdameta", + "BenchmarksDAMetaVersion": ".benchmarksdameta", + "EloBounds": ".benchmarksdameta", + "EloBoundsTypedDict": ".benchmarksdameta", + "SourceEnum": ".benchmarksdameta", + "SourceURL": ".benchmarksdameta", + "BenchmarksDAResponse": ".benchmarksdaresponse", + "BenchmarksDAResponseTypedDict": ".benchmarksdaresponse", "BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest", "BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse", @@ -4507,6 +4579,7 @@ "ChatRequestPlugin": ".chatrequest", "ChatRequestPluginTypedDict": ".chatrequest", "ChatRequestReasoning": ".chatrequest", + "ChatRequestReasoningEffort": ".chatrequest", "ChatRequestReasoningTypedDict": ".chatrequest", "ChatRequestServiceTier": ".chatrequest", "ChatRequestTypedDict": ".chatrequest", @@ -4712,6 +4785,8 @@ "CustomToolCallOutputItemTypeCustomToolCallOutput": ".customtoolcalloutputitem", "CustomToolCallOutputItemTypeInputImage": ".customtoolcalloutputitem", "CustomToolCallOutputItemTypedDict": ".customtoolcalloutputitem", + "DABenchmarkEntry": ".dabenchmarkentry", + "DABenchmarkEntryTypedDict": ".dabenchmarkentry", "DatetimeServerTool": ".datetimeservertool", "DatetimeServerToolType": ".datetimeservertool", "DatetimeServerToolTypedDict": ".datetimeservertool", @@ -5091,6 +5166,8 @@ "MessagesAdvisorToolResultBlock": ".messagesadvisortoolresultblock", "MessagesAdvisorToolResultBlockType": ".messagesadvisortoolresultblock", "MessagesAdvisorToolResultBlockTypedDict": ".messagesadvisortoolresultblock", + "MessagesFallbackParam": ".messagesfallbackparam", + "MessagesFallbackParamTypedDict": ".messagesfallbackparam", "ContentCompaction": ".messagesmessageparam", "ContentCompactionTypedDict": ".messagesmessageparam", "ContentRedactedThinking": ".messagesmessageparam", @@ -5239,9 +5316,13 @@ "ModelArchitecture": ".modelarchitecture", "ModelArchitectureInstructType": ".modelarchitecture", "ModelArchitectureTypedDict": ".modelarchitecture", + "ModelBenchmarks": ".modelbenchmarks", + "ModelBenchmarksTypedDict": ".modelbenchmarks", "ModelGroup": ".modelgroup", "ModelLinks": ".modellinks", "ModelLinksTypedDict": ".modellinks", + "ModelResponse": ".modelresponse", + "ModelResponseTypedDict": ".modelresponse", "ModelsCountResponse": ".modelscountresponse", "ModelsCountResponseData": ".modelscountresponse", "ModelsCountResponseDataTypedDict": ".modelscountresponse", @@ -5690,7 +5771,7 @@ "RankingsDailyItemTypedDict": ".rankingsdailyitem", "RankingsDailyMeta": ".rankingsdailymeta", "RankingsDailyMetaTypedDict": ".rankingsdailymeta", - "Version": ".rankingsdailymeta", + "RankingsDailyMetaVersion": ".rankingsdailymeta", "RankingsDailyResponse": ".rankingsdailyresponse", "RankingsDailyResponseTypedDict": ".rankingsdailyresponse", "ReasoningConfig": ".reasoningconfig", diff --git a/src/openrouter/components/aabenchmarkentry.py b/src/openrouter/components/aabenchmarkentry.py new file mode 100644 index 0000000..dcf3613 --- /dev/null +++ b/src/openrouter/components/aabenchmarkentry.py @@ -0,0 +1,60 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing_extensions import TypedDict + + +class AABenchmarkEntryTypedDict(TypedDict): + r"""Artificial Analysis benchmark index scores.""" + + agentic_index: Nullable[float] + r"""Artificial Analysis Agentic Index score""" + coding_index: Nullable[float] + r"""Artificial Analysis Coding Index score""" + intelligence_index: Nullable[float] + r"""Artificial Analysis Intelligence Index score""" + + +class AABenchmarkEntry(BaseModel): + r"""Artificial Analysis benchmark index scores.""" + + agentic_index: Nullable[float] + r"""Artificial Analysis Agentic Index score""" + + coding_index: Nullable[float] + r"""Artificial Analysis Coding Index score""" + + intelligence_index: Nullable[float] + r"""Artificial Analysis Intelligence Index score""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["agentic_index", "coding_index", "intelligence_index"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/openrouter/components/benchmarkpricing.py b/src/openrouter/components/benchmarkpricing.py new file mode 100644 index 0000000..3524f78 --- /dev/null +++ b/src/openrouter/components/benchmarkpricing.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class BenchmarkPricingTypedDict(TypedDict): + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + completion: str + r"""Cost per output token (USD, decimal string).""" + prompt: str + r"""Cost per input token (USD, decimal string).""" + + +class BenchmarkPricing(BaseModel): + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + completion: str + r"""Cost per output token (USD, decimal string).""" + + prompt: str + r"""Cost per input token (USD, decimal string).""" diff --git a/src/openrouter/components/benchmarksdaitem.py b/src/openrouter/components/benchmarksdaitem.py new file mode 100644 index 0000000..7713e2e --- /dev/null +++ b/src/openrouter/components/benchmarksdaitem.py @@ -0,0 +1,147 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing_extensions import TypedDict + + +class TournamentStatsTypedDict(TypedDict): + r"""Placement distribution from tournament matches.""" + + first_place: Nullable[int] + fourth_place: Nullable[int] + second_place: Nullable[int] + third_place: Nullable[int] + total: Nullable[int] + + +class TournamentStats(BaseModel): + r"""Placement distribution from tournament matches.""" + + first_place: Nullable[int] + + fourth_place: Nullable[int] + + second_place: Nullable[int] + + third_place: Nullable[int] + + total: Nullable[int] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = [ + "first_place", + "fourth_place", + "second_place", + "third_place", + "total", + ] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +class BenchmarksDAItemTypedDict(TypedDict): + arena: str + r"""Arena this ranking belongs to.""" + avg_generation_time_ms: Nullable[float] + r"""Average generation time in milliseconds.""" + category: str + r"""Category within the arena.""" + display_name: str + r"""Human-readable model name from Design Arena.""" + elo: float + r"""ELO rating from head-to-head arena battles.""" + model_permaslug: str + r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models.""" + pricing: Nullable[BenchmarkPricingTypedDict] + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + tournament_stats: TournamentStatsTypedDict + r"""Placement distribution from tournament matches.""" + win_rate: float + r"""Win rate as a percentage (0–100).""" + + +class BenchmarksDAItem(BaseModel): + arena: str + r"""Arena this ranking belongs to.""" + + avg_generation_time_ms: Nullable[float] + r"""Average generation time in milliseconds.""" + + category: str + r"""Category within the arena.""" + + display_name: str + r"""Human-readable model name from Design Arena.""" + + elo: float + r"""ELO rating from head-to-head arena battles.""" + + model_permaslug: str + r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models.""" + + pricing: Nullable[BenchmarkPricing] + r"""OpenRouter pricing per token for this model. Null if pricing is unavailable.""" + + tournament_stats: TournamentStats + r"""Placement distribution from tournament matches.""" + + win_rate: float + r"""Win rate as a percentage (0–100).""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["avg_generation_time_ms", "pricing"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/openrouter/components/benchmarksdameta.py b/src/openrouter/components/benchmarksdameta.py new file mode 100644 index 0000000..6d0179c --- /dev/null +++ b/src/openrouter/components/benchmarksdameta.py @@ -0,0 +1,118 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal +from typing_extensions import TypedDict + + +class EloBoundsTypedDict(TypedDict): + r"""ELO range across all returned models for normalization.""" + + max: float + r"""Maximum ELO in the result set.""" + min: float + r"""Minimum ELO in the result set.""" + + +class EloBounds(BaseModel): + r"""ELO range across all returned models for normalization.""" + + max: float + r"""Maximum ELO in the result set.""" + + min: float + r"""Minimum ELO in the result set.""" + + +SourceEnum = Literal["design-arena",] +r"""Data source identifier.""" + + +SourceURL = 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: SourceEnum + r"""Data source identifier.""" + source_url: SourceURL + 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: SourceEnum + r"""Data source identifier.""" + + source_url: SourceURL + r"""URL of the upstream data source.""" + + version: BenchmarksDAMetaVersion + r"""Dataset version.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["category"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/openrouter/components/benchmarksdaresponse.py b/src/openrouter/components/benchmarksdaresponse.py new file mode 100644 index 0000000..7588fc5 --- /dev/null +++ b/src/openrouter/components/benchmarksdaresponse.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict +from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class BenchmarksDAResponseTypedDict(TypedDict): + data: List[BenchmarksDAItemTypedDict] + meta: BenchmarksDAMetaTypedDict + + +class BenchmarksDAResponse(BaseModel): + data: List[BenchmarksDAItem] + + meta: BenchmarksDAMeta diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index 97f89d9..f90c290 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -170,6 +170,20 @@ def serialize_model(self, handler): return m +ChatRequestReasoningEffort = Union[ + Literal[ + "xhigh", + "high", + "medium", + "low", + "minimal", + "none", + ], + UnrecognizedStr, +] +r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.""" + + ResponseFormatTypedDict = TypeAliasType( "ResponseFormatTypedDict", Union[ @@ -240,6 +254,8 @@ class ChatRequestTypedDict(TypedDict): r"""Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.""" metadata: NotRequired[Dict[str, str]] r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" + min_p: NotRequired[Nullable[float]] + r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.""" modalities: NotRequired[List[Modality]] r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\".""" model: NotRequired[str] @@ -256,6 +272,10 @@ class ChatRequestTypedDict(TypedDict): r"""When multiple model providers are available, optionally indicate your routing preference.""" reasoning: NotRequired[ChatRequestReasoningTypedDict] r"""Configuration options for reasoning models""" + reasoning_effort: NotRequired[Nullable[ChatRequestReasoningEffort]] + r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.""" + repetition_penalty: NotRequired[Nullable[float]] + r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.""" response_format: NotRequired[ResponseFormatTypedDict] r"""Response format configuration""" seed: NotRequired[Nullable[int]] @@ -278,6 +298,10 @@ class ChatRequestTypedDict(TypedDict): r"""Tool choice configuration""" tools: NotRequired[List[ChatFunctionToolTypedDict]] r"""Available tools for function calling""" + top_a: NotRequired[Nullable[float]] + r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.""" + top_k: NotRequired[Nullable[int]] + r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.""" top_logprobs: NotRequired[Nullable[int]] r"""Number of top log probabilities to return (0-20)""" top_p: NotRequired[Nullable[float]] @@ -321,6 +345,9 @@ class ChatRequest(BaseModel): metadata: Optional[Dict[str, str]] = None r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" + min_p: OptionalNullable[float] = UNSET + r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.""" + modalities: Optional[ List[Annotated[Modality, PlainValidator(validate_open_enum(False))]] ] = None @@ -347,6 +374,15 @@ class ChatRequest(BaseModel): reasoning: Optional[ChatRequestReasoning] = None r"""Configuration options for reasoning models""" + reasoning_effort: Annotated[ + OptionalNullable[ChatRequestReasoningEffort], + PlainValidator(validate_open_enum(False)), + ] = UNSET + r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.""" + + repetition_penalty: OptionalNullable[float] = UNSET + r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.""" + response_format: Optional[ResponseFormat] = None r"""Response format configuration""" @@ -383,6 +419,12 @@ class ChatRequest(BaseModel): tools: Optional[List[ChatFunctionTool]] = None r"""Available tools for function calling""" + top_a: OptionalNullable[float] = UNSET + r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter.""" + + top_k: OptionalNullable[int] = UNSET + r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.""" + top_logprobs: OptionalNullable[int] = UNSET r"""Number of top log probabilities to return (0-20)""" @@ -407,6 +449,7 @@ def serialize_model(self, handler): "max_completion_tokens", "max_tokens", "metadata", + "min_p", "modalities", "model", "models", @@ -415,6 +458,8 @@ def serialize_model(self, handler): "presence_penalty", "provider", "reasoning", + "reasoning_effort", + "repetition_penalty", "response_format", "seed", "service_tier", @@ -426,6 +471,8 @@ def serialize_model(self, handler): "temperature", "tool_choice", "tools", + "top_a", + "top_k", "top_logprobs", "top_p", "trace", @@ -437,14 +484,19 @@ def serialize_model(self, handler): "logprobs", "max_completion_tokens", "max_tokens", + "min_p", "parallel_tool_calls", "presence_penalty", "provider", + "reasoning_effort", + "repetition_penalty", "seed", "service_tier", "stop", "stream_options", "temperature", + "top_a", + "top_k", "top_logprobs", "top_p", ] diff --git a/src/openrouter/components/dabenchmarkentry.py b/src/openrouter/components/dabenchmarkentry.py new file mode 100644 index 0000000..35a1a90 --- /dev/null +++ b/src/openrouter/components/dabenchmarkentry.py @@ -0,0 +1,39 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class DABenchmarkEntryTypedDict(TypedDict): + r"""A single Design Arena benchmark entry for a specific arena+category""" + + arena: str + r"""Arena type (e.g. models, builders, agents)""" + category: str + r"""Category within the arena (e.g. website, gamedev, uicomponent)""" + elo: float + r"""ELO rating from head-to-head arena battles""" + rank: int + r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)""" + win_rate: float + r"""Win rate percentage in arena battles""" + + +class DABenchmarkEntry(BaseModel): + r"""A single Design Arena benchmark entry for a specific arena+category""" + + arena: str + r"""Arena type (e.g. models, builders, agents)""" + + category: str + r"""Category within the arena (e.g. website, gamedev, uicomponent)""" + + elo: float + r"""ELO rating from head-to-head arena battles""" + + rank: int + r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)""" + + win_rate: float + r"""Win rate percentage in arena battles""" diff --git a/src/openrouter/components/messagesfallbackparam.py b/src/openrouter/components/messagesfallbackparam.py new file mode 100644 index 0000000..05b0419 --- /dev/null +++ b/src/openrouter/components/messagesfallbackparam.py @@ -0,0 +1,33 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable +import pydantic +from pydantic import ConfigDict +from typing import Any, Dict +from typing_extensions import TypedDict + + +class MessagesFallbackParamTypedDict(TypedDict): + r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected.""" + + model: str + + +class MessagesFallbackParam(BaseModel): + r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + model: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index fc1f1db..2f93bcf 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -50,6 +50,7 @@ ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouterTypedDict, ) +from .messagesfallbackparam import MessagesFallbackParam, MessagesFallbackParamTypedDict from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict @@ -1046,6 +1047,8 @@ class MessagesRequestTypedDict(TypedDict): cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" context_management: NotRequired[Nullable[ContextManagementTypedDict]] + fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]] + r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" max_tokens: NotRequired[int] metadata: NotRequired[MetadataTypedDict] models: NotRequired[List[str]] @@ -1088,6 +1091,9 @@ class MessagesRequest(BaseModel): context_management: OptionalNullable[ContextManagement] = UNSET + fallbacks: OptionalNullable[List[MessagesFallbackParam]] = UNSET + r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" + max_tokens: Optional[int] = None metadata: Optional[Metadata] = None @@ -1144,6 +1150,7 @@ def serialize_model(self, handler): optional_fields = [ "cache_control", "context_management", + "fallbacks", "max_tokens", "metadata", "models", @@ -1166,7 +1173,13 @@ def serialize_model(self, handler): "trace", "user", ] - nullable_fields = ["context_management", "messages", "provider", "speed"] + nullable_fields = [ + "context_management", + "fallbacks", + "messages", + "provider", + "speed", + ] null_default_fields = [] serialized = handler(self) diff --git a/src/openrouter/components/model.py b/src/openrouter/components/model.py index 53fc430..637b3fb 100644 --- a/src/openrouter/components/model.py +++ b/src/openrouter/components/model.py @@ -3,6 +3,7 @@ from __future__ import annotations from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict +from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modellinks import ModelLinks, ModelLinksTypedDict from .parameter import Parameter from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict @@ -51,6 +52,8 @@ class ModelTypedDict(TypedDict): r"""List of supported voice identifiers for TTS models. Null for non-TTS models.""" top_provider: TopProviderInfoTypedDict r"""Information about the top provider for this model""" + benchmarks: NotRequired[ModelBenchmarksTypedDict] + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" description: NotRequired[str] r"""Description of the model""" expiration_date: NotRequired[Nullable[str]] @@ -105,6 +108,9 @@ class Model(BaseModel): top_provider: TopProviderInfo r"""Information about the top provider for this model""" + benchmarks: Optional[ModelBenchmarks] = None + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + description: Optional[str] = None r"""Description of the model""" @@ -120,6 +126,7 @@ class Model(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ + "benchmarks", "description", "expiration_date", "hugging_face_id", diff --git a/src/openrouter/components/modelbenchmarks.py b/src/openrouter/components/modelbenchmarks.py new file mode 100644 index 0000000..1ec0c42 --- /dev/null +++ b/src/openrouter/components/modelbenchmarks.py @@ -0,0 +1,27 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict +from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict +from openrouter.types import BaseModel +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class ModelBenchmarksTypedDict(TypedDict): + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + + artificial_analysis: NotRequired[AABenchmarkEntryTypedDict] + r"""Artificial Analysis benchmark index scores.""" + design_arena: NotRequired[List[DABenchmarkEntryTypedDict]] + r"""Design Arena ELO rankings across arena+category pairs.""" + + +class ModelBenchmarks(BaseModel): + r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available.""" + + artificial_analysis: Optional[AABenchmarkEntry] = None + r"""Artificial Analysis benchmark index scores.""" + + design_arena: Optional[List[DABenchmarkEntry]] = None + r"""Design Arena ELO rankings across arena+category pairs.""" diff --git a/src/openrouter/components/modelresponse.py b/src/openrouter/components/modelresponse.py new file mode 100644 index 0000000..567bdc9 --- /dev/null +++ b/src/openrouter/components/modelresponse.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .model import Model, ModelTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ModelResponseTypedDict(TypedDict): + r"""Single model response""" + + data: ModelTypedDict + r"""Information about an AI model available on OpenRouter""" + + +class ModelResponse(BaseModel): + r"""Single model response""" + + data: Model + r"""Information about an AI model available on OpenRouter""" diff --git a/src/openrouter/components/rankingsdailymeta.py b/src/openrouter/components/rankingsdailymeta.py index df1ae5d..9562915 100644 --- a/src/openrouter/components/rankingsdailymeta.py +++ b/src/openrouter/components/rankingsdailymeta.py @@ -6,7 +6,7 @@ from typing_extensions import TypedDict -Version = Literal["v1",] +RankingsDailyMetaVersion = Literal["v1",] r"""Dataset version. Field names and grain are stable for the life of `v1`.""" @@ -17,7 +17,7 @@ class RankingsDailyMetaTypedDict(TypedDict): r"""Resolved end of the date window (UTC, inclusive).""" start_date: str r"""Resolved start of the date window (UTC, inclusive).""" - version: Version + version: RankingsDailyMetaVersion r"""Dataset version. Field names and grain are stable for the life of `v1`.""" @@ -31,5 +31,5 @@ class RankingsDailyMeta(BaseModel): start_date: str r"""Resolved start of the date window (UTC, inclusive).""" - version: Version + version: RankingsDailyMetaVersion r"""Dataset version. Field names and grain are stable for the life of `v1`.""" diff --git a/src/openrouter/datasets.py b/src/openrouter/datasets.py index c483912..8f42630 100644 --- a/src/openrouter/datasets.py +++ b/src/openrouter/datasets.py @@ -426,6 +426,280 @@ async def empty_result(): 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/models_.py b/src/openrouter/models_.py index b1f9143..7ac4bd1 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -12,6 +12,254 @@ class Models(BaseSDK): r"""Model information endpoints""" + def get( + self, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelResponse: + r"""Get a model by its slug + + Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + + :param author: The author/organization of the model + :param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request( + method="GET", + path="/model/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModelGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getModel", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.ModelResponse, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_async( + self, + *, + author: str, + slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ModelResponse: + r"""Get a model by its slug + + Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases. + + :param author: The author/organization of the model + :param slug: The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free) + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetModelRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + author=author, + slug=slug, + ) + + req = self._build_request_async( + method="GET", + path="/model/{author}/{slug}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetModelGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getModel", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + ), + request=req, + error_status_codes=["404", "4XX", "500", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.ModelResponse, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + def list( self, *, diff --git a/src/openrouter/oauth.py b/src/openrouter/oauth.py index ef6eb9a..ed47357 100644 --- a/src/openrouter/oauth.py +++ b/src/openrouter/oauth.py @@ -327,7 +327,7 @@ def create_auth_code( Create an authorization code for the PKCE flow to generate a user-controlled API key - :param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + :param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. @@ -489,7 +489,7 @@ async def create_auth_code_async( Create an authorization code for the PKCE flow to generate a user-controlled API key - :param callback_url: The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed. + :param callback_url: The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools. :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 7c6acb8..ef9b98c 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -272,6 +272,13 @@ GetAppRankingsSort, Subcategory, ) + from .getbenchmarksdesignarena import ( + Arena, + GetBenchmarksDesignArenaGlobals, + GetBenchmarksDesignArenaGlobalsTypedDict, + GetBenchmarksDesignArenaRequest, + GetBenchmarksDesignArenaRequestTypedDict, + ) from .getbyokkey import ( GetBYOKKeyGlobals, GetBYOKKeyGlobalsTypedDict, @@ -322,6 +329,12 @@ GetKeyResponse, GetKeyResponseTypedDict, ) + from .getmodel import ( + GetModelGlobals, + GetModelGlobalsTypedDict, + GetModelRequest, + GetModelRequestTypedDict, + ) from .getmodels import ( GetModelsCategory, GetModelsGlobals, @@ -616,6 +629,7 @@ ) __all__ = [ + "Arena", "BulkAddWorkspaceMembersGlobals", "BulkAddWorkspaceMembersGlobalsTypedDict", "BulkAddWorkspaceMembersRequest", @@ -807,6 +821,10 @@ "GetBYOKKeyGlobalsTypedDict", "GetBYOKKeyRequest", "GetBYOKKeyRequestTypedDict", + "GetBenchmarksDesignArenaGlobals", + "GetBenchmarksDesignArenaGlobalsTypedDict", + "GetBenchmarksDesignArenaRequest", + "GetBenchmarksDesignArenaRequestTypedDict", "GetCreditsData", "GetCreditsDataTypedDict", "GetCreditsGlobals", @@ -839,6 +857,10 @@ "GetKeyRequestTypedDict", "GetKeyResponse", "GetKeyResponseTypedDict", + "GetModelGlobals", + "GetModelGlobalsTypedDict", + "GetModelRequest", + "GetModelRequestTypedDict", "GetModelsCategory", "GetModelsGlobals", "GetModelsGlobalsTypedDict", @@ -1293,6 +1315,11 @@ "GetAppRankingsResponseTypedDict": ".getapprankings", "GetAppRankingsSort": ".getapprankings", "Subcategory": ".getapprankings", + "Arena": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaGlobals": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaGlobalsTypedDict": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaRequest": ".getbenchmarksdesignarena", + "GetBenchmarksDesignArenaRequestTypedDict": ".getbenchmarksdesignarena", "GetBYOKKeyGlobals": ".getbyokkey", "GetBYOKKeyGlobalsTypedDict": ".getbyokkey", "GetBYOKKeyRequest": ".getbyokkey", @@ -1331,6 +1358,10 @@ "GetKeyRequestTypedDict": ".getkey", "GetKeyResponse": ".getkey", "GetKeyResponseTypedDict": ".getkey", + "GetModelGlobals": ".getmodel", + "GetModelGlobalsTypedDict": ".getmodel", + "GetModelRequest": ".getmodel", + "GetModelRequestTypedDict": ".getmodel", "GetModelsCategory": ".getmodels", "GetModelsGlobals": ".getmodels", "GetModelsGlobalsTypedDict": ".getmodels", diff --git a/src/openrouter/operations/createauthkeyscode.py b/src/openrouter/operations/createauthkeyscode.py index d3ef6c4..d4c074d 100644 --- a/src/openrouter/operations/createauthkeyscode.py +++ b/src/openrouter/operations/createauthkeyscode.py @@ -92,7 +92,7 @@ class CreateAuthKeysCodeGlobals(BaseModel): class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): callback_url: str - r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" + r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.""" code_challenge: NotRequired[str] r"""PKCE code challenge for enhanced security""" code_challenge_method: NotRequired[CreateAuthKeysCodeCodeChallengeMethod] @@ -109,7 +109,7 @@ class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): class CreateAuthKeysCodeRequestBody(BaseModel): callback_url: str - r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" + r"""The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.""" code_challenge: Optional[str] = None r"""PKCE code challenge for enhanced security""" diff --git a/src/openrouter/operations/getbenchmarksdesignarena.py b/src/openrouter/operations/getbenchmarksdesignarena.py new file mode 100644 index 0000000..2ac2aed --- /dev/null +++ b/src/openrouter/operations/getbenchmarksdesignarena.py @@ -0,0 +1,141 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + QueryParamMetadata, + validate_open_enum, +) +import pydantic +from pydantic.functional_validators import PlainValidator +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetBenchmarksDesignArenaGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetBenchmarksDesignArenaGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +Arena = Union[ + Literal[ + "models", + "builders", + "agents", + ], + UnrecognizedStr, +] +r"""Arena to query. Defaults to `models`.""" + + +class GetBenchmarksDesignArenaRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + arena: NotRequired[Arena] + r"""Arena to query. Defaults to `models`.""" + category: NotRequired[str] + r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.""" + max_results: NotRequired[int] + r"""Max results to return: per category when no category filter is applied (1–100, default 50).""" + + +class GetBenchmarksDesignArenaRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + arena: Annotated[ + Annotated[Optional[Arena], PlainValidator(validate_open_enum(False))], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = "models" + r"""Arena to query. Defaults to `models`.""" + + category: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.""" + + max_results: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 50 + r"""Max results to return: per category when no category filter is applied (1–100, default 50).""" diff --git a/src/openrouter/operations/getmodel.py b/src/openrouter/operations/getmodel.py new file mode 100644 index 0000000..e450562 --- /dev/null +++ b/src/openrouter/operations/getmodel.py @@ -0,0 +1,114 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetModelGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetModelGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetModelRequestTypedDict(TypedDict): + author: str + r"""The author/organization of the model""" + slug: str + r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)""" + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetModelRequest(BaseModel): + author: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The author/organization of the model""" + + slug: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""The model slug, optionally including a variant suffix (e.g. gpt-4 or gpt-4:free)""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ diff --git a/src/openrouter/operations/queryanalytics.py b/src/openrouter/operations/queryanalytics.py index fe4a010..698b5f7 100644 --- a/src/openrouter/operations/queryanalytics.py +++ b/src/openrouter/operations/queryanalytics.py @@ -137,7 +137,7 @@ class QueryAnalyticsRequestBodyTypedDict(TypedDict): granularity: NotRequired[str] r"""Time granularity""" group_limit: NotRequired[int] - r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" + r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" limit: NotRequired[int] r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.""" order_by: NotRequired[OrderByTypedDict] @@ -155,7 +155,7 @@ class QueryAnalyticsRequestBody(BaseModel): r"""Time granularity""" group_limit: Optional[int] = None - r"""Maximum rows per distinct combination of dimensions (ClickHouse LIMIT n BY). When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" + r"""Maximum rows per distinct combination of dimensions. When omitted on time-series queries (granularity + dimensions), auto-computed to avoid truncating time windows. Explicit values override the default and may truncate time buckets if set lower than the number of buckets in the range. Ignored when no dimensions are specified.""" limit: Optional[int] = None r"""Maximum total rows returned. Defaults to 1000. On time-series queries with dimensions and no explicit group_limit, the server may raise this to accommodate the expected number of unique time-bucket/dimension combinations.""" diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index ab9e6ba..ae12a80 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -625,6 +625,7 @@ def create_presets_chat_completions( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -647,6 +648,10 @@ def create_presets_chat_completions( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -676,6 +681,8 @@ def create_presets_chat_completions( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -709,6 +716,7 @@ def create_presets_chat_completions( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -717,6 +725,8 @@ def create_presets_chat_completions( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -728,6 +738,8 @@ def create_presets_chat_completions( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -769,6 +781,7 @@ def create_presets_chat_completions( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -783,6 +796,8 @@ def create_presets_chat_completions( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -805,6 +820,8 @@ def create_presets_chat_completions( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), @@ -943,6 +960,7 @@ async def create_presets_chat_completions_async( max_completion_tokens: OptionalNullable[int] = UNSET, max_tokens: OptionalNullable[int] = UNSET, metadata: Optional[Dict[str, str]] = None, + min_p: OptionalNullable[float] = UNSET, modalities: Optional[List[components.Modality]] = None, model: Optional[str] = None, models: Optional[List[str]] = None, @@ -965,6 +983,10 @@ async def create_presets_chat_completions_async( components.ChatRequestReasoningTypedDict, ] ] = None, + reasoning_effort: OptionalNullable[ + components.ChatRequestReasoningEffort + ] = UNSET, + repetition_penalty: OptionalNullable[float] = UNSET, response_format: Optional[ Union[components.ResponseFormat, components.ResponseFormatTypedDict] ] = None, @@ -994,6 +1016,8 @@ async def create_presets_chat_completions_async( List[components.ChatFunctionToolTypedDict], ] ] = None, + top_a: OptionalNullable[float] = UNSET, + top_k: OptionalNullable[int] = UNSET, top_logprobs: OptionalNullable[int] = UNSET, top_p: OptionalNullable[float] = UNSET, trace: Optional[ @@ -1027,6 +1051,7 @@ async def create_presets_chat_completions_async( :param max_completion_tokens: Maximum tokens in completion :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16. :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param min_p: Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter. :param modalities: Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\". :param model: Model to use for completion :param models: Models to use for completion @@ -1035,6 +1060,8 @@ async def create_presets_chat_completions_async( :param presence_penalty: Presence penalty (-2.0 to 2.0) :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models + :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. + :param repetition_penalty: Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter. :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param service_tier: The service tier to use for processing this request. @@ -1046,6 +1073,8 @@ async def create_presets_chat_completions_async( :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration :param tools: Available tools for function calling + :param top_a: Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter. + :param top_k: Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter. :param top_logprobs: Number of top log probabilities to return (0-20) :param top_p: Nucleus sampling parameter (0-1) :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. @@ -1087,6 +1116,7 @@ async def create_presets_chat_completions_async( messages, List[components.ChatMessages] ), metadata=metadata, + min_p=min_p, modalities=modalities, model=model, models=models, @@ -1101,6 +1131,8 @@ async def create_presets_chat_completions_async( reasoning=utils.get_pydantic_model( reasoning, Optional[components.ChatRequestReasoning] ), + reasoning_effort=reasoning_effort, + repetition_penalty=repetition_penalty, response_format=utils.get_pydantic_model( response_format, Optional[components.ResponseFormat] ), @@ -1123,6 +1155,8 @@ async def create_presets_chat_completions_async( tools=utils.get_pydantic_model( tools, Optional[List[components.ChatFunctionTool]] ), + top_a=top_a, + top_k=top_k, top_logprobs=top_logprobs, top_p=top_p, trace=utils.get_pydantic_model(trace, Optional[components.TraceConfig]), @@ -1253,6 +1287,12 @@ def create_presets_messages( context_management: OptionalNullable[ Union[components.ContextManagement, components.ContextManagementTypedDict] ] = UNSET, + fallbacks: OptionalNullable[ + Union[ + List[components.MessagesFallbackParam], + List[components.MessagesFallbackParamTypedDict], + ] + ] = UNSET, max_tokens: Optional[int] = None, metadata: Optional[ Union[components.Metadata, components.MetadataTypedDict] @@ -1327,6 +1367,7 @@ def create_presets_messages( :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. :param context_management: + :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: :param metadata: :param models: @@ -1375,6 +1416,9 @@ def create_presets_messages( context_management=utils.get_pydantic_model( context_management, OptionalNullable[components.ContextManagement] ), + fallbacks=utils.get_pydantic_model( + fallbacks, OptionalNullable[List[components.MessagesFallbackParam]] + ), max_tokens=max_tokens, messages=utils.get_pydantic_model( messages, Nullable[List[components.MessagesMessageParam]] @@ -1547,6 +1591,12 @@ async def create_presets_messages_async( context_management: OptionalNullable[ Union[components.ContextManagement, components.ContextManagementTypedDict] ] = UNSET, + fallbacks: OptionalNullable[ + Union[ + List[components.MessagesFallbackParam], + List[components.MessagesFallbackParamTypedDict], + ] + ] = UNSET, max_tokens: Optional[int] = None, metadata: Optional[ Union[components.Metadata, components.MetadataTypedDict] @@ -1621,6 +1671,7 @@ async def create_presets_messages_async( :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. :param context_management: + :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: :param metadata: :param models: @@ -1669,6 +1720,9 @@ async def create_presets_messages_async( context_management=utils.get_pydantic_model( context_management, OptionalNullable[components.ContextManagement] ), + fallbacks=utils.get_pydantic_model( + fallbacks, OptionalNullable[List[components.MessagesFallbackParam]] + ), max_tokens=max_tokens, messages=utils.get_pydantic_model( messages, Nullable[List[components.MessagesMessageParam]] diff --git a/uv.lock b/uv.lock index 72f33e0..3d0c874 100644 --- a/uv.lock +++ b/uv.lock @@ -220,7 +220,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.9.2" +version = "0.9.3" source = { editable = "." } dependencies = [ { name = "httpcore" },