From 2877d4c0593d01b294ac4be3c41aae594002d507 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 4 Nov 2026 19:14:01 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.providers.list_provider_endpoints()`: **Added** --- .speakeasy/gen.lock | 249 ++++++- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 616 ++++++++++++++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/chattemplateconfig.mdx | 11 + docs/components/defaultreasoningeffort.mdx | 24 + .../defaultreasoningreturnmechanism.mdx | 24 + docs/components/endpointsummary.mdx | 19 + docs/components/endpointtestprofile.mdx | 14 + .../endpointtestprofileinputmodality.mdx | 23 + docs/components/endpointtestprofilemodel.mdx | 14 + .../endpointtestprofileoutputmodality.mdx | 27 + .../endpointtestprofilereasoningconfig.mdx | 18 + docs/components/features.mdx | 11 + .../featuresdefaultreasoningeffort.mdx | 24 + docs/components/featuresreasoningconfig.mdx | 18 + .../featuresreasoningreturnmechanism.mdx | 24 + .../featuressupportedreasoningeffort.mdx | 24 + docs/components/instructionrolesupport.mdx | 23 + docs/components/latencyms.mdx | 13 + docs/components/providerendpoints.mdx | 11 + docs/components/providerendpointsresponse.mdx | 9 + docs/components/providerendpointstats.mdx | 18 + .../providerendpointstatsavailable.mdx | 18 + .../providerendpointstatsavailablestatus.mdx | 15 + .../providerendpointstatsunavailable.mdx | 9 + ...providerendpointstatsunavailablestatus.mdx | 15 + docs/components/reasoningreturnmechanism.mdx | 24 + docs/components/requiredinputmodality.mdx | 22 + docs/components/supportedreasoningeffort.mdx | 24 + docs/components/throughputtokenspersecond.mdx | 13 + docs/components/visibility.mdx | 22 + docs/components/window.mdx | 25 + .../gettaskclassificationsrequest.mdx | 2 +- ...w.mdx => gettaskclassificationswindow.mdx} | 6 +- .../listproviderendpointsglobals.mdx | 11 + .../listproviderendpointsrequest.mdx | 14 + .../listproviderendpointswindow.mdx | 25 + docs/operations/perfworkload.mdx | 30 + docs/sdks/classifications/README.mdx | 2 +- docs/sdks/providers/README.mdx | 56 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/classifications.py | 4 +- src/openrouter/components/__init__.py | 138 ++++ src/openrouter/components/endpointsummary.py | 90 +++ .../components/endpointtestprofile.py | 540 +++++++++++++++ .../components/providerendpoints.py | 37 ++ .../components/providerendpointsresponse.py | 14 + .../components/providerendpointstats.py | 61 ++ .../providerendpointstatsavailable.py | 135 ++++ .../providerendpointstatsunavailable.py | 17 + src/openrouter/operations/__init__.py | 26 +- .../operations/gettaskclassifications.py | 6 +- .../operations/listproviderendpoints.py | 202 ++++++ src/openrouter/providers.py | 302 +++++++++ uv.lock | 2 +- 58 files changed, 3094 insertions(+), 57 deletions(-) create mode 100644 docs/components/chattemplateconfig.mdx create mode 100644 docs/components/defaultreasoningeffort.mdx create mode 100644 docs/components/defaultreasoningreturnmechanism.mdx create mode 100644 docs/components/endpointsummary.mdx create mode 100644 docs/components/endpointtestprofile.mdx create mode 100644 docs/components/endpointtestprofileinputmodality.mdx create mode 100644 docs/components/endpointtestprofilemodel.mdx create mode 100644 docs/components/endpointtestprofileoutputmodality.mdx create mode 100644 docs/components/endpointtestprofilereasoningconfig.mdx create mode 100644 docs/components/features.mdx create mode 100644 docs/components/featuresdefaultreasoningeffort.mdx create mode 100644 docs/components/featuresreasoningconfig.mdx create mode 100644 docs/components/featuresreasoningreturnmechanism.mdx create mode 100644 docs/components/featuressupportedreasoningeffort.mdx create mode 100644 docs/components/instructionrolesupport.mdx create mode 100644 docs/components/latencyms.mdx create mode 100644 docs/components/providerendpoints.mdx create mode 100644 docs/components/providerendpointsresponse.mdx create mode 100644 docs/components/providerendpointstats.mdx create mode 100644 docs/components/providerendpointstatsavailable.mdx create mode 100644 docs/components/providerendpointstatsavailablestatus.mdx create mode 100644 docs/components/providerendpointstatsunavailable.mdx create mode 100644 docs/components/providerendpointstatsunavailablestatus.mdx create mode 100644 docs/components/reasoningreturnmechanism.mdx create mode 100644 docs/components/requiredinputmodality.mdx create mode 100644 docs/components/supportedreasoningeffort.mdx create mode 100644 docs/components/throughputtokenspersecond.mdx create mode 100644 docs/components/visibility.mdx create mode 100644 docs/components/window.mdx rename docs/operations/{window.mdx => gettaskclassificationswindow.mdx} (53%) create mode 100644 docs/operations/listproviderendpointsglobals.mdx create mode 100644 docs/operations/listproviderendpointsrequest.mdx create mode 100644 docs/operations/listproviderendpointswindow.mdx create mode 100644 docs/operations/perfworkload.mdx create mode 100644 src/openrouter/components/endpointsummary.py create mode 100644 src/openrouter/components/endpointtestprofile.py create mode 100644 src/openrouter/components/providerendpoints.py create mode 100644 src/openrouter/components/providerendpointsresponse.py create mode 100644 src/openrouter/components/providerendpointstats.py create mode 100644 src/openrouter/components/providerendpointstatsavailable.py create mode 100644 src/openrouter/components/providerendpointstatsunavailable.py create mode 100644 src/openrouter/operations/listproviderendpoints.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index d041f3fe8..2ab206ea1 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: 95383b0ddad197d268ba1153f2f2e4ac + docChecksum: 1af36a386677e5c72d1d6e612ff746a8 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.117 - configChecksum: 96082336ac2d9236df4af3f864ee5811 + releaseVersion: 1.3.118 + configChecksum: b8a96c694f87028e65fa90ce871b1bd4 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: dace6193-591e-4ce2-bd40-68df98115bc6 - pristine_commit_hash: 22eea323a506c5839fad8f72ab27cc0acb0e5a9e - pristine_tree_hash: 02806f8bbb737175a05153a48a16ecdc60603bff + generation_id: 8de6f91a-f314-428f-b36c-2b72ed1a92f7 + pristine_commit_hash: a277af25a0ef90ae0672fcac0b5355f7a76c1c43 + pristine_tree_hash: 8411439dcb096246671b5a7f2edc1d19e26e9657 features: python: acceptHeaders: 3.0.0 @@ -2126,6 +2126,10 @@ trackedFiles: id: 87ed2a5e080d last_write_checksum: sha1:2865a40286913d1de566dd4fdc81eada6a3b4fb2 pristine_git_object: 968ecf2c8b7548e152ba542566bb4a98fe86ba25 + docs/components/chattemplateconfig.mdx: + id: a490307c04d4 + last_write_checksum: sha1:c29cd8eb95e16a79b9e03e13756fb9c69cc78fb8 + pristine_git_object: d957a1e60749ad7e405046ae8285bdd94e50484c docs/components/chattokenlogprob.mdx: id: 5d735052588d last_write_checksum: sha1:34f2d68dd4c2026c61015d6d0f72b8ae6b99f6c9 @@ -2998,6 +3002,14 @@ trackedFiles: id: eb9e41a380b4 last_write_checksum: sha1:77ac3ec3f6d08e4d5e5f69df64f5c9028a6191b3 pristine_git_object: 78c74a24e624245cbbfe2f989c4301442bbb5fee + docs/components/defaultreasoningeffort.mdx: + id: e8b4ecf280a2 + last_write_checksum: sha1:1fcce8c285c26796c281a721a4ca4dbc29c076d4 + pristine_git_object: 8516502b755835fc28aef01a0dd91f59baf3355a + docs/components/defaultreasoningreturnmechanism.mdx: + id: 000970fdbfca + last_write_checksum: sha1:888ec65c9be7bdf0466dbe6c41ce641a482fc7ef + pristine_git_object: 9a185dec3a67d5541183b8407ed2a009650cd951 docs/components/deferredbm25search.mdx: id: 28b5539be31d last_write_checksum: sha1:7f897adc605d54cbb0d10b2c4aac7b99b7fd7dd8 @@ -3170,6 +3182,30 @@ trackedFiles: id: 5e4fa96c840d last_write_checksum: sha1:4d2ccb7fc0d20c8a0b72db3a55a8228169891b6a pristine_git_object: 72c5b4fb8441c2a4337dc9906fa81b01bb92f126 + docs/components/endpointsummary.mdx: + id: 2f3c10fd6e19 + last_write_checksum: sha1:ac6557050023b639b210534098fc7cd137d07645 + pristine_git_object: 62ddd126155c8d33824814ba4e43be525f5f9d68 + docs/components/endpointtestprofile.mdx: + id: 644dac398ccc + last_write_checksum: sha1:c18d9c81f4ac012cd1d26a9f7e35be824cf24f38 + pristine_git_object: 3a4fdcc049749a4d231dea897bd5d6d4e5363dff + docs/components/endpointtestprofileinputmodality.mdx: + id: e77ab18d72be + last_write_checksum: sha1:ac959058a8e57361f8fc69fb4b9bb5a9b952922e + pristine_git_object: 0afb96682c4dbf94d5642e32874b8993a20f2789 + docs/components/endpointtestprofilemodel.mdx: + id: fdfc9f88344c + last_write_checksum: sha1:dafd5f49c1abbe0e37e7461632e566d980359d3a + pristine_git_object: fa1eb572652e94f9866f05942a7248190c262010 + docs/components/endpointtestprofileoutputmodality.mdx: + id: 05439d848368 + last_write_checksum: sha1:ea58cbd52bb11f2cb87d9252bf2d1ad0bc336d82 + pristine_git_object: 14d81efa3ffd01908c4e900fc254d415a138d5f0 + docs/components/endpointtestprofilereasoningconfig.mdx: + id: 9e765c2ac138 + last_write_checksum: sha1:68edc8357d41f8c66acf6797ae16e1b8082073a3 + pristine_git_object: b9983570ef9c4d25c1f4ae17cd69751759f6f62f docs/components/enumcapability.mdx: id: 33c7a0f315d5 last_write_checksum: sha1:393f904f9c8528ba5fbf2dc2b48b4a0042ef1c5f @@ -3566,6 +3602,26 @@ trackedFiles: id: 538c871219f3 last_write_checksum: sha1:52ed81e463594f421f6459f9d363b76cba584711 pristine_git_object: 4b6c1a197ad3fa4a117c0919bbaf30129f454fed + docs/components/features.mdx: + id: 3e20b309e0ed + last_write_checksum: sha1:d4ecf214f1551b608fa9f7d4393a524868540b95 + pristine_git_object: d179320eae5feab2da0a4e9525907972d705271a + docs/components/featuresdefaultreasoningeffort.mdx: + id: 2341c826ca51 + last_write_checksum: sha1:d8e820975fec28c0eceff7cd03afffb212f79d16 + pristine_git_object: d04709713abc43e004782d0a6abe9ec88c375420 + docs/components/featuresreasoningconfig.mdx: + id: a31e174c4b0d + last_write_checksum: sha1:ac971564c7526941f6428eba544995b7077a4a01 + pristine_git_object: 0d676710496a1f398dc2c80a4c52734e62a2da69 + docs/components/featuresreasoningreturnmechanism.mdx: + id: 3890f37425b9 + last_write_checksum: sha1:ccfa12748baf5492c219152399d0097278eeb56f + pristine_git_object: 067b63cc4270f4d387773e1b4b0e0dcbbed50815 + docs/components/featuressupportedreasoningeffort.mdx: + id: c11603c83791 + last_write_checksum: sha1:77014a714f09e3cb28fcf6c1c0ddffbe0916adec + pristine_git_object: c6f07dceb7d00aabc33174e8dc095d42851a4058 docs/components/fields.mdx: id: 8b32f4bd19c8 last_write_checksum: sha1:1918a386c69669321ebe08f399c98afb62996481 @@ -4482,6 +4538,10 @@ trackedFiles: id: 6eb7b26998d7 last_write_checksum: sha1:7c462ce0c9c933fe87c31f3021fc80b644b29b7e pristine_git_object: 9cb9bd87ba962a19e4c1d645adcfebc8d6b39ddb + docs/components/instructionrolesupport.mdx: + id: 9b4f56fee3ed + last_write_checksum: sha1:a62c7f70c0a00800eb2f1bb1558a6405ea46c8e8 + pristine_git_object: d12c96f800e0e444461f62c3526b0340276b58e6 docs/components/instructtype.mdx: id: 4e1ceba5a654 last_write_checksum: sha1:2efe0463c8d0ed63159bbcc8cb8c21743800b88e @@ -4558,6 +4618,10 @@ trackedFiles: id: e031cc3f462c last_write_checksum: sha1:2506bc8b4e80b7b71b9f59a8d84a0367cfd3a119 pristine_git_object: bfef4620305e6517f0de3179cc1b9359ca3e43d2 + docs/components/latencyms.mdx: + id: b1a318d88ee8 + last_write_checksum: sha1:01023174846bb5194525a160f9a134bc48527cbf + pristine_git_object: 8740fcc1c8ae3a6df5e64d8b31034757ea9d7954 docs/components/legacychatcontentvideo.mdx: id: fd222b8b9445 last_write_checksum: sha1:900e39e30b47e20e71edde59669225c91d36b1d6 @@ -6762,6 +6826,34 @@ trackedFiles: id: 75786e3aa079 last_write_checksum: sha1:9af190f60239a910768092d5ed8342ed7aed4ebd pristine_git_object: e4103b29b85cafaf653bf8f71bd8e12278a16fa8 + docs/components/providerendpoints.mdx: + id: e02d82a05aa1 + last_write_checksum: sha1:e9216dbe6f41cb464c37e68d83c50170c9aeba69 + pristine_git_object: 2fa98c5f53be2a61d95370f0baf6ce3b78f932d3 + docs/components/providerendpointsresponse.mdx: + id: b9170e0f033a + last_write_checksum: sha1:c3d67ac04e85f7c021139fda03a847eff80df147 + pristine_git_object: 93121830de181d0b5bebae9046d0e0f669173c78 + docs/components/providerendpointstats.mdx: + id: d9ad41b12dc7 + last_write_checksum: sha1:15a01243c05c488f364b4f80342a7119c001857e + pristine_git_object: 0d36b106cd8aaf47eac34200a16792ea49145ba6 + docs/components/providerendpointstatsavailable.mdx: + id: 4d0ef470fc34 + last_write_checksum: sha1:ca31a0866cc49e7d5a274d3ab91ad6104986c80f + pristine_git_object: f18332bc3438772601b65e00a8c7e33b1c44f291 + docs/components/providerendpointstatsavailablestatus.mdx: + id: faa7f2d8af20 + last_write_checksum: sha1:4a7e1aa339e785354adf2b559643008a98eede1a + pristine_git_object: 43d1f481abc6a1bd3a6ec2f010c1bcc29e777092 + docs/components/providerendpointstatsunavailable.mdx: + id: 4e311fd26b6a + last_write_checksum: sha1:45b61240d35d33db5680e9ee1d5a544712316f7f + pristine_git_object: d7b19cd60dac2269318f98dd8670c172e71abf6f + docs/components/providerendpointstatsunavailablestatus.mdx: + id: 6b684d38c0f8 + last_write_checksum: sha1:823f29dc6c81d49495a9a44041339efc6f32dd49 + pristine_git_object: 5f99ed2cfb6d52c1ae6cf31154938f01afdb63c6 docs/components/providerenum.mdx: id: 3065d8db71f9 last_write_checksum: sha1:8adf2339eb304261db4be5001a8e3cf7ea449e2f @@ -6974,6 +7066,10 @@ trackedFiles: id: bbff17cc0627 last_write_checksum: sha1:5a3d3051d45f770038d66c27cade83a2ec9d9ffe pristine_git_object: d288ff3c7f26ed6a639f3c790d7d2a5de4d1715e + docs/components/reasoningreturnmechanism.mdx: + id: a63583fd55c0 + last_write_checksum: sha1:fcda99ee5214fef3faea0df5d0e11af8fdda5cf0 + pristine_git_object: ab2b9418cf640b6ccaaf76fcbde629116a1ee090 docs/components/reasoningsummarypartaddedevent.mdx: id: f8185d70cec5 last_write_checksum: sha1:1a681d328e3f6bcdd8e90a2c3f5ad986eae9f9f9 @@ -7082,6 +7178,10 @@ trackedFiles: id: fd80c94f61ca last_write_checksum: sha1:9df63b87a79a3ccb889870640b0d658ea57436fe pristine_git_object: 01acc3f8d0a451cf6ca5d1c0da90995c79f8f727 + docs/components/requiredinputmodality.mdx: + id: cdc606386c72 + last_write_checksum: sha1:53027168359a2cdf03896b2e949877d3706f942f + pristine_git_object: 5255fbcda60a8ca801b55e34c595cd52ddedcce4 docs/components/rerank.mdx: id: b011fb4a30ac last_write_checksum: sha1:c04836cd04951c2d9dbd99636d2e04f21ff2e8e2 @@ -7734,6 +7834,10 @@ trackedFiles: id: f34dfb27d78f last_write_checksum: sha1:a979de72a67038af692d17cdb379b1d58e7ad0c8 pristine_git_object: 64a19c185569b50eb0a3363b472c1c28807493f2 + docs/components/supportedreasoningeffort.mdx: + id: 2964975e7365 + last_write_checksum: sha1:e54be5bfd39b030f1dcd34e5da860d541281778c + pristine_git_object: 1911d4dfd8d1a3deb83ff480a20f1c80dbb335b1 docs/components/supportedresolution.mdx: id: 4dab32379c4d last_write_checksum: sha1:0df389c4bfbe7f608751121a9d93b6ddb5838b87 @@ -7830,6 +7934,10 @@ trackedFiles: id: 9f8561d6342c last_write_checksum: sha1:6226a4ff5f99a852e34cd5053851a507cb3a9e7c pristine_git_object: 834297f4c2167ee22b57bd3cfb126b37662cd1ae + docs/components/throughputtokenspersecond.mdx: + id: 2683dd4e1edd + last_write_checksum: sha1:7fa7f62b6dcf1f6675a1390d2efe51e8f59a109c + pristine_git_object: f36915f615d2b2936206234df6645d3c0f68ddec docs/components/token.mdx: id: f22f9a37dc7e last_write_checksum: sha1:97ec547ce1db50eecd30b5a03fe51d6365f93d3d @@ -8538,6 +8646,10 @@ trackedFiles: id: d08b4554c5c0 last_write_checksum: sha1:526462332a3139b4627d3bbc31d8cac2318f6b77 pristine_git_object: d42e64e68478b608c940ff56a1592375c7145698 + docs/components/visibility.mdx: + id: 5404485c7f02 + last_write_checksum: sha1:1cc5b33225ea510d7835f4b94de8530c772d2c45 + pristine_git_object: 85c28caf1117c92d7b33e55cf586cd3617499e1a docs/components/watch.mdx: id: 30a963a3de2c last_write_checksum: sha1:c9d01625c52deaa2399d196211ae37b63892efd9 @@ -8674,6 +8786,10 @@ trackedFiles: id: 2df2844a96ee last_write_checksum: sha1:1a58eaab78f5cfb3fba15aeddad9405b5ca13fa9 pristine_git_object: e8a689098106c445424b89fe5baa348824f3a36c + docs/components/window.mdx: + id: a1f640547218 + last_write_checksum: sha1:fd7da90856fb04e5aa50ca27fb2e01f36769255b + pristine_git_object: 6b84147b4664884bdf50bf2111b909ebe5347188 docs/components/workspace.mdx: id: eea9c32d09c4 last_write_checksum: sha1:f8518fa23ec7a3b2936d113271ba96a1fa7988ec @@ -9736,8 +9852,12 @@ trackedFiles: pristine_git_object: 9753c9912c2ad7f86b33b0be0e8a5f0f44af0599 docs/operations/gettaskclassificationsrequest.mdx: id: b4c12a5cf637 - last_write_checksum: sha1:386d1f4891ed366d1940757578c4c072de7557da - pristine_git_object: a2c427446b998196800034334da0cca3569d4595 + last_write_checksum: sha1:70bfc6cd6ed078e5ccc825fd7e09d1a55f1b29a9 + pristine_git_object: bf44a0d334444d5dc6a6bd576b490467d2bb55a1 + docs/operations/gettaskclassificationswindow.mdx: + id: 899a3f608d79 + last_write_checksum: sha1:32cd19993e8d843210c0f428573025d206ee9dec + pristine_git_object: e0e1a0f035c08b756c3b41d10ef746cc1491b52c docs/operations/gettoolglobals.mdx: id: e88fdfb11e03 last_write_checksum: sha1:c1011d20ad4fc60d7d92d74f341bc2d0e0b0cc1c @@ -10150,6 +10270,18 @@ trackedFiles: id: b3d116a5ba89 last_write_checksum: sha1:48cbb6d60736f3be395ff2f9b556c72f496f731c pristine_git_object: 1e9f3514bd813c91e6466ccbbca087b73b61f43c + docs/operations/listproviderendpointsglobals.mdx: + id: 9db8a2a5b5a5 + last_write_checksum: sha1:a354db801641fc601ae0dfc6bd0f0c99d6e04904 + pristine_git_object: 65a8151ddba10caacab93f31e58611f184e29682 + docs/operations/listproviderendpointsrequest.mdx: + id: b581bfcccd9c + last_write_checksum: sha1:ebd69b59d5b14f8223fdcb3de956c32545b31248 + pristine_git_object: 3dbaa9207a80459137e21ea3c317a1808b2e41a7 + docs/operations/listproviderendpointswindow.mdx: + id: 6a60ef940291 + last_write_checksum: sha1:056bd05761db309ddb31d3457022b02e2e52ccd1 + pristine_git_object: 08fc9d1cf67ae6938a8ca1cb64902e21961da83b docs/operations/listprovidersdata.mdx: id: 79d7624ebbdc last_write_checksum: sha1:44933a10cf08c83fd60046b3c8e169f9518dd0e5 @@ -10298,6 +10430,10 @@ trackedFiles: id: 5465d93e546d last_write_checksum: sha1:cd7e1616f1f34e0f3af97ca00025ff41423024b1 pristine_git_object: 56531d3d28f5a9adf8321bcb95daf99e781b044e + docs/operations/perfworkload.mdx: + id: 6ae2e628bb2d + last_write_checksum: sha1:45691bad85d27084cc50bf77b64d98a0bc33b2be + pristine_git_object: 6a4dd0d44ae4466bae35baeff4ed86a103495a63 docs/operations/period.mdx: id: 038d66aa4fc1 last_write_checksum: sha1:f65e16f5901c128767ab047aaeb811430c2bce3e @@ -10574,10 +10710,6 @@ trackedFiles: id: 11e224cdab3c last_write_checksum: sha1:6166c87ba26da5ef5f754195074264bf466d85e1 pristine_git_object: bffe0e5d76aac876860b6e3be42a9ebecf40e871 - docs/operations/window.mdx: - id: cdb33aa5c15a - last_write_checksum: sha1:36234c180ece9d264d313db08936d040af86cb8f - pristine_git_object: 52168404b9b71ed5151ac09d81cb9e148f1a600f docs/operations/zdr.mdx: id: 198b78abdff6 last_write_checksum: sha1:8a61e4b23d0f7e8376b2227d6c87ca49a473f7d1 @@ -10612,8 +10744,8 @@ trackedFiles: pristine_git_object: 25f5f771869c49ec913d671a4013d63d50836aef docs/sdks/classifications/README.mdx: id: 4786130ef02a - last_write_checksum: sha1:0ad874e3b59605580ef4d4647b4e0feece64ccc9 - pristine_git_object: c59bcbd8e4f545fe69d2fa385dd81fdb2521e216 + last_write_checksum: sha1:d5399dbacefc9ed5840a08c4b44f2a14e19086c1 + pristine_git_object: aa324667aa6bd9d8cd8aeba1aa36908aa83b3bc9 docs/sdks/containers/README.mdx: id: cc963972ad75 last_write_checksum: sha1:7e1c6252aa61f2e03f1f07cb2494ca1439376eda @@ -10692,8 +10824,8 @@ trackedFiles: pristine_git_object: 800024b7fce0349bda2b87c5035a4a464304d330 docs/sdks/providers/README.mdx: id: 5ea9af111324 - last_write_checksum: sha1:782a6fe2f68c7e03c0496ce0e83cdc3f5a1512f0 - pristine_git_object: fbd074b61683886e7e7049e81e2f03cdfa2ef32a + last_write_checksum: sha1:c315861e9e1ebbebc076b4b65b78fa5e6d931d2f + pristine_git_object: 88e3620cf8a40748e4e369e4a39f769213cfef4a docs/sdks/rerank/README.mdx: id: 68cdfc7f7dca last_write_checksum: sha1:64d5fd71e3e39c6c24856438e89ef7c9264cf630 @@ -10740,8 +10872,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:946021496d5727019dc93e7907e337238722e41f - pristine_git_object: 4b565ff4bb5387f97f90d3378968ac132e503362 + last_write_checksum: sha1:680e877a4cdb4892da46e863332a5caffde4c4d5 + pristine_git_object: 605c91f8dd70d28c9a5e9be1db7bd35e26e724e8 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -10768,8 +10900,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:ab6e636715011ab95364bc38d10a0c7fbea83f4f - pristine_git_object: e7ab1c303f4e344fb9f4e9e75ccb0377fdff7aed + last_write_checksum: sha1:9fdacd1bf55f7da2d765c053729c1398cd8dbfbd + pristine_git_object: 1d94cdc5f0b7f2b08660fbbbad8a23357a06e554 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -10812,12 +10944,12 @@ trackedFiles: pristine_git_object: 43dbe7dff7ebfc3a17ea4ee9241441c8fb64a20f src/openrouter/classifications.py: id: 4f2efc24b95b - last_write_checksum: sha1:3ab6fcd9ef679cd2149ec8dfbb4a86109cd152ad - pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 + last_write_checksum: sha1:129503d413e09ee585de15d8410e22ee115a2f82 + pristine_git_object: 192786c7ca69fff87f3683fc28b4d71baf28fc3d src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:826a7a0748e402467b31cfa1ac634c41e46675b1 - pristine_git_object: 921a7b3387d1f787124a1f2b373a1d82409ad6d3 + last_write_checksum: sha1:56d03bbfa24ce5151333ffe76b35c6b52c95767e + pristine_git_object: a1b3836b0f0cf0083e60ccb823a2b7a56bcfcb45 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -12146,6 +12278,14 @@ trackedFiles: id: e935c578fce8 last_write_checksum: sha1:8a9c8184852faf1e3ca9a478e48df41ccac6fc33 pristine_git_object: ed5f8af0c599b1e55bb1939bc1d2aff0aeef610d + src/openrouter/components/endpointsummary.py: + id: f762a212e4ed + last_write_checksum: sha1:98a2c65e548248fd98d0dfaeb33d76bbb9963f3e + pristine_git_object: 357f1615265dad9b3057bf2bee0ec0a9b7ac76ac + src/openrouter/components/endpointtestprofile.py: + id: 224d4a6faca6 + last_write_checksum: sha1:45bde022ea3f7c732c4a9a1fb58a1b61f8188328 + pristine_git_object: a16c2c6d4be847563619173eff68786181705fb5 src/openrouter/components/enumcapability.py: id: 1eddd72a17a5 last_write_checksum: sha1:09e366c414f84edb166eeb8e9091e278c15136d6 @@ -13506,6 +13646,26 @@ trackedFiles: id: e78ab231a530 last_write_checksum: sha1:f257e3ae2b6385cf758e891ba02601c435e92098 pristine_git_object: 170ae25c582bb8decd74e1c69bfa8353bd44e86d + src/openrouter/components/providerendpoints.py: + id: d9871b08b002 + last_write_checksum: sha1:2bc5601965cde0440494c2dfd89ea9f293952b8d + pristine_git_object: 25fce7b1e68836296a0b2fdc3715efe63ef02a06 + src/openrouter/components/providerendpointsresponse.py: + id: 56feef563a46 + last_write_checksum: sha1:a675012d64dc6751caefd15f70fcdde7dbe8639d + pristine_git_object: 9b271e719ee24e101be559bd5f46686804fb47bd + src/openrouter/components/providerendpointstats.py: + id: 098633322fbe + last_write_checksum: sha1:922d57bd38b1b754c090408582c61b94d3ce261b + pristine_git_object: f87170f0fc209c5213c588d120b4c2860fd3f7c2 + src/openrouter/components/providerendpointstatsavailable.py: + id: 432eda2b3706 + last_write_checksum: sha1:7f38384e61db24db132d79e67e92ec042e9b6445 + pristine_git_object: 67d24b1f922d2a7346ec93cc5ca3149f3cbc3133 + src/openrouter/components/providerendpointstatsunavailable.py: + id: eb0ec66203dd + last_write_checksum: sha1:5eb2a4e2528635e5eec9209a78dbc71ea31794ad + pristine_git_object: ab2fb6d551947da1920028d7ecf40c711b6ef5b8 src/openrouter/components/providername.py: id: fcc722fa2fce last_write_checksum: sha1:a1690b4504574c699c746530fc9fdbb1cc56c34b @@ -14560,8 +14720,8 @@ trackedFiles: pristine_git_object: 4a35ede011d09dddab042e2c00413ce4f6be655e src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:3549a224597521d4f1d080a8d9acdfd6a9de3fa7 - pristine_git_object: 7319f555fe88b80496da7b646185e294f6d83d38 + last_write_checksum: sha1:d5f6a1573d060a4e50c1914f2d04419dd2221234 + pristine_git_object: 2c9a7c31257dd3615eb0ed006c116489f934802f src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -14880,8 +15040,8 @@ trackedFiles: pristine_git_object: 7a5e3e1cf09fcd3ac3a50b8f5790a1d6f35e5381 src/openrouter/operations/gettaskclassifications.py: id: ba6156d68acf - last_write_checksum: sha1:c569572d21aa766ac542d5c535208e8b1caae503 - pristine_git_object: a8b610cad3ca3792798e40b31cada48b0ed3845b + last_write_checksum: sha1:91add813072ad0c7a70607f3ac2f288bb7d071f4 + pristine_git_object: 1679b8aaa3cee779e41e1e43775b6fa2562028d2 src/openrouter/operations/gettool.py: id: f0997d66f38e last_write_checksum: sha1:f3e11b59741e20041a219c423c1392fc69a2a7f1 @@ -15018,6 +15178,10 @@ trackedFiles: id: d8ad909a544b last_write_checksum: sha1:ec09211e03d24ca14b54ebeb6af172a2fd73d3a6 pristine_git_object: 1b76ac2414e607e8e7565745592764cf7322e9a0 + src/openrouter/operations/listproviderendpoints.py: + id: 7d231ba68731 + last_write_checksum: sha1:674a63d3423f5441384a777ccc88c42f2098dbb0 + pristine_git_object: e6b63273e623eb09df35fe24460decbdbdaf2e36 src/openrouter/operations/listproviders.py: id: cf6e2db15118 last_write_checksum: sha1:decee82d2b55738162cc47f02f56c592d53f9ee9 @@ -15152,8 +15316,8 @@ trackedFiles: pristine_git_object: 1a1d32977e3758252ed28048211567054d0a7001 src/openrouter/providers.py: id: debc4c48f149 - last_write_checksum: sha1:11dbc607825edee8dcc84b39ee8171e097c47acf - pristine_git_object: c1fd70812d86dcc34e9f111325c50b988fb4aa1f + last_write_checksum: sha1:394f42d50232b743d83a84a6171a0220c6e043f3 + pristine_git_object: ac109190c866c2671ed707cbb761e5a830eeac8c src/openrouter/py.typed: id: 89fd03eab092 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 @@ -19837,8 +20001,29 @@ examples: application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} "529": application/json: {"error": {"code": 529, "message": "Provider returned error"}} + listProviderEndpoints: + speakeasy-default-list-provider-endpoints: + parameters: + path: + provider_slug: "fireworks" + query: + window: "1d" + responses: + "200": + application/json: {"data": {"endpoints": [{"endpoint_id": "0198c3f1-7b9a-7c31-a2d4-5e6f7a8b9c0d", "model_slug": "z-ai/glm-5.3", "created_at": "2026-08-20T00:00:00.000Z", "model_permaslug": "z-ai/glm-5.3-20260101", "provider_model_id": "accounts/fireworks/models/glm-5p3", "provider_name": "Fireworks", "provider_region": "us", "service_tier": "priority", "test_profile": {"context_length": 128000, "default_reasoning_return_mechanism": "reasoning-content", "effective_adapter_name": "openai", "endpoint_features": {"key": "", "key1": ""}, "is_lab_trusted": false, "model": {"features": {}, "input_modalities": [], "output_modalities": [], "reasoning_config": {}, "slug": "z-ai/glm-5.3", "supports_reasoning": false}}, "variant": "standard", "visibility": "visible"}], "stats": {"endpoint_count": 12, "error_rate_percent": 0.8, "latency_ms": {"p50": 9608.36, "p90": 7481.68}, "quality_percent": 8520.51, "rate_limited_percent": null, "reliability_percent": 4403.61, "requests": 120000, "status": "available", "throughput_tokens_per_second": {"p50": 6877.93, "p90": 3053.2}, "uptime_percent": 99.2}, "window": "1d"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.endpoints.list_zdr_endpoints()`: `response.data[].perf_last_30m_by_workload.extractions` **Added** - * `open_router.endpoints.list()`: `response.data.endpoints[].perf_last_30m_by_workload.extractions` **Added** + * `open_router.providers.list_provider_endpoints()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 98940ed05..7598aa0c9 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.117 + version: 1.3.118 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 577696e8e..b14862bf4 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -11741,6 +11741,20 @@ components: - 'model' - 'selected' type: 'object' + EndpointRef: + properties: + endpoint_id: + description: 'Endpoint ID' + example: '0198c3f1-7b9a-7c31-a2d4-5e6f7a8b9c0d' + type: 'string' + model_slug: + description: 'Public model slug' + example: 'z-ai/glm-5.3' + type: 'string' + required: + - 'endpoint_id' + - 'model_slug' + type: 'object' EndpointsMetadata: example: available: @@ -11770,6 +11784,346 @@ components: example: 0 type: 'integer' x-speakeasy-unknown-values: allow + EndpointSummary: + allOf: + - $ref: '#/components/schemas/EndpointRef' + - properties: + created_at: + description: 'When the endpoint was created' + example: '2026-08-20T00:00:00.000Z' + type: 'string' + model_permaslug: + description: 'Permanent model slug the endpoint is listed under' + example: 'z-ai/glm-5.3-20260101' + type: 'string' + provider_model_id: + description: 'The provider''s own model ID' + example: 'accounts/fireworks/models/glm-5p3' + type: + - 'string' + - 'null' + provider_name: + description: 'Provider name' + example: 'Fireworks' + type: 'string' + provider_region: + description: 'Serving region' + example: 'us' + type: + - 'string' + - 'null' + service_tier: + description: 'Service tier; null for the default tier' + example: 'priority' + type: + - 'string' + - 'null' + test_profile: + $ref: '#/components/schemas/EndpointTestProfile' + variant: + description: 'Endpoint variant' + example: 'standard' + type: 'string' + visibility: + description: 'Whether the endpoint is listed on OpenRouter' + enum: + - 'visible' + - 'hidden' + example: 'visible' + type: 'string' + x-speakeasy-unknown-values: allow + required: + - 'model_permaslug' + - 'provider_name' + - 'provider_model_id' + - 'variant' + - 'provider_region' + - 'service_tier' + - 'visibility' + - 'created_at' + - 'test_profile' + type: 'object' + EndpointTestProfile: + properties: + context_length: + description: 'Context length the endpoint serves: its override, else the model''s' + example: 128000 + type: + - 'integer' + - 'null' + default_reasoning_return_mechanism: + description: 'Reasoning return mechanism the endpoint uses when neither its features nor the model set one' + enum: + - 'content-string' + - 'reasoning-content' + - 'reasoning' + - 'none' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + effective_adapter_name: + description: 'Adapter the endpoint is served through: its provider override, else the provider''s; null when unresolved' + example: 'openai' + type: + - 'string' + - 'null' + endpoint_features: + additionalProperties: {} + description: 'Endpoint feature flags; null when unset or invalid' + type: + - 'object' + - 'null' + is_lab_trusted: + description: 'Whether the endpoint serves a closed lab model through the lab or an official partner' + type: 'boolean' + model: + properties: + features: + properties: + chat_template_config: + properties: + instruction_role_support: + description: 'How leading instruction (developer/system) messages are mapped before reaching a chat-completions provider. ''developer'' keeps the developer role, ''system'' downgrades developer to system, ''user-only'' downgrades both to a wrapped user message. Overridable per-endpoint.' + enum: + - 'developer' + - 'system' + - 'user-only' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + should_hoist_and_merge_system_messages: + description: 'Whether to hoist and merge system messages' + type: + - 'boolean' + - 'null' + supports_mid_session_system: + description: 'Whether the model accepts system/developer messages that appear after the first user/assistant turn. When false, mid-session instruction messages are downgraded to wrapped user messages. Overridable per-endpoint.' + type: + - 'boolean' + - 'null' + type: + - 'object' + - 'null' + reasoning_config: + properties: + default_reasoning_effort: + enum: + - 'max' + - 'xhigh' + - 'high' + - 'medium' + - 'low' + - 'minimal' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + default_reasoning_enabled: + description: 'Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this.' + type: + - 'boolean' + - 'null' + end_token: + type: + - 'string' + - 'null' + is_mandatory_reasoning: + type: + - 'boolean' + - 'null' + reasoning_return_mechanism: + description: 'Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.' + enum: + - 'content-string' + - 'reasoning-content' + - 'reasoning' + - 'none' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + start_token: + type: + - 'string' + - 'null' + supported_reasoning_efforts: + description: 'List of reasoning effort values the model accepts upstream' + items: + enum: + - 'max' + - 'xhigh' + - 'high' + - 'medium' + - 'low' + - 'minimal' + type: 'string' + x-speakeasy-unknown-values: allow + type: + - 'array' + - 'null' + supports_reasoning_effort: + description: 'Whether the model supports reasoning effort' + type: + - 'boolean' + - 'null' + supports_reasoning_max_tokens: + description: 'Whether the model supports reasoning max tokens' + type: + - 'boolean' + - 'null' + system_prompt: + type: + - 'string' + - 'null' + type: + - 'object' + - 'null' + required_input_modalities: + description: 'Input modalities every request to the model must include, e.g. ["video"] for video-to-video-only models. Requests missing a required modality are rejected before dispatch. A required text modality is satisfied by the prompt. Currently enforced on the video generation request path.' + items: + enum: + - 'text' + - 'image' + - 'audio' + - 'video' + type: 'string' + x-speakeasy-unknown-values: allow + type: + - 'array' + - 'null' + type: + - 'object' + - 'null' + input_modalities: + items: + enum: + - 'text' + - 'image' + - 'file' + - 'audio' + - 'video' + type: 'string' + x-speakeasy-unknown-values: allow + type: 'array' + output_modalities: + items: + enum: + - 'text' + - 'image' + - 'embeddings' + - 'audio' + - 'video' + - 'rerank' + - 'decisions' + - 'speech' + - 'transcription' + type: 'string' + x-speakeasy-unknown-values: allow + type: 'array' + reasoning_config: + properties: + default_reasoning_effort: + enum: + - 'max' + - 'xhigh' + - 'high' + - 'medium' + - 'low' + - 'minimal' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + default_reasoning_enabled: + description: 'Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this.' + type: + - 'boolean' + - 'null' + end_token: + type: + - 'string' + - 'null' + is_mandatory_reasoning: + type: + - 'boolean' + - 'null' + reasoning_return_mechanism: + description: 'Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.' + enum: + - 'content-string' + - 'reasoning-content' + - 'reasoning' + - 'none' + - null + type: + - 'string' + - 'null' + x-speakeasy-unknown-values: allow + start_token: + type: + - 'string' + - 'null' + supported_reasoning_efforts: + description: 'List of reasoning effort values the model accepts upstream' + items: + enum: + - 'max' + - 'xhigh' + - 'high' + - 'medium' + - 'low' + - 'minimal' + type: 'string' + x-speakeasy-unknown-values: allow + type: + - 'array' + - 'null' + supports_reasoning_effort: + description: 'Whether the model supports reasoning effort' + type: + - 'boolean' + - 'null' + supports_reasoning_max_tokens: + description: 'Whether the model supports reasoning max tokens' + type: + - 'boolean' + - 'null' + system_prompt: + type: + - 'string' + - 'null' + type: + - 'object' + - 'null' + slug: + description: 'Public model slug' + example: 'z-ai/glm-5.3' + type: 'string' + supports_reasoning: + type: 'boolean' + required: + - 'slug' + - 'input_modalities' + - 'output_modalities' + - 'supports_reasoning' + - 'reasoning_config' + - 'features' + type: 'object' + required: + - 'model' + - 'endpoint_features' + - 'default_reasoning_return_mechanism' + - 'is_lab_trusted' + - 'context_length' + - 'effective_adapter_name' + type: 'object' EnumCapability: description: 'A parameter that accepts one of a discrete set of string values.' example: @@ -27671,6 +28025,145 @@ components: example: 'user_only' type: 'string' x-speakeasy-unknown-values: allow + ProviderEndpoints: + properties: + endpoints: + items: + $ref: '#/components/schemas/EndpointSummary' + type: 'array' + stats: + $ref: '#/components/schemas/ProviderEndpointStats' + window: + description: 'Time window the provider-wide stats cover' + enum: + - '1hr' + - '1d' + - '1w' + - '1mo' + - '1y' + example: '1d' + type: 'string' + x-speakeasy-unknown-values: allow + required: + - 'window' + - 'endpoints' + - 'stats' + type: 'object' + ProviderEndpointsResponse: + properties: + data: + $ref: '#/components/schemas/ProviderEndpoints' + required: + - 'data' + type: 'object' + ProviderEndpointStats: + discriminator: + mapping: + available: '#/components/schemas/ProviderEndpointStatsAvailable' + unavailable: '#/components/schemas/ProviderEndpointStatsUnavailable' + propertyName: 'status' + oneOf: + - $ref: '#/components/schemas/ProviderEndpointStatsAvailable' + - $ref: '#/components/schemas/ProviderEndpointStatsUnavailable' + ProviderEndpointStatsAvailable: + properties: + endpoint_count: + description: 'Endpoints the stats cover' + example: 12 + type: 'integer' + error_rate_percent: + description: 'Errored share of requests that count toward uptime, 0-100' + example: 0.8 + format: 'double' + type: 'number' + latency_ms: + description: 'Request latency, milliseconds' + properties: + p50: + format: 'double' + type: + - 'number' + - 'null' + p90: + format: 'double' + type: + - 'number' + - 'null' + required: + - 'p50' + - 'p90' + type: 'object' + quality_percent: + description: 'Routing quality, 0-100' + format: 'double' + type: + - 'number' + - 'null' + rate_limited_percent: + description: 'Rate-limited share of routed requests, 0-100' + format: 'double' + type: + - 'number' + - 'null' + reliability_percent: + description: 'Routing reliability, 0-100' + format: 'double' + type: + - 'number' + - 'null' + requests: + description: 'Requests in the window' + example: 120000 + type: 'integer' + status: + enum: + - 'available' + type: 'string' + throughput_tokens_per_second: + description: 'Output tokens per second' + properties: + p50: + format: 'double' + type: + - 'number' + - 'null' + p90: + format: 'double' + type: + - 'number' + - 'null' + required: + - 'p50' + - 'p90' + type: 'object' + uptime_percent: + description: 'Successful share of requests that count toward uptime, 0-100' + example: 99.2 + format: 'double' + type: + - 'number' + - 'null' + required: + - 'status' + - 'endpoint_count' + - 'requests' + - 'uptime_percent' + - 'error_rate_percent' + - 'reliability_percent' + - 'quality_percent' + - 'rate_limited_percent' + - 'latency_ms' + - 'throughput_tokens_per_second' + type: 'object' + ProviderEndpointStatsUnavailable: + properties: + status: + enum: + - 'unavailable' + type: 'string' + required: + - 'status' + type: 'object' ProviderName: enum: - 'Modal' @@ -51329,6 +51822,129 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /providers/{provider_slug}/endpoints: + get: + description: 'Returns every endpoint the provider serves, hidden ones included, with the provider-wide uptime, routing, latency and throughput stats over the window. Requires provider ownership, membership, or admin access.' + operationId: 'listProviderEndpoints' + parameters: + - description: 'URL-friendly provider identifier (e.g. "openai", "fireworks")' + in: 'path' + name: 'provider_slug' + required: true + schema: + description: 'URL-friendly provider identifier (e.g. "openai", "fireworks")' + example: 'fireworks' + type: 'string' + - description: 'Time window the provider-wide stats cover' + in: 'query' + name: 'window' + required: false + schema: + default: '1mo' + description: 'Time window the provider-wide stats cover' + enum: + - '1hr' + - '1d' + - '1w' + - '1mo' + - '1y' + example: '1d' + type: 'string' + x-speakeasy-unknown-values: allow + - description: 'Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve' + in: 'query' + name: 'perf_workload' + required: false + schema: + description: 'Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve' + enum: + - 'text_generation' + - 'image_generation' + - 'video_generation' + - 'embeddings' + - 'rerank' + - 'tts' + - 'stt' + - 'decisions' + - 'extractions' + - 'unknown' + example: 'text_generation' + type: 'string' + x-speakeasy-unknown-values: allow + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ProviderEndpointsResponse' + description: 'The provider''s endpoints and provider-wide stats' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded' + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: 'Too Many Requests - Rate limit exceeded' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List a provider''s endpoints with provider-wide stats' + tags: + - 'Providers' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /rerank: post: description: 'Submits a rerank request to the rerank router' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2a1552437..4a530d877 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:0aaafeea58daa417ec936f5d70e15b85e4c403eb26936157963615c4c068e5cd - sourceBlobDigest: sha256:6e78f4335a4d0eb14a07db01a557dbaed1607d4c8064042d59cfbb69c946f473 + sourceRevisionDigest: sha256:270fc87d246d3c0aae8ed0dc177f71a2ac5ab6d8a9d159374587dd7f47b71843 + sourceBlobDigest: sha256:b2e03dfdbedaa98c8829f3895d84615b1bfae6f3eb6dde39dde7d6e51648d1e1 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:0aaafeea58daa417ec936f5d70e15b85e4c403eb26936157963615c4c068e5cd - sourceBlobDigest: sha256:6e78f4335a4d0eb14a07db01a557dbaed1607d4c8064042d59cfbb69c946f473 + sourceRevisionDigest: sha256:270fc87d246d3c0aae8ed0dc177f71a2ac5ab6d8a9d159374587dd7f47b71843 + sourceBlobDigest: sha256:b2e03dfdbedaa98c8829f3895d84615b1bfae6f3eb6dde39dde7d6e51648d1e1 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f4815fcf5eeb79c459b750a886819c3be6e417740a06c690e948ba0ed9652415 + codeSamplesRevisionDigest: sha256:4da37ce693bd87fea87c9e730f88fae9a3a55b038b2b9b99d96dfefa1b63396a workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index c54d5be40..37b544153 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3939,4 +3939,14 @@ Based on: ### Generated - [python v1.3.117] . ### Releases -- [PyPI v1.3.117] https://pypi.org/project/openrouter/1.3.117 - . \ No newline at end of file +- [PyPI v1.3.117] https://pypi.org/project/openrouter/1.3.117 - . + +## 2026-11-04 19:12:17 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.118] . +### Releases +- [PyPI v1.3.118] https://pypi.org/project/openrouter/1.3.118 - . \ No newline at end of file diff --git a/docs/components/chattemplateconfig.mdx b/docs/components/chattemplateconfig.mdx new file mode 100644 index 000000000..d957a1e60 --- /dev/null +++ b/docs/components/chattemplateconfig.mdx @@ -0,0 +1,11 @@ +--- +title: "ChatTemplateConfig" +--- + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `instruction_role_support` | [OptionalNullable[components.InstructionRoleSupport]](../components/instructionrolesupport.mdx) | ➖ | How leading instruction (developer/system) messages are mapped before reaching a chat-completions provider. 'developer' keeps the developer role, 'system' downgrades developer to system, 'user-only' downgrades both to a wrapped user message. Overridable per-endpoint. | +| `should_hoist_and_merge_system_messages` | *OptionalNullable[bool]* | ➖ | Whether to hoist and merge system messages | +| `supports_mid_session_system` | *OptionalNullable[bool]* | ➖ | Whether the model accepts system/developer messages that appear after the first user/assistant turn. When false, mid-session instruction messages are downgraded to wrapped user messages. Overridable per-endpoint. | \ No newline at end of file diff --git a/docs/components/defaultreasoningeffort.mdx b/docs/components/defaultreasoningeffort.mdx new file mode 100644 index 000000000..8516502b7 --- /dev/null +++ b/docs/components/defaultreasoningeffort.mdx @@ -0,0 +1,24 @@ +--- +title: "DefaultReasoningEffort" +--- + +## Example Usage + +```python +from openrouter.components import DefaultReasoningEffort + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: DefaultReasoningEffort = "max" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"max"` +- `"xhigh"` +- `"high"` +- `"medium"` +- `"low"` +- `"minimal"` diff --git a/docs/components/defaultreasoningreturnmechanism.mdx b/docs/components/defaultreasoningreturnmechanism.mdx new file mode 100644 index 000000000..9a185dec3 --- /dev/null +++ b/docs/components/defaultreasoningreturnmechanism.mdx @@ -0,0 +1,24 @@ +--- +title: "DefaultReasoningReturnMechanism" +--- + +Reasoning return mechanism the endpoint uses when neither its features nor the model set one + +## Example Usage + +```python +from openrouter.components import DefaultReasoningReturnMechanism + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: DefaultReasoningReturnMechanism = "content-string" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"content-string"` +- `"reasoning-content"` +- `"reasoning"` +- `"none"` diff --git a/docs/components/endpointsummary.mdx b/docs/components/endpointsummary.mdx new file mode 100644 index 000000000..62ddd1261 --- /dev/null +++ b/docs/components/endpointsummary.mdx @@ -0,0 +1,19 @@ +--- +title: "EndpointSummary" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `endpoint_id` | *str* | ✔️ | Endpoint ID | 0198c3f1-7b9a-7c31-a2d4-5e6f7a8b9c0d | +| `model_slug` | *str* | ✔️ | Public model slug | z-ai/glm-5.3 | +| `created_at` | *str* | ✔️ | When the endpoint was created | 2026-08-20T00:00:00.000Z | +| `model_permaslug` | *str* | ✔️ | Permanent model slug the endpoint is listed under | z-ai/glm-5.3-20260101 | +| `provider_model_id` | *Nullable[str]* | ✔️ | The provider's own model ID | accounts/fireworks/models/glm-5p3 | +| `provider_name` | *str* | ✔️ | Provider name | Fireworks | +| `provider_region` | *Nullable[str]* | ✔️ | Serving region | us | +| `service_tier` | *Nullable[str]* | ✔️ | Service tier; null for the default tier | priority | +| `test_profile` | [components.EndpointTestProfile](../components/endpointtestprofile.mdx) | ✔️ | N/A | | +| `variant` | *str* | ✔️ | Endpoint variant | standard | +| `visibility` | [components.Visibility](../components/visibility.mdx) | ✔️ | Whether the endpoint is listed on OpenRouter | visible | \ No newline at end of file diff --git a/docs/components/endpointtestprofile.mdx b/docs/components/endpointtestprofile.mdx new file mode 100644 index 000000000..3a4fdcc04 --- /dev/null +++ b/docs/components/endpointtestprofile.mdx @@ -0,0 +1,14 @@ +--- +title: "EndpointTestProfile" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `context_length` | *Nullable[int]* | ✔️ | Context length the endpoint serves: its override, else the model's | 128000 | +| `default_reasoning_return_mechanism` | [Nullable[components.DefaultReasoningReturnMechanism]](../components/defaultreasoningreturnmechanism.mdx) | ✔️ | Reasoning return mechanism the endpoint uses when neither its features nor the model set one | | +| `effective_adapter_name` | *Nullable[str]* | ✔️ | Adapter the endpoint is served through: its provider override, else the provider's; null when unresolved | openai | +| `endpoint_features` | Dict[str, *Any*] | ✔️ | Endpoint feature flags; null when unset or invalid | | +| `is_lab_trusted` | *bool* | ✔️ | Whether the endpoint serves a closed lab model through the lab or an official partner | | +| `model` | [components.EndpointTestProfileModel](../components/endpointtestprofilemodel.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/endpointtestprofileinputmodality.mdx b/docs/components/endpointtestprofileinputmodality.mdx new file mode 100644 index 000000000..0afb96682 --- /dev/null +++ b/docs/components/endpointtestprofileinputmodality.mdx @@ -0,0 +1,23 @@ +--- +title: "EndpointTestProfileInputModality" +--- + +## Example Usage + +```python +from openrouter.components import EndpointTestProfileInputModality + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: EndpointTestProfileInputModality = "text" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"text"` +- `"image"` +- `"file"` +- `"audio"` +- `"video"` diff --git a/docs/components/endpointtestprofilemodel.mdx b/docs/components/endpointtestprofilemodel.mdx new file mode 100644 index 000000000..fa1eb5726 --- /dev/null +++ b/docs/components/endpointtestprofilemodel.mdx @@ -0,0 +1,14 @@ +--- +title: "EndpointTestProfileModel" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `features` | [Nullable[components.Features]](../components/features.mdx) | ✔️ | N/A | | +| `input_modalities` | List[[components.EndpointTestProfileInputModality](../components/endpointtestprofileinputmodality.mdx)] | ✔️ | N/A | | +| `output_modalities` | List[[components.EndpointTestProfileOutputModality](../components/endpointtestprofileoutputmodality.mdx)] | ✔️ | N/A | | +| `reasoning_config` | [Nullable[components.EndpointTestProfileReasoningConfig]](../components/endpointtestprofilereasoningconfig.mdx) | ✔️ | N/A | | +| `slug` | *str* | ✔️ | Public model slug | z-ai/glm-5.3 | +| `supports_reasoning` | *bool* | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/endpointtestprofileoutputmodality.mdx b/docs/components/endpointtestprofileoutputmodality.mdx new file mode 100644 index 000000000..14d81efa3 --- /dev/null +++ b/docs/components/endpointtestprofileoutputmodality.mdx @@ -0,0 +1,27 @@ +--- +title: "EndpointTestProfileOutputModality" +--- + +## Example Usage + +```python +from openrouter.components import EndpointTestProfileOutputModality + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: EndpointTestProfileOutputModality = "text" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"text"` +- `"image"` +- `"embeddings"` +- `"audio"` +- `"video"` +- `"rerank"` +- `"decisions"` +- `"speech"` +- `"transcription"` diff --git a/docs/components/endpointtestprofilereasoningconfig.mdx b/docs/components/endpointtestprofilereasoningconfig.mdx new file mode 100644 index 000000000..b9983570e --- /dev/null +++ b/docs/components/endpointtestprofilereasoningconfig.mdx @@ -0,0 +1,18 @@ +--- +title: "EndpointTestProfileReasoningConfig" +--- + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `default_reasoning_effort` | [OptionalNullable[components.DefaultReasoningEffort]](../components/defaultreasoningeffort.mdx) | ➖ | N/A | +| `default_reasoning_enabled` | *OptionalNullable[bool]* | ➖ | Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this. | +| `end_token` | *OptionalNullable[str]* | ➖ | N/A | +| `is_mandatory_reasoning` | *OptionalNullable[bool]* | ➖ | N/A | +| `reasoning_return_mechanism` | [OptionalNullable[components.ReasoningReturnMechanism]](../components/reasoningreturnmechanism.mdx) | ➖ | Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features. | +| `start_token` | *OptionalNullable[str]* | ➖ | N/A | +| `supported_reasoning_efforts` | List[[components.SupportedReasoningEffort](../components/supportedreasoningeffort.mdx)] | ➖ | List of reasoning effort values the model accepts upstream | +| `supports_reasoning_effort` | *OptionalNullable[bool]* | ➖ | Whether the model supports reasoning effort | +| `supports_reasoning_max_tokens` | *OptionalNullable[bool]* | ➖ | Whether the model supports reasoning max tokens | +| `system_prompt` | *OptionalNullable[str]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/features.mdx b/docs/components/features.mdx new file mode 100644 index 000000000..d179320ea --- /dev/null +++ b/docs/components/features.mdx @@ -0,0 +1,11 @@ +--- +title: "Features" +--- + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `chat_template_config` | [OptionalNullable[components.ChatTemplateConfig]](../components/chattemplateconfig.mdx) | ➖ | N/A | +| `reasoning_config` | [OptionalNullable[components.FeaturesReasoningConfig]](../components/featuresreasoningconfig.mdx) | ➖ | N/A | +| `required_input_modalities` | List[[components.RequiredInputModality](../components/requiredinputmodality.mdx)] | ➖ | Input modalities every request to the model must include, e.g. ["video"] for video-to-video-only models. Requests missing a required modality are rejected before dispatch. A required text modality is satisfied by the prompt. Currently enforced on the video generation request path. | \ No newline at end of file diff --git a/docs/components/featuresdefaultreasoningeffort.mdx b/docs/components/featuresdefaultreasoningeffort.mdx new file mode 100644 index 000000000..d04709713 --- /dev/null +++ b/docs/components/featuresdefaultreasoningeffort.mdx @@ -0,0 +1,24 @@ +--- +title: "FeaturesDefaultReasoningEffort" +--- + +## Example Usage + +```python +from openrouter.components import FeaturesDefaultReasoningEffort + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: FeaturesDefaultReasoningEffort = "max" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"max"` +- `"xhigh"` +- `"high"` +- `"medium"` +- `"low"` +- `"minimal"` diff --git a/docs/components/featuresreasoningconfig.mdx b/docs/components/featuresreasoningconfig.mdx new file mode 100644 index 000000000..0d6767104 --- /dev/null +++ b/docs/components/featuresreasoningconfig.mdx @@ -0,0 +1,18 @@ +--- +title: "FeaturesReasoningConfig" +--- + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `default_reasoning_effort` | [OptionalNullable[components.FeaturesDefaultReasoningEffort]](../components/featuresdefaultreasoningeffort.mdx) | ➖ | N/A | +| `default_reasoning_enabled` | *OptionalNullable[bool]* | ➖ | Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this. | +| `end_token` | *OptionalNullable[str]* | ➖ | N/A | +| `is_mandatory_reasoning` | *OptionalNullable[bool]* | ➖ | N/A | +| `reasoning_return_mechanism` | [OptionalNullable[components.FeaturesReasoningReturnMechanism]](../components/featuresreasoningreturnmechanism.mdx) | ➖ | Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features. | +| `start_token` | *OptionalNullable[str]* | ➖ | N/A | +| `supported_reasoning_efforts` | List[[components.FeaturesSupportedReasoningEffort](../components/featuressupportedreasoningeffort.mdx)] | ➖ | List of reasoning effort values the model accepts upstream | +| `supports_reasoning_effort` | *OptionalNullable[bool]* | ➖ | Whether the model supports reasoning effort | +| `supports_reasoning_max_tokens` | *OptionalNullable[bool]* | ➖ | Whether the model supports reasoning max tokens | +| `system_prompt` | *OptionalNullable[str]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/components/featuresreasoningreturnmechanism.mdx b/docs/components/featuresreasoningreturnmechanism.mdx new file mode 100644 index 000000000..067b63cc4 --- /dev/null +++ b/docs/components/featuresreasoningreturnmechanism.mdx @@ -0,0 +1,24 @@ +--- +title: "FeaturesReasoningReturnMechanism" +--- + +Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features. + +## Example Usage + +```python +from openrouter.components import FeaturesReasoningReturnMechanism + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: FeaturesReasoningReturnMechanism = "content-string" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"content-string"` +- `"reasoning-content"` +- `"reasoning"` +- `"none"` diff --git a/docs/components/featuressupportedreasoningeffort.mdx b/docs/components/featuressupportedreasoningeffort.mdx new file mode 100644 index 000000000..c6f07dceb --- /dev/null +++ b/docs/components/featuressupportedreasoningeffort.mdx @@ -0,0 +1,24 @@ +--- +title: "FeaturesSupportedReasoningEffort" +--- + +## Example Usage + +```python +from openrouter.components import FeaturesSupportedReasoningEffort + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: FeaturesSupportedReasoningEffort = "max" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"max"` +- `"xhigh"` +- `"high"` +- `"medium"` +- `"low"` +- `"minimal"` diff --git a/docs/components/instructionrolesupport.mdx b/docs/components/instructionrolesupport.mdx new file mode 100644 index 000000000..d12c96f80 --- /dev/null +++ b/docs/components/instructionrolesupport.mdx @@ -0,0 +1,23 @@ +--- +title: "InstructionRoleSupport" +--- + +How leading instruction (developer/system) messages are mapped before reaching a chat-completions provider. 'developer' keeps the developer role, 'system' downgrades developer to system, 'user-only' downgrades both to a wrapped user message. Overridable per-endpoint. + +## Example Usage + +```python +from openrouter.components import InstructionRoleSupport + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: InstructionRoleSupport = "developer" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"developer"` +- `"system"` +- `"user-only"` diff --git a/docs/components/latencyms.mdx b/docs/components/latencyms.mdx new file mode 100644 index 000000000..8740fcc1c --- /dev/null +++ b/docs/components/latencyms.mdx @@ -0,0 +1,13 @@ +--- +title: "LatencyMs" +--- + +Request latency, milliseconds + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `p50` | *Nullable[float]* | ✔️ | N/A | +| `p90` | *Nullable[float]* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/providerendpoints.mdx b/docs/components/providerendpoints.mdx new file mode 100644 index 000000000..2fa98c5f5 --- /dev/null +++ b/docs/components/providerendpoints.mdx @@ -0,0 +1,11 @@ +--- +title: "ProviderEndpoints" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `endpoints` | List[[components.EndpointSummary](../components/endpointsummary.mdx)] | ✔️ | N/A | | +| `stats` | [components.ProviderEndpointStats](../components/providerendpointstats.mdx) | ✔️ | N/A | | +| `window` | [components.Window](../components/window.mdx) | ✔️ | Time window the provider-wide stats cover | 1d | \ No newline at end of file diff --git a/docs/components/providerendpointsresponse.mdx b/docs/components/providerendpointsresponse.mdx new file mode 100644 index 000000000..93121830d --- /dev/null +++ b/docs/components/providerendpointsresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ProviderEndpointsResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `data` | [components.ProviderEndpoints](../components/providerendpoints.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/providerendpointstats.mdx b/docs/components/providerendpointstats.mdx new file mode 100644 index 000000000..0d36b106c --- /dev/null +++ b/docs/components/providerendpointstats.mdx @@ -0,0 +1,18 @@ +--- +title: "ProviderEndpointStats" +--- + +## Supported Types + +### `components.ProviderEndpointStatsAvailable` + +```python +value: components.ProviderEndpointStatsAvailable = /* values here */ +``` + +### `components.ProviderEndpointStatsUnavailable` + +```python +value: components.ProviderEndpointStatsUnavailable = /* values here */ +``` + diff --git a/docs/components/providerendpointstatsavailable.mdx b/docs/components/providerendpointstatsavailable.mdx new file mode 100644 index 000000000..f18332bc3 --- /dev/null +++ b/docs/components/providerendpointstatsavailable.mdx @@ -0,0 +1,18 @@ +--- +title: "ProviderEndpointStatsAvailable" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `endpoint_count` | *int* | ✔️ | Endpoints the stats cover | 12 | +| `error_rate_percent` | *float* | ✔️ | Errored share of requests that count toward uptime, 0-100 | 0.8 | +| `latency_ms` | [components.LatencyMs](../components/latencyms.mdx) | ✔️ | Request latency, milliseconds | | +| `quality_percent` | *Nullable[float]* | ✔️ | Routing quality, 0-100 | | +| `rate_limited_percent` | *Nullable[float]* | ✔️ | Rate-limited share of routed requests, 0-100 | | +| `reliability_percent` | *Nullable[float]* | ✔️ | Routing reliability, 0-100 | | +| `requests` | *int* | ✔️ | Requests in the window | 120000 | +| `status` | [components.ProviderEndpointStatsAvailableStatus](../components/providerendpointstatsavailablestatus.mdx) | ✔️ | N/A | | +| `throughput_tokens_per_second` | [components.ThroughputTokensPerSecond](../components/throughputtokenspersecond.mdx) | ✔️ | Output tokens per second | | +| `uptime_percent` | *Nullable[float]* | ✔️ | Successful share of requests that count toward uptime, 0-100 | 99.2 | \ No newline at end of file diff --git a/docs/components/providerendpointstatsavailablestatus.mdx b/docs/components/providerendpointstatsavailablestatus.mdx new file mode 100644 index 000000000..43d1f481a --- /dev/null +++ b/docs/components/providerendpointstatsavailablestatus.mdx @@ -0,0 +1,15 @@ +--- +title: "ProviderEndpointStatsAvailableStatus" +--- + +## Example Usage + +```python +from openrouter.components import ProviderEndpointStatsAvailableStatus +value: ProviderEndpointStatsAvailableStatus = "available" +``` + + +## Values + +- `"available"` diff --git a/docs/components/providerendpointstatsunavailable.mdx b/docs/components/providerendpointstatsunavailable.mdx new file mode 100644 index 000000000..d7b19cd60 --- /dev/null +++ b/docs/components/providerendpointstatsunavailable.mdx @@ -0,0 +1,9 @@ +--- +title: "ProviderEndpointStatsUnavailable" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `status` | [components.ProviderEndpointStatsUnavailableStatus](../components/providerendpointstatsunavailablestatus.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/providerendpointstatsunavailablestatus.mdx b/docs/components/providerendpointstatsunavailablestatus.mdx new file mode 100644 index 000000000..5f99ed2cf --- /dev/null +++ b/docs/components/providerendpointstatsunavailablestatus.mdx @@ -0,0 +1,15 @@ +--- +title: "ProviderEndpointStatsUnavailableStatus" +--- + +## Example Usage + +```python +from openrouter.components import ProviderEndpointStatsUnavailableStatus +value: ProviderEndpointStatsUnavailableStatus = "unavailable" +``` + + +## Values + +- `"unavailable"` diff --git a/docs/components/reasoningreturnmechanism.mdx b/docs/components/reasoningreturnmechanism.mdx new file mode 100644 index 000000000..ab2b9418c --- /dev/null +++ b/docs/components/reasoningreturnmechanism.mdx @@ -0,0 +1,24 @@ +--- +title: "ReasoningReturnMechanism" +--- + +Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features. + +## Example Usage + +```python +from openrouter.components import ReasoningReturnMechanism + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ReasoningReturnMechanism = "content-string" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"content-string"` +- `"reasoning-content"` +- `"reasoning"` +- `"none"` diff --git a/docs/components/requiredinputmodality.mdx b/docs/components/requiredinputmodality.mdx new file mode 100644 index 000000000..5255fbcda --- /dev/null +++ b/docs/components/requiredinputmodality.mdx @@ -0,0 +1,22 @@ +--- +title: "RequiredInputModality" +--- + +## Example Usage + +```python +from openrouter.components import RequiredInputModality + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: RequiredInputModality = "text" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"text"` +- `"image"` +- `"audio"` +- `"video"` diff --git a/docs/components/supportedreasoningeffort.mdx b/docs/components/supportedreasoningeffort.mdx new file mode 100644 index 000000000..1911d4dfd --- /dev/null +++ b/docs/components/supportedreasoningeffort.mdx @@ -0,0 +1,24 @@ +--- +title: "SupportedReasoningEffort" +--- + +## Example Usage + +```python +from openrouter.components import SupportedReasoningEffort + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: SupportedReasoningEffort = "max" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"max"` +- `"xhigh"` +- `"high"` +- `"medium"` +- `"low"` +- `"minimal"` diff --git a/docs/components/throughputtokenspersecond.mdx b/docs/components/throughputtokenspersecond.mdx new file mode 100644 index 000000000..f36915f61 --- /dev/null +++ b/docs/components/throughputtokenspersecond.mdx @@ -0,0 +1,13 @@ +--- +title: "ThroughputTokensPerSecond" +--- + +Output tokens per second + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `p50` | *Nullable[float]* | ✔️ | N/A | +| `p90` | *Nullable[float]* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/visibility.mdx b/docs/components/visibility.mdx new file mode 100644 index 000000000..85c28caf1 --- /dev/null +++ b/docs/components/visibility.mdx @@ -0,0 +1,22 @@ +--- +title: "Visibility" +--- + +Whether the endpoint is listed on OpenRouter + +## Example Usage + +```python +from openrouter.components import Visibility + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Visibility = "visible" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"visible"` +- `"hidden"` diff --git a/docs/components/window.mdx b/docs/components/window.mdx new file mode 100644 index 000000000..6b84147b4 --- /dev/null +++ b/docs/components/window.mdx @@ -0,0 +1,25 @@ +--- +title: "Window" +--- + +Time window the provider-wide stats cover + +## Example Usage + +```python +from openrouter.components import Window + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Window = "1hr" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"1hr"` +- `"1d"` +- `"1w"` +- `"1mo"` +- `"1y"` diff --git a/docs/operations/gettaskclassificationsrequest.mdx b/docs/operations/gettaskclassificationsrequest.mdx index a2c427446..bf44a0d33 100644 --- a/docs/operations/gettaskclassificationsrequest.mdx +++ b/docs/operations/gettaskclassificationsrequest.mdx @@ -9,4 +9,4 @@ title: "GetTaskClassificationsRequest" | `http_referer` | *Optional[str]* | ➖ | 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]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `window` | [Optional[operations.Window]](../operations/window.mdx) | ➖ | Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported. | 7d | \ No newline at end of file +| `window` | [Optional[operations.GetTaskClassificationsWindow]](../operations/gettaskclassificationswindow.mdx) | ➖ | Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported. | 7d | \ No newline at end of file diff --git a/docs/operations/window.mdx b/docs/operations/gettaskclassificationswindow.mdx similarity index 53% rename from docs/operations/window.mdx rename to docs/operations/gettaskclassificationswindow.mdx index 52168404b..e0e1a0f03 100644 --- a/docs/operations/window.mdx +++ b/docs/operations/gettaskclassificationswindow.mdx @@ -1,5 +1,5 @@ --- -title: "Window" +title: "GetTaskClassificationsWindow" --- Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported. @@ -7,8 +7,8 @@ Trailing time window for the classification data. Currently only `7d` (trailing ## Example Usage ```python -from openrouter.operations import Window -value: Window = "7d" +from openrouter.operations import GetTaskClassificationsWindow +value: GetTaskClassificationsWindow = "7d" ``` diff --git a/docs/operations/listproviderendpointsglobals.mdx b/docs/operations/listproviderendpointsglobals.mdx new file mode 100644 index 000000000..65a8151dd --- /dev/null +++ b/docs/operations/listproviderendpointsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListProviderEndpointsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | 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]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listproviderendpointsrequest.mdx b/docs/operations/listproviderendpointsrequest.mdx new file mode 100644 index 000000000..3dbaa9207 --- /dev/null +++ b/docs/operations/listproviderendpointsrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "ListProviderEndpointsRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | 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]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `provider_slug` | *str* | ✔️ | URL-friendly provider identifier (e.g. "openai", "fireworks") | fireworks | +| `window` | [Optional[operations.ListProviderEndpointsWindow]](../operations/listproviderendpointswindow.mdx) | ➖ | Time window the provider-wide stats cover | 1d | +| `perf_workload` | [Optional[operations.PerfWorkload]](../operations/perfworkload.mdx) | ➖ | Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve | text_generation | \ No newline at end of file diff --git a/docs/operations/listproviderendpointswindow.mdx b/docs/operations/listproviderendpointswindow.mdx new file mode 100644 index 000000000..08fc9d1cf --- /dev/null +++ b/docs/operations/listproviderendpointswindow.mdx @@ -0,0 +1,25 @@ +--- +title: "ListProviderEndpointsWindow" +--- + +Time window the provider-wide stats cover + +## Example Usage + +```python +from openrouter.operations import ListProviderEndpointsWindow + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ListProviderEndpointsWindow = "1hr" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"1hr"` +- `"1d"` +- `"1w"` +- `"1mo"` +- `"1y"` diff --git a/docs/operations/perfworkload.mdx b/docs/operations/perfworkload.mdx new file mode 100644 index 000000000..6a4dd0d44 --- /dev/null +++ b/docs/operations/perfworkload.mdx @@ -0,0 +1,30 @@ +--- +title: "PerfWorkload" +--- + +Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve + +## Example Usage + +```python +from openrouter.operations import PerfWorkload + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: PerfWorkload = "text_generation" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"text_generation"` +- `"image_generation"` +- `"video_generation"` +- `"embeddings"` +- `"rerank"` +- `"tts"` +- `"stt"` +- `"decisions"` +- `"extractions"` +- `"unknown"` diff --git a/docs/sdks/classifications/README.mdx b/docs/sdks/classifications/README.mdx index c59bcbd8e..aa324667a 100644 --- a/docs/sdks/classifications/README.mdx +++ b/docs/sdks/classifications/README.mdx @@ -61,7 +61,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | ➖ | 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]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `window` | [Optional[operations.Window]](../../operations/window.mdx) | ➖ | Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported. | 7d | +| `window` | [Optional[operations.GetTaskClassificationsWindow]](../../operations/gettaskclassificationswindow.mdx) | ➖ | Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported. | 7d | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/providers/README.mdx b/docs/sdks/providers/README.mdx index fbd074b61..88e3620cf 100644 --- a/docs/sdks/providers/README.mdx +++ b/docs/sdks/providers/README.mdx @@ -10,6 +10,7 @@ Provider information endpoints ### Available Operations * [list](#list) - List all providers +* [list_provider_endpoints](#list_provider_endpoints) - List a provider's endpoints with provider-wide stats ## list @@ -54,4 +55,57 @@ with OpenRouter( | Error Type | Status Code | Content Type | | ---------------------------------- | ---------------------------------- | ---------------------------------- | | errors.InternalServerResponseError | 500 | application/json | -| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_provider_endpoints + +Returns every endpoint the provider serves, hidden ones included, with the provider-wide uptime, routing, latency and throughput stats over the window. Requires provider ownership, membership, or admin access. + +### 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.providers.list_provider_endpoints(provider_slug="fireworks", window="1d") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `provider_slug` | *str* | ✔️ | URL-friendly provider identifier (e.g. "openai", "fireworks") | fireworks | +| `http_referer` | *Optional[str]* | ➖ | 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]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `window` | [Optional[operations.ListProviderEndpointsWindow]](../../operations/listproviderendpointswindow.mdx) | ➖ | Time window the provider-wide stats cover | 1d | +| `perf_workload` | [Optional[operations.PerfWorkload]](../../operations/perfworkload.mdx) | ➖ | Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve | text_generation | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ProviderEndpointsResponse](../../components/providerendpointsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 4b565ff4b..605c91f8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.117" +version = "1.3.118" 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 e7ab1c303..1d94cdc5f 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.117" +__version__: str = "1.3.118" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.117 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.118 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/classifications.py b/src/openrouter/classifications.py index ad3d24795..192786c7c 100644 --- a/src/openrouter/classifications.py +++ b/src/openrouter/classifications.py @@ -18,7 +18,7 @@ def get_task_classifications( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - window: Optional[operations.Window] = "7d", + window: Optional[operations.GetTaskClassificationsWindow] = "7d", retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -171,7 +171,7 @@ async def get_task_classifications_async( http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - window: Optional[operations.Window] = "7d", + window: Optional[operations.GetTaskClassificationsWindow] = "7d", retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 921a7b338..a1b3836b0 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1803,6 +1803,32 @@ from .endpointinfo import EndpointInfo, EndpointInfoTypedDict from .endpointsmetadata import EndpointsMetadata, EndpointsMetadataTypedDict from .endpointstatus import EndpointStatus + from .endpointsummary import EndpointSummary, EndpointSummaryTypedDict, Visibility + from .endpointtestprofile import ( + ChatTemplateConfig, + ChatTemplateConfigTypedDict, + DefaultReasoningEffort, + DefaultReasoningReturnMechanism, + EndpointTestProfile, + EndpointTestProfileInputModality, + EndpointTestProfileModel, + EndpointTestProfileModelTypedDict, + EndpointTestProfileOutputModality, + EndpointTestProfileReasoningConfig, + EndpointTestProfileReasoningConfigTypedDict, + EndpointTestProfileTypedDict, + Features, + FeaturesDefaultReasoningEffort, + FeaturesReasoningConfig, + FeaturesReasoningConfigTypedDict, + FeaturesReasoningReturnMechanism, + FeaturesSupportedReasoningEffort, + FeaturesTypedDict, + InstructionRoleSupport, + ReasoningReturnMechanism, + RequiredInputModality, + SupportedReasoningEffort, + ) from .enumcapability import ( EnumCapability, EnumCapabilityType, @@ -3774,6 +3800,30 @@ PromptCacheOptionsTypedDict, ) from .promptinjectionscanscope import PromptInjectionScanScope + from .providerendpoints import ProviderEndpoints, ProviderEndpointsTypedDict, Window + from .providerendpointsresponse import ( + ProviderEndpointsResponse, + ProviderEndpointsResponseTypedDict, + ) + from .providerendpointstats import ( + ProviderEndpointStats, + ProviderEndpointStatsTypedDict, + UnknownProviderEndpointStats, + ) + from .providerendpointstatsavailable import ( + LatencyMs, + LatencyMsTypedDict, + ProviderEndpointStatsAvailable, + ProviderEndpointStatsAvailableStatus, + ProviderEndpointStatsAvailableTypedDict, + ThroughputTokensPerSecond, + ThroughputTokensPerSecondTypedDict, + ) + from .providerendpointstatsunavailable import ( + ProviderEndpointStatsUnavailable, + ProviderEndpointStatsUnavailableStatus, + ProviderEndpointStatsUnavailableTypedDict, + ) from .providername import ProviderName from .provideroptions import ProviderOptions, ProviderOptionsTypedDict from .provideroverloadedresponseerrordata import ( @@ -5503,6 +5553,8 @@ "ChatSystemMessageContentTypedDict", "ChatSystemMessageRole", "ChatSystemMessageTypedDict", + "ChatTemplateConfig", + "ChatTemplateConfigTypedDict", "ChatTokenLogprob", "ChatTokenLogprobTopLogprob", "ChatTokenLogprobTopLogprobTypedDict", @@ -5860,6 +5912,8 @@ "DefaultEffort", "DefaultParameters", "DefaultParametersTypedDict", + "DefaultReasoningEffort", + "DefaultReasoningReturnMechanism", "DeferredBm25Search", "DeferredBm25SearchType", "DeferredBm25SearchTypedDict", @@ -5929,6 +5983,16 @@ "EndpointInfo", "EndpointInfoTypedDict", "EndpointStatus", + "EndpointSummary", + "EndpointSummaryTypedDict", + "EndpointTestProfile", + "EndpointTestProfileInputModality", + "EndpointTestProfileModel", + "EndpointTestProfileModelTypedDict", + "EndpointTestProfileOutputModality", + "EndpointTestProfileReasoningConfig", + "EndpointTestProfileReasoningConfigTypedDict", + "EndpointTestProfileTypedDict", "EndpointsMetadata", "EndpointsMetadataTypedDict", "EnumCapability", @@ -6089,6 +6153,13 @@ "FailedModelTypedDict", "FalseT", "FalseTTypedDict", + "Features", + "FeaturesDefaultReasoningEffort", + "FeaturesReasoningConfig", + "FeaturesReasoningConfigTypedDict", + "FeaturesReasoningReturnMechanism", + "FeaturesSupportedReasoningEffort", + "FeaturesTypedDict", "FieldT", "Fields", "FieldsTypedDict", @@ -6458,6 +6529,7 @@ "Installation", "InstallationTypedDict", "InstructType", + "InstructionRoleSupport", "InternalServerResponseErrorData", "InternalServerResponseErrorDataTypedDict", "Interval", @@ -6484,6 +6556,8 @@ "KeyBudgetTypedDict", "KeyTypedDict", "Kty", + "LatencyMs", + "LatencyMsTypedDict", "LegacyChatContentVideo", "LegacyChatContentVideoInput", "LegacyChatContentVideoInputProcessing", @@ -7343,6 +7417,18 @@ "PromptCacheOptionsTypedDict", "PromptInjectionScanScope", "Protocol", + "ProviderEndpointStats", + "ProviderEndpointStatsAvailable", + "ProviderEndpointStatsAvailableStatus", + "ProviderEndpointStatsAvailableTypedDict", + "ProviderEndpointStatsTypedDict", + "ProviderEndpointStatsUnavailable", + "ProviderEndpointStatsUnavailableStatus", + "ProviderEndpointStatsUnavailableTypedDict", + "ProviderEndpoints", + "ProviderEndpointsResponse", + "ProviderEndpointsResponseTypedDict", + "ProviderEndpointsTypedDict", "ProviderEnum", "ProviderName", "ProviderOptions", @@ -7425,6 +7511,7 @@ "ReasoningItemType", "ReasoningItemTypedDict", "ReasoningMode", + "ReasoningReturnMechanism", "ReasoningSummaryPartAddedEvent", "ReasoningSummaryPartAddedEventType", "ReasoningSummaryPartAddedEventTypedDict", @@ -7466,6 +7553,7 @@ "RequireApprovalTypedDict", "RequireApprovalUnion", "RequireApprovalUnionTypedDict", + "RequiredInputModality", "Rerank", "RerankTypedDict", "ResponseFormat", @@ -7729,6 +7817,7 @@ "SubmitGenerationFeedbackResponseTypedDict", "SupportedAspectRatio", "SupportedFrameImage", + "SupportedReasoningEffort", "SupportedResolution", "SupportedSize", "SwitchyardRouterPlugin", @@ -7772,6 +7861,8 @@ "ThinkingEnabledTypedDict", "ThinkingTypeDisabled", "ThinkingTypedDict", + "ThroughputTokensPerSecond", + "ThroughputTokensPerSecondTypedDict", "Token", "TokenExchangeRequest", "TokenExchangeRequestScope", @@ -7979,6 +8070,7 @@ "UnknownOutputMessageContent", "UnknownOutputMessageItemContent", "UnknownOutputWebSearchCallItemActionUnion", + "UnknownProviderEndpointStats", "UnknownReasoningDetail", "UnknownReasoningDetailUnion", "UnknownStreamEvents", @@ -8093,6 +8185,7 @@ "VideoModelsListResponseTypedDict", "VideoURL", "VideoURLTypedDict", + "Visibility", "Watch", "WebFetchEngineEnum", "WebFetchPlugin", @@ -8143,6 +8236,7 @@ "WebSearchUserLocationServerToolTypedDict", "WebSearchUserLocationType", "WebSearchUserLocationTypedDict", + "Window", "Workspace", "WorkspaceBudget", "WorkspaceBudgetInterval", @@ -9443,6 +9537,32 @@ "EndpointsMetadata": ".endpointsmetadata", "EndpointsMetadataTypedDict": ".endpointsmetadata", "EndpointStatus": ".endpointstatus", + "EndpointSummary": ".endpointsummary", + "EndpointSummaryTypedDict": ".endpointsummary", + "Visibility": ".endpointsummary", + "ChatTemplateConfig": ".endpointtestprofile", + "ChatTemplateConfigTypedDict": ".endpointtestprofile", + "DefaultReasoningEffort": ".endpointtestprofile", + "DefaultReasoningReturnMechanism": ".endpointtestprofile", + "EndpointTestProfile": ".endpointtestprofile", + "EndpointTestProfileInputModality": ".endpointtestprofile", + "EndpointTestProfileModel": ".endpointtestprofile", + "EndpointTestProfileModelTypedDict": ".endpointtestprofile", + "EndpointTestProfileOutputModality": ".endpointtestprofile", + "EndpointTestProfileReasoningConfig": ".endpointtestprofile", + "EndpointTestProfileReasoningConfigTypedDict": ".endpointtestprofile", + "EndpointTestProfileTypedDict": ".endpointtestprofile", + "Features": ".endpointtestprofile", + "FeaturesDefaultReasoningEffort": ".endpointtestprofile", + "FeaturesReasoningConfig": ".endpointtestprofile", + "FeaturesReasoningConfigTypedDict": ".endpointtestprofile", + "FeaturesReasoningReturnMechanism": ".endpointtestprofile", + "FeaturesSupportedReasoningEffort": ".endpointtestprofile", + "FeaturesTypedDict": ".endpointtestprofile", + "InstructionRoleSupport": ".endpointtestprofile", + "ReasoningReturnMechanism": ".endpointtestprofile", + "RequiredInputModality": ".endpointtestprofile", + "SupportedReasoningEffort": ".endpointtestprofile", "EnumCapability": ".enumcapability", "EnumCapabilityType": ".enumcapability", "EnumCapabilityTypedDict": ".enumcapability", @@ -10953,6 +11073,24 @@ "PromptCacheOptionsMode": ".promptcacheoptions", "PromptCacheOptionsTypedDict": ".promptcacheoptions", "PromptInjectionScanScope": ".promptinjectionscanscope", + "ProviderEndpoints": ".providerendpoints", + "ProviderEndpointsTypedDict": ".providerendpoints", + "Window": ".providerendpoints", + "ProviderEndpointsResponse": ".providerendpointsresponse", + "ProviderEndpointsResponseTypedDict": ".providerendpointsresponse", + "ProviderEndpointStats": ".providerendpointstats", + "ProviderEndpointStatsTypedDict": ".providerendpointstats", + "UnknownProviderEndpointStats": ".providerendpointstats", + "LatencyMs": ".providerendpointstatsavailable", + "LatencyMsTypedDict": ".providerendpointstatsavailable", + "ProviderEndpointStatsAvailable": ".providerendpointstatsavailable", + "ProviderEndpointStatsAvailableStatus": ".providerendpointstatsavailable", + "ProviderEndpointStatsAvailableTypedDict": ".providerendpointstatsavailable", + "ThroughputTokensPerSecond": ".providerendpointstatsavailable", + "ThroughputTokensPerSecondTypedDict": ".providerendpointstatsavailable", + "ProviderEndpointStatsUnavailable": ".providerendpointstatsunavailable", + "ProviderEndpointStatsUnavailableStatus": ".providerendpointstatsunavailable", + "ProviderEndpointStatsUnavailableTypedDict": ".providerendpointstatsunavailable", "ProviderName": ".providername", "ProviderOptions": ".provideroptions", "ProviderOptionsTypedDict": ".provideroptions", diff --git a/src/openrouter/components/endpointsummary.py b/src/openrouter/components/endpointsummary.py new file mode 100644 index 000000000..357f16152 --- /dev/null +++ b/src/openrouter/components/endpointsummary.py @@ -0,0 +1,90 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .endpointtestprofile import EndpointTestProfile, EndpointTestProfileTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import Literal, Union +from typing_extensions import TypedDict + + +Visibility = Union[ + Literal[ + "visible", + "hidden", + ], + UnrecognizedStr, +] +r"""Whether the endpoint is listed on OpenRouter""" + + +class EndpointSummaryTypedDict(TypedDict): + endpoint_id: str + r"""Endpoint ID""" + model_slug: str + r"""Public model slug""" + created_at: str + r"""When the endpoint was created""" + model_permaslug: str + r"""Permanent model slug the endpoint is listed under""" + provider_model_id: Nullable[str] + r"""The provider's own model ID""" + provider_name: str + r"""Provider name""" + provider_region: Nullable[str] + r"""Serving region""" + service_tier: Nullable[str] + r"""Service tier; null for the default tier""" + test_profile: EndpointTestProfileTypedDict + variant: str + r"""Endpoint variant""" + visibility: Visibility + r"""Whether the endpoint is listed on OpenRouter""" + + +class EndpointSummary(BaseModel): + endpoint_id: str + r"""Endpoint ID""" + + model_slug: str + r"""Public model slug""" + + created_at: str + r"""When the endpoint was created""" + + model_permaslug: str + r"""Permanent model slug the endpoint is listed under""" + + provider_model_id: Nullable[str] + r"""The provider's own model ID""" + + provider_name: str + r"""Provider name""" + + provider_region: Nullable[str] + r"""Serving region""" + + service_tier: Nullable[str] + r"""Service tier; null for the default tier""" + + test_profile: EndpointTestProfile + + variant: str + r"""Endpoint variant""" + + visibility: Visibility + r"""Whether the endpoint is listed on OpenRouter""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/endpointtestprofile.py b/src/openrouter/components/endpointtestprofile.py new file mode 100644 index 000000000..a16c2c6d4 --- /dev/null +++ b/src/openrouter/components/endpointtestprofile.py @@ -0,0 +1,540 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Union +from typing_extensions import NotRequired, TypedDict + + +DefaultReasoningReturnMechanism = Union[ + Literal[ + "content-string", + "reasoning-content", + "reasoning", + "none", + ], + UnrecognizedStr, +] +r"""Reasoning return mechanism the endpoint uses when neither its features nor the model set one""" + + +InstructionRoleSupport = Union[ + Literal[ + "developer", + "system", + "user-only", + ], + UnrecognizedStr, +] +r"""How leading instruction (developer/system) messages are mapped before reaching a chat-completions provider. 'developer' keeps the developer role, 'system' downgrades developer to system, 'user-only' downgrades both to a wrapped user message. Overridable per-endpoint.""" + + +class ChatTemplateConfigTypedDict(TypedDict): + instruction_role_support: NotRequired[Nullable[InstructionRoleSupport]] + r"""How leading instruction (developer/system) messages are mapped before reaching a chat-completions provider. 'developer' keeps the developer role, 'system' downgrades developer to system, 'user-only' downgrades both to a wrapped user message. Overridable per-endpoint.""" + should_hoist_and_merge_system_messages: NotRequired[Nullable[bool]] + r"""Whether to hoist and merge system messages""" + supports_mid_session_system: NotRequired[Nullable[bool]] + r"""Whether the model accepts system/developer messages that appear after the first user/assistant turn. When false, mid-session instruction messages are downgraded to wrapped user messages. Overridable per-endpoint.""" + + +class ChatTemplateConfig(BaseModel): + instruction_role_support: OptionalNullable[InstructionRoleSupport] = UNSET + r"""How leading instruction (developer/system) messages are mapped before reaching a chat-completions provider. 'developer' keeps the developer role, 'system' downgrades developer to system, 'user-only' downgrades both to a wrapped user message. Overridable per-endpoint.""" + + should_hoist_and_merge_system_messages: OptionalNullable[bool] = UNSET + r"""Whether to hoist and merge system messages""" + + supports_mid_session_system: OptionalNullable[bool] = UNSET + r"""Whether the model accepts system/developer messages that appear after the first user/assistant turn. When false, mid-session instruction messages are downgraded to wrapped user messages. Overridable per-endpoint.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "instruction_role_support", + "should_hoist_and_merge_system_messages", + "supports_mid_session_system", + ] + ) + nullable_fields = set( + [ + "instruction_role_support", + "should_hoist_and_merge_system_messages", + "supports_mid_session_system", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +FeaturesDefaultReasoningEffort = Union[ + Literal[ + "max", + "xhigh", + "high", + "medium", + "low", + "minimal", + ], + UnrecognizedStr, +] + + +FeaturesReasoningReturnMechanism = Union[ + Literal[ + "content-string", + "reasoning-content", + "reasoning", + "none", + ], + UnrecognizedStr, +] +r"""Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.""" + + +FeaturesSupportedReasoningEffort = Union[ + Literal[ + "max", + "xhigh", + "high", + "medium", + "low", + "minimal", + ], + UnrecognizedStr, +] + + +class FeaturesReasoningConfigTypedDict(TypedDict): + default_reasoning_effort: NotRequired[Nullable[FeaturesDefaultReasoningEffort]] + default_reasoning_enabled: NotRequired[Nullable[bool]] + r"""Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this.""" + end_token: NotRequired[Nullable[str]] + is_mandatory_reasoning: NotRequired[Nullable[bool]] + reasoning_return_mechanism: NotRequired[Nullable[FeaturesReasoningReturnMechanism]] + r"""Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.""" + start_token: NotRequired[Nullable[str]] + supported_reasoning_efforts: NotRequired[ + Nullable[List[FeaturesSupportedReasoningEffort]] + ] + r"""List of reasoning effort values the model accepts upstream""" + supports_reasoning_effort: NotRequired[Nullable[bool]] + r"""Whether the model supports reasoning effort""" + supports_reasoning_max_tokens: NotRequired[Nullable[bool]] + r"""Whether the model supports reasoning max tokens""" + system_prompt: NotRequired[Nullable[str]] + + +class FeaturesReasoningConfig(BaseModel): + default_reasoning_effort: OptionalNullable[FeaturesDefaultReasoningEffort] = UNSET + + default_reasoning_enabled: OptionalNullable[bool] = UNSET + r"""Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this.""" + + end_token: OptionalNullable[str] = UNSET + + is_mandatory_reasoning: OptionalNullable[bool] = UNSET + + reasoning_return_mechanism: OptionalNullable[FeaturesReasoningReturnMechanism] = ( + UNSET + ) + r"""Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.""" + + start_token: OptionalNullable[str] = UNSET + + supported_reasoning_efforts: OptionalNullable[ + List[FeaturesSupportedReasoningEffort] + ] = UNSET + r"""List of reasoning effort values the model accepts upstream""" + + supports_reasoning_effort: OptionalNullable[bool] = UNSET + r"""Whether the model supports reasoning effort""" + + supports_reasoning_max_tokens: OptionalNullable[bool] = UNSET + r"""Whether the model supports reasoning max tokens""" + + system_prompt: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "default_reasoning_effort", + "default_reasoning_enabled", + "end_token", + "is_mandatory_reasoning", + "reasoning_return_mechanism", + "start_token", + "supported_reasoning_efforts", + "supports_reasoning_effort", + "supports_reasoning_max_tokens", + "system_prompt", + ] + ) + nullable_fields = set( + [ + "default_reasoning_effort", + "default_reasoning_enabled", + "end_token", + "is_mandatory_reasoning", + "reasoning_return_mechanism", + "start_token", + "supported_reasoning_efforts", + "supports_reasoning_effort", + "supports_reasoning_max_tokens", + "system_prompt", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +RequiredInputModality = Union[ + Literal[ + "text", + "image", + "audio", + "video", + ], + UnrecognizedStr, +] + + +class FeaturesTypedDict(TypedDict): + chat_template_config: NotRequired[Nullable[ChatTemplateConfigTypedDict]] + reasoning_config: NotRequired[Nullable[FeaturesReasoningConfigTypedDict]] + required_input_modalities: NotRequired[Nullable[List[RequiredInputModality]]] + r"""Input modalities every request to the model must include, e.g. [\"video\"] for video-to-video-only models. Requests missing a required modality are rejected before dispatch. A required text modality is satisfied by the prompt. Currently enforced on the video generation request path.""" + + +class Features(BaseModel): + chat_template_config: OptionalNullable[ChatTemplateConfig] = UNSET + + reasoning_config: OptionalNullable[FeaturesReasoningConfig] = UNSET + + required_input_modalities: OptionalNullable[List[RequiredInputModality]] = UNSET + r"""Input modalities every request to the model must include, e.g. [\"video\"] for video-to-video-only models. Requests missing a required modality are rejected before dispatch. A required text modality is satisfied by the prompt. Currently enforced on the video generation request path.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["chat_template_config", "reasoning_config", "required_input_modalities"] + ) + nullable_fields = set( + ["chat_template_config", "reasoning_config", "required_input_modalities"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +EndpointTestProfileInputModality = Union[ + Literal[ + "text", + "image", + "file", + "audio", + "video", + ], + UnrecognizedStr, +] + + +EndpointTestProfileOutputModality = Union[ + Literal[ + "text", + "image", + "embeddings", + "audio", + "video", + "rerank", + "decisions", + "speech", + "transcription", + ], + UnrecognizedStr, +] + + +DefaultReasoningEffort = Union[ + Literal[ + "max", + "xhigh", + "high", + "medium", + "low", + "minimal", + ], + UnrecognizedStr, +] + + +ReasoningReturnMechanism = Union[ + Literal[ + "content-string", + "reasoning-content", + "reasoning", + "none", + ], + UnrecognizedStr, +] +r"""Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.""" + + +SupportedReasoningEffort = Union[ + Literal[ + "max", + "xhigh", + "high", + "medium", + "low", + "minimal", + ], + UnrecognizedStr, +] + + +class EndpointTestProfileReasoningConfigTypedDict(TypedDict): + default_reasoning_effort: NotRequired[Nullable[DefaultReasoningEffort]] + default_reasoning_enabled: NotRequired[Nullable[bool]] + r"""Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this.""" + end_token: NotRequired[Nullable[str]] + is_mandatory_reasoning: NotRequired[Nullable[bool]] + reasoning_return_mechanism: NotRequired[Nullable[ReasoningReturnMechanism]] + r"""Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.""" + start_token: NotRequired[Nullable[str]] + supported_reasoning_efforts: NotRequired[Nullable[List[SupportedReasoningEffort]]] + r"""List of reasoning effort values the model accepts upstream""" + supports_reasoning_effort: NotRequired[Nullable[bool]] + r"""Whether the model supports reasoning effort""" + supports_reasoning_max_tokens: NotRequired[Nullable[bool]] + r"""Whether the model supports reasoning max tokens""" + system_prompt: NotRequired[Nullable[str]] + + +class EndpointTestProfileReasoningConfig(BaseModel): + default_reasoning_effort: OptionalNullable[DefaultReasoningEffort] = UNSET + + default_reasoning_enabled: OptionalNullable[bool] = UNSET + r"""Default reasoning enabled state for the model. When true, reasoning is enabled by default; when false, disabled by default. User-specified values always override this.""" + + end_token: OptionalNullable[str] = UNSET + + is_mandatory_reasoning: OptionalNullable[bool] = UNSET + + reasoning_return_mechanism: OptionalNullable[ReasoningReturnMechanism] = UNSET + r"""Default mechanism for returning reasoning tokens. Can be overridden per-endpoint via endpoint features.""" + + start_token: OptionalNullable[str] = UNSET + + supported_reasoning_efforts: OptionalNullable[List[SupportedReasoningEffort]] = ( + UNSET + ) + r"""List of reasoning effort values the model accepts upstream""" + + supports_reasoning_effort: OptionalNullable[bool] = UNSET + r"""Whether the model supports reasoning effort""" + + supports_reasoning_max_tokens: OptionalNullable[bool] = UNSET + r"""Whether the model supports reasoning max tokens""" + + system_prompt: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "default_reasoning_effort", + "default_reasoning_enabled", + "end_token", + "is_mandatory_reasoning", + "reasoning_return_mechanism", + "start_token", + "supported_reasoning_efforts", + "supports_reasoning_effort", + "supports_reasoning_max_tokens", + "system_prompt", + ] + ) + nullable_fields = set( + [ + "default_reasoning_effort", + "default_reasoning_enabled", + "end_token", + "is_mandatory_reasoning", + "reasoning_return_mechanism", + "start_token", + "supported_reasoning_efforts", + "supports_reasoning_effort", + "supports_reasoning_max_tokens", + "system_prompt", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class EndpointTestProfileModelTypedDict(TypedDict): + features: Nullable[FeaturesTypedDict] + input_modalities: List[EndpointTestProfileInputModality] + output_modalities: List[EndpointTestProfileOutputModality] + reasoning_config: Nullable[EndpointTestProfileReasoningConfigTypedDict] + slug: str + r"""Public model slug""" + supports_reasoning: bool + + +class EndpointTestProfileModel(BaseModel): + features: Nullable[Features] + + input_modalities: List[EndpointTestProfileInputModality] + + output_modalities: List[EndpointTestProfileOutputModality] + + reasoning_config: Nullable[EndpointTestProfileReasoningConfig] + + slug: str + r"""Public model slug""" + + supports_reasoning: bool + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class EndpointTestProfileTypedDict(TypedDict): + context_length: Nullable[int] + r"""Context length the endpoint serves: its override, else the model's""" + default_reasoning_return_mechanism: Nullable[DefaultReasoningReturnMechanism] + r"""Reasoning return mechanism the endpoint uses when neither its features nor the model set one""" + effective_adapter_name: Nullable[str] + r"""Adapter the endpoint is served through: its provider override, else the provider's; null when unresolved""" + endpoint_features: Nullable[Dict[str, Any]] + r"""Endpoint feature flags; null when unset or invalid""" + is_lab_trusted: bool + r"""Whether the endpoint serves a closed lab model through the lab or an official partner""" + model: EndpointTestProfileModelTypedDict + + +class EndpointTestProfile(BaseModel): + context_length: Nullable[int] + r"""Context length the endpoint serves: its override, else the model's""" + + default_reasoning_return_mechanism: Nullable[DefaultReasoningReturnMechanism] + r"""Reasoning return mechanism the endpoint uses when neither its features nor the model set one""" + + effective_adapter_name: Nullable[str] + r"""Adapter the endpoint is served through: its provider override, else the provider's; null when unresolved""" + + endpoint_features: Nullable[Dict[str, Any]] + r"""Endpoint feature flags; null when unset or invalid""" + + is_lab_trusted: bool + r"""Whether the endpoint serves a closed lab model through the lab or an official partner""" + + model: EndpointTestProfileModel + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/providerendpoints.py b/src/openrouter/components/providerendpoints.py new file mode 100644 index 000000000..25fce7b1e --- /dev/null +++ b/src/openrouter/components/providerendpoints.py @@ -0,0 +1,37 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .endpointsummary import EndpointSummary, EndpointSummaryTypedDict +from .providerendpointstats import ProviderEndpointStats, ProviderEndpointStatsTypedDict +from openrouter.types import BaseModel, UnrecognizedStr +from typing import List, Literal, Union +from typing_extensions import TypedDict + + +Window = Union[ + Literal[ + "1hr", + "1d", + "1w", + "1mo", + "1y", + ], + UnrecognizedStr, +] +r"""Time window the provider-wide stats cover""" + + +class ProviderEndpointsTypedDict(TypedDict): + endpoints: List[EndpointSummaryTypedDict] + stats: ProviderEndpointStatsTypedDict + window: Window + r"""Time window the provider-wide stats cover""" + + +class ProviderEndpoints(BaseModel): + endpoints: List[EndpointSummary] + + stats: ProviderEndpointStats + + window: Window + r"""Time window the provider-wide stats cover""" diff --git a/src/openrouter/components/providerendpointsresponse.py b/src/openrouter/components/providerendpointsresponse.py new file mode 100644 index 000000000..9b271e719 --- /dev/null +++ b/src/openrouter/components/providerendpointsresponse.py @@ -0,0 +1,14 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .providerendpoints import ProviderEndpoints, ProviderEndpointsTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ProviderEndpointsResponseTypedDict(TypedDict): + data: ProviderEndpointsTypedDict + + +class ProviderEndpointsResponse(BaseModel): + data: ProviderEndpoints diff --git a/src/openrouter/components/providerendpointstats.py b/src/openrouter/components/providerendpointstats.py new file mode 100644 index 000000000..f87170f0f --- /dev/null +++ b/src/openrouter/components/providerendpointstats.py @@ -0,0 +1,61 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .providerendpointstatsavailable import ( + ProviderEndpointStatsAvailable, + ProviderEndpointStatsAvailableTypedDict, +) +from .providerendpointstatsunavailable import ( + ProviderEndpointStatsUnavailable, + ProviderEndpointStatsUnavailableTypedDict, +) +from functools import partial +from openrouter.types import BaseModel +from openrouter.utils.unions import parse_open_union +from pydantic import ConfigDict +from pydantic.functional_validators import BeforeValidator +from typing import Any, Literal, Union +from typing_extensions import Annotated, TypeAliasType + + +ProviderEndpointStatsTypedDict = TypeAliasType( + "ProviderEndpointStatsTypedDict", + Union[ + ProviderEndpointStatsUnavailableTypedDict, + ProviderEndpointStatsAvailableTypedDict, + ], +) + + +class UnknownProviderEndpointStats(BaseModel): + r"""A ProviderEndpointStats variant the SDK doesn't recognize. Preserves the raw payload.""" + + status: Literal["UNKNOWN"] = "UNKNOWN" + raw: Any + is_unknown: Literal[True] = True + + model_config = ConfigDict(frozen=True) + + +_PROVIDER_ENDPOINT_STATS_VARIANTS: dict[str, Any] = { + "available": ProviderEndpointStatsAvailable, + "unavailable": ProviderEndpointStatsUnavailable, +} + + +ProviderEndpointStats = Annotated[ + Union[ + ProviderEndpointStatsAvailable, + ProviderEndpointStatsUnavailable, + UnknownProviderEndpointStats, + ], + BeforeValidator( + partial( + parse_open_union, + disc_key="status", + variants=_PROVIDER_ENDPOINT_STATS_VARIANTS, + unknown_cls=UnknownProviderEndpointStats, + union_name="ProviderEndpointStats", + ) + ), +] diff --git a/src/openrouter/components/providerendpointstatsavailable.py b/src/openrouter/components/providerendpointstatsavailable.py new file mode 100644 index 000000000..67d24b1f9 --- /dev/null +++ b/src/openrouter/components/providerendpointstatsavailable.py @@ -0,0 +1,135 @@ +"""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 LatencyMsTypedDict(TypedDict): + r"""Request latency, milliseconds""" + + p50: Nullable[float] + p90: Nullable[float] + + +class LatencyMs(BaseModel): + r"""Request latency, milliseconds""" + + p50: Nullable[float] + + p90: Nullable[float] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +ProviderEndpointStatsAvailableStatus = Literal["available",] + + +class ThroughputTokensPerSecondTypedDict(TypedDict): + r"""Output tokens per second""" + + p50: Nullable[float] + p90: Nullable[float] + + +class ThroughputTokensPerSecond(BaseModel): + r"""Output tokens per second""" + + p50: Nullable[float] + + p90: Nullable[float] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class ProviderEndpointStatsAvailableTypedDict(TypedDict): + endpoint_count: int + r"""Endpoints the stats cover""" + error_rate_percent: float + r"""Errored share of requests that count toward uptime, 0-100""" + latency_ms: LatencyMsTypedDict + r"""Request latency, milliseconds""" + quality_percent: Nullable[float] + r"""Routing quality, 0-100""" + rate_limited_percent: Nullable[float] + r"""Rate-limited share of routed requests, 0-100""" + reliability_percent: Nullable[float] + r"""Routing reliability, 0-100""" + requests: int + r"""Requests in the window""" + status: ProviderEndpointStatsAvailableStatus + throughput_tokens_per_second: ThroughputTokensPerSecondTypedDict + r"""Output tokens per second""" + uptime_percent: Nullable[float] + r"""Successful share of requests that count toward uptime, 0-100""" + + +class ProviderEndpointStatsAvailable(BaseModel): + endpoint_count: int + r"""Endpoints the stats cover""" + + error_rate_percent: float + r"""Errored share of requests that count toward uptime, 0-100""" + + latency_ms: LatencyMs + r"""Request latency, milliseconds""" + + quality_percent: Nullable[float] + r"""Routing quality, 0-100""" + + rate_limited_percent: Nullable[float] + r"""Rate-limited share of routed requests, 0-100""" + + reliability_percent: Nullable[float] + r"""Routing reliability, 0-100""" + + requests: int + r"""Requests in the window""" + + status: ProviderEndpointStatsAvailableStatus + + throughput_tokens_per_second: ThroughputTokensPerSecond + r"""Output tokens per second""" + + uptime_percent: Nullable[float] + r"""Successful share of requests that count toward uptime, 0-100""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/providerendpointstatsunavailable.py b/src/openrouter/components/providerendpointstatsunavailable.py new file mode 100644 index 000000000..ab2fb6d55 --- /dev/null +++ b/src/openrouter/components/providerendpointstatsunavailable.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +ProviderEndpointStatsUnavailableStatus = Literal["unavailable",] + + +class ProviderEndpointStatsUnavailableTypedDict(TypedDict): + status: ProviderEndpointStatsUnavailableStatus + + +class ProviderEndpointStatsUnavailable(BaseModel): + status: ProviderEndpointStatsUnavailableStatus diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 7319f555f..2c9a7c312 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -635,7 +635,7 @@ GetTaskClassificationsGlobalsTypedDict, GetTaskClassificationsRequest, GetTaskClassificationsRequestTypedDict, - Window, + GetTaskClassificationsWindow, ) from .gettool import ( GetToolGlobals, @@ -901,6 +901,14 @@ ListPrivateProvidersResponse, ListPrivateProvidersResponseTypedDict, ) + from .listproviderendpoints import ( + ListProviderEndpointsGlobals, + ListProviderEndpointsGlobalsTypedDict, + ListProviderEndpointsRequest, + ListProviderEndpointsRequestTypedDict, + ListProviderEndpointsWindow, + PerfWorkload, + ) from .listproviders import ( Datacenter, Headquarters, @@ -1572,6 +1580,7 @@ "GetTaskClassificationsGlobalsTypedDict", "GetTaskClassificationsRequest", "GetTaskClassificationsRequestTypedDict", + "GetTaskClassificationsWindow", "GetToolGlobals", "GetToolGlobalsTypedDict", "GetToolRequest", @@ -1773,6 +1782,11 @@ "ListPrivateProvidersRequestTypedDict", "ListPrivateProvidersResponse", "ListPrivateProvidersResponseTypedDict", + "ListProviderEndpointsGlobals", + "ListProviderEndpointsGlobalsTypedDict", + "ListProviderEndpointsRequest", + "ListProviderEndpointsRequestTypedDict", + "ListProviderEndpointsWindow", "ListProvidersData", "ListProvidersDataTypedDict", "ListProvidersGlobals", @@ -1842,6 +1856,7 @@ "Order", "OrderBy", "OrderByTypedDict", + "PerfWorkload", "Period", "PromoteContainerFileGlobals", "PromoteContainerFileGlobalsTypedDict", @@ -1965,7 +1980,6 @@ "ValidatePrivateEndpointGlobalsTypedDict", "ValidatePrivateEndpointRequest", "ValidatePrivateEndpointRequestTypedDict", - "Window", "Zdr", ] @@ -2441,7 +2455,7 @@ "GetTaskClassificationsGlobalsTypedDict": ".gettaskclassifications", "GetTaskClassificationsRequest": ".gettaskclassifications", "GetTaskClassificationsRequestTypedDict": ".gettaskclassifications", - "Window": ".gettaskclassifications", + "GetTaskClassificationsWindow": ".gettaskclassifications", "GetToolGlobals": ".gettool", "GetToolGlobalsTypedDict": ".gettool", "GetToolRequest": ".gettool", @@ -2638,6 +2652,12 @@ "ListPrivateProvidersRequestTypedDict": ".listprivateproviders", "ListPrivateProvidersResponse": ".listprivateproviders", "ListPrivateProvidersResponseTypedDict": ".listprivateproviders", + "ListProviderEndpointsGlobals": ".listproviderendpoints", + "ListProviderEndpointsGlobalsTypedDict": ".listproviderendpoints", + "ListProviderEndpointsRequest": ".listproviderendpoints", + "ListProviderEndpointsRequestTypedDict": ".listproviderendpoints", + "ListProviderEndpointsWindow": ".listproviderendpoints", + "PerfWorkload": ".listproviderendpoints", "Datacenter": ".listproviders", "Headquarters": ".listproviders", "ListProvidersData": ".listproviders", diff --git a/src/openrouter/operations/gettaskclassifications.py b/src/openrouter/operations/gettaskclassifications.py index a8b610cad..1679b8aaa 100644 --- a/src/openrouter/operations/gettaskclassifications.py +++ b/src/openrouter/operations/gettaskclassifications.py @@ -73,7 +73,7 @@ def serialize_model(self, handler): return m -Window = Literal["7d",] +GetTaskClassificationsWindow = Literal["7d",] r"""Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported.""" @@ -91,7 +91,7 @@ class GetTaskClassificationsRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ - window: NotRequired[Window] + window: NotRequired[GetTaskClassificationsWindow] r"""Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported.""" @@ -125,7 +125,7 @@ class GetTaskClassificationsRequest(BaseModel): """ window: Annotated[ - Optional[Window], + Optional[GetTaskClassificationsWindow], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = "7d" r"""Trailing time window for the classification data. Currently only `7d` (trailing 7 days) is supported.""" diff --git a/src/openrouter/operations/listproviderendpoints.py b/src/openrouter/operations/listproviderendpoints.py new file mode 100644 index 000000000..e6b63273e --- /dev/null +++ b/src/openrouter/operations/listproviderendpoints.py @@ -0,0 +1,202 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListProviderEndpointsGlobalsTypedDict(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 ListProviderEndpointsGlobals(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. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListProviderEndpointsWindow = Union[ + Literal[ + "1hr", + "1d", + "1w", + "1mo", + "1y", + ], + UnrecognizedStr, +] +r"""Time window the provider-wide stats cover""" + + +PerfWorkload = Union[ + Literal[ + "text_generation", + "image_generation", + "video_generation", + "embeddings", + "rerank", + "tts", + "stt", + "decisions", + "extractions", + "unknown", + ], + UnrecognizedStr, +] +r"""Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve""" + + +class ListProviderEndpointsRequestTypedDict(TypedDict): + provider_slug: str + r"""URL-friendly provider identifier (e.g. \"openai\", \"fireworks\")""" + 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. + + """ + window: NotRequired[ListProviderEndpointsWindow] + r"""Time window the provider-wide stats cover""" + perf_workload: NotRequired[PerfWorkload] + r"""Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve""" + + +class ListProviderEndpointsRequest(BaseModel): + provider_slug: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""URL-friendly provider identifier (e.g. \"openai\", \"fireworks\")""" + + 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. + + """ + + window: Annotated[ + Optional[ListProviderEndpointsWindow], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = "1mo" + r"""Time window the provider-wide stats cover""" + + perf_workload: Annotated[ + Optional[PerfWorkload], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "window", + "perf_workload", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/providers.py b/src/openrouter/providers.py index c1fd70812..ac109190c 100644 --- a/src/openrouter/providers.py +++ b/src/openrouter/providers.py @@ -237,3 +237,305 @@ async def list_async( ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_provider_endpoints( + self, + *, + provider_slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + window: Optional[operations.ListProviderEndpointsWindow] = "1mo", + perf_workload: Optional[operations.PerfWorkload] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ProviderEndpointsResponse: + r"""List a provider's endpoints with provider-wide stats + + Returns every endpoint the provider serves, hidden ones included, with the provider-wide uptime, routing, latency and throughput stats over the window. Requires provider ownership, membership, or admin access. + + :param provider_slug: URL-friendly provider identifier (e.g. \"openai\", \"fireworks\") + :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 window: Time window the provider-wide stats cover + :param perf_workload: Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve + :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.ListProviderEndpointsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + provider_slug=provider_slug, + window=window, + perf_workload=perf_workload, + ) + + req = self._build_request( + method="GET", + path="/providers/{provider_slug}/endpoints", + 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.ListProviderEndpointsGlobals( + 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="listProviderEndpoints", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Providers"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ProviderEndpointsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_provider_endpoints_async( + self, + *, + provider_slug: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + window: Optional[operations.ListProviderEndpointsWindow] = "1mo", + perf_workload: Optional[operations.PerfWorkload] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ProviderEndpointsResponse: + r"""List a provider's endpoints with provider-wide stats + + Returns every endpoint the provider serves, hidden ones included, with the provider-wide uptime, routing, latency and throughput stats over the window. Requires provider ownership, membership, or admin access. + + :param provider_slug: URL-friendly provider identifier (e.g. \"openai\", \"fireworks\") + :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 window: Time window the provider-wide stats cover + :param perf_workload: Workload the latency and throughput stats measure; defaults to the workload most of the endpoints serve + :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.ListProviderEndpointsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + provider_slug=provider_slug, + window=window, + perf_workload=perf_workload, + ) + + req = self._build_request_async( + method="GET", + path="/providers/{provider_slug}/endpoints", + 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.ListProviderEndpointsGlobals( + 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="listProviderEndpoints", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Providers"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ProviderEndpointsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/uv.lock b/uv.lock index dd0c0f035..1bddf0621 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.117" +version = "1.3.118" source = { editable = "." } dependencies = [ { name = "httpcore" }, From e09e9aeb9d55e02b83cb246eeaa5947b6c6f4829 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 19:14:09 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow