Compare commits

..
Author SHA1 Message Date
speakeasy-github[bot]andspeakeasy-bot 0a66fb531b empty commit to trigger [run-tests] workflow 2026-06-18 01:00:41 +00:00
speakeasybot 15ce4685f3 ## Python SDK Changes:
* `open_router.embeddings.list_models()`:  `response.data.[].reasoning` **Added**
* `open_router.models.get()`:  `response.data.reasoning` **Added**
* `open_router.models.list()`:  `response.data.[].reasoning` **Added**
* `open_router.models.list_for_user()`:  `response.data.[].reasoning` **Added**
2026-06-18 01:00:24 +00:00
24 changed files with 2243 additions and 1925 deletions
@@ -1,86 +0,0 @@
name: Auto-merge Speakeasy PR
# Speakeasy mode:pr opens PRs (speakeasy-sdk-regen-*) and labels them
# patch/minor/major. Merge automatically so sdk_publish.yaml can run.
on:
pull_request:
types: [labeled]
permissions:
contents: write
pull-requests: write
concurrency:
group: auto-merge-speakeasy
cancel-in-progress: false
jobs:
auto-merge:
if: |
github.event.sender.login == 'github-actions[bot]' &&
github.event.pull_request.user.login == 'github-actions[bot]' &&
startsWith(github.event.pull_request.head.ref, 'speakeasy-sdk-regen-') &&
contains(github.event.pull_request.title, '🐝 Update SDK') &&
contains(fromJSON('["patch", "minor", "major"]'), github.event.label.name)
runs-on: ubuntu-latest
steps:
- name: Close superseded Speakeasy PRs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
CURRENT_PR="${{ github.event.pull_request.number }}"
PRIOR_JSON=$(gh pr list \
--repo "${{ github.repository }}" \
--state open \
--search "head:speakeasy-sdk-regen-" \
--limit 500 \
--json number \
| jq -r --arg cur "$CURRENT_PR" \
'[.[].number | select(tostring != $cur)] | .[]')
if [ -z "$PRIOR_JSON" ]; then
echo "No superseded Speakeasy PRs to close"
exit 0
fi
mapfile -t PRIOR <<< "$PRIOR_JSON"
echo "Closing ${#PRIOR[@]} superseded Speakeasy PR(s)"
for N in "${PRIOR[@]}"; do
gh pr close "$N" --repo "${{ github.repository }}" --delete-branch \
--comment "Superseded by newer Speakeasy SDK generation PR #${CURRENT_PR}" \
|| echo "::warning::Failed to close PR #$N (continuing)"
sleep 1
done
- name: Auto-merge Speakeasy PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
PR_NUM="${{ github.event.pull_request.number }}"
REPO="${{ github.repository }}"
STATE=$(gh pr view "$PR_NUM" --repo "$REPO" --json state --jq .state)
if [ "$STATE" != "OPEN" ]; then
echo "PR #$PR_NUM is $STATE — skipping merge"
exit 0
fi
# Prefer GitHub auto-merge when required checks exist; otherwise
# squash-merge directly (same pattern as sdk-release-prs.yaml).
AUTO_MERGE_NOOP_PATTERN='is in clean status|protected branch rules|Branch does not have required protected branch rules'
if gh pr merge "$PR_NUM" --repo "$REPO" --squash --auto --delete-branch 2> /tmp/gh-merge.err; then
echo "Auto-merge enabled for Speakeasy PR #$PR_NUM"
elif grep -qiE "$AUTO_MERGE_NOOP_PATTERN" /tmp/gh-merge.err; then
echo "Auto-merge not applicable — merging PR #$PR_NUM directly"
cat /tmp/gh-merge.err >&2
gh pr merge "$PR_NUM" --repo "$REPO" --squash --delete-branch
else
echo "::error::Failed to enable auto-merge on Speakeasy PR #$PR_NUM"
cat /tmp/gh-merge.err >&2
exit 1
fi
+136 -146
View File
@@ -1,7 +1,7 @@
lockVersion: 2.0.0
id: c48cf606-fb42-4a45-9c23-8f0555307828
management:
docChecksum: b391df2d82163351d8df7c152db16d55
docChecksum: cc6966b5800766370c195f5c42b10761
docVersion: 1.0.0
speakeasyVersion: 1.680.0
generationVersion: 2.788.4
@@ -11,9 +11,9 @@ management:
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
published: true
persistentEdits:
generation_id: 5b413f59-637c-4b8e-af52-4ce67ebe1508
pristine_commit_hash: 39a84a2b48a1853daeb784df3ce2c6bb1cbb4b3a
pristine_tree_hash: 2127b8a2fdbdd0e70f0a7ed87d1d4b25ca2e82ed
generation_id: 8123354f-2376-451c-8dbd-6e7ed6d6980c
pristine_commit_hash: 48c154f879472adb6f282e81083593c020808530
pristine_tree_hash: 3e5484ebb7e5c6660a037fb427b4aa9edd240571
features:
python:
acceptHeaders: 3.0.0
@@ -596,6 +596,58 @@ trackedFiles:
id: e6ed8eddbb24
last_write_checksum: sha1:4b8db8f915f099b89698c93a9dd86fdde32f0d29
pristine_git_object: 39e37fdadaf320fbd499c345f02b0f248331fa98
docs/components/benchmarkpricing.md:
id: 1773696fd2fb
last_write_checksum: sha1:335d20d71d0225a7b8b3ef222f2433571966fe03
pristine_git_object: 335c8e92b6ef64040c2d5d774f8bba265bf98f83
docs/components/benchmarksaaitem.md:
id: a51a6ebb2653
last_write_checksum: sha1:5f32825973fbdb3a88d6ae603d9f342befa17ab8
pristine_git_object: 1800438874a9224105018148d4fb38ec29aed892
docs/components/benchmarksaameta.md:
id: 66665e5cc0cb
last_write_checksum: sha1:4015be7186e032526ac628e4e57420410ea86bc7
pristine_git_object: 92f3db8c60f8ef464075623dc24a6e20c74d1750
docs/components/benchmarksaametasource.md:
id: 2aac90c13609
last_write_checksum: sha1:218130854d26c4067c6ced560ec4c1393e144174
pristine_git_object: 9917ffc03124110df323fa88d5a5026145797eb1
docs/components/benchmarksaametasourceurl.md:
id: 5775371c2220
last_write_checksum: sha1:bfd9917a494e65d372cd3900f5178e37af0580ed
pristine_git_object: 79522841c570e593e332ce71c07eb81b23abc230
docs/components/benchmarksaametaversion.md:
id: 7ff3469b31de
last_write_checksum: sha1:e26c09306146670ea424451b18297b96258d29c2
pristine_git_object: 9649dd143a7a7d927563c2e5d66d899d4bd4a23d
docs/components/benchmarksaaresponse.md:
id: 6a2090513e37
last_write_checksum: sha1:139fd98981f96576c7ef677d15536be622e5b8fe
pristine_git_object: a170b12c3bd7816ed14a2bcf823ad518bb5b10ff
docs/components/benchmarksdaitem.md:
id: a921b9b462b2
last_write_checksum: sha1:51b045b1525937e43d122e7e944e305393957000
pristine_git_object: 6ef28c047743208fd9694ff3f5fb6797ed2bec39
docs/components/benchmarksdameta.md:
id: 396a3643066d
last_write_checksum: sha1:33c7867659944bd15b83c41170aa6a2cf6b18726
pristine_git_object: 71b87b1e04918ab51469ac90868385b723147734
docs/components/benchmarksdametasource.md:
id: 2846adb831b8
last_write_checksum: sha1:c6a9d05b62027e40294664cd4d60eb54eb638ec4
pristine_git_object: 5c7aa0e34088aba458f90c5ef441b84b6cc3201e
docs/components/benchmarksdametasourceurl.md:
id: 6991d2000ec5
last_write_checksum: sha1:10a1e0d6a64580aa4443b35ebd44497fd6720c15
pristine_git_object: 0460bd8b38e93aaf2dfee47a96b9e46ef2e3b0d0
docs/components/benchmarksdametaversion.md:
id: da86e114b298
last_write_checksum: sha1:e36c13df0304f6803bae21d80dc888d29c281634
pristine_git_object: 8997ff2bb56ee569f15d0d1932b95f00c2674ebc
docs/components/benchmarksdaresponse.md:
id: f052f6690836
last_write_checksum: sha1:d49ff5d719b552043a32a0cde7c36578bb5f1a8f
pristine_git_object: d296d588dcc07434b82d1fc1bb60a88486406ded
docs/components/bulkaddworkspacemembersrequest.md:
id: 12cbe93243c4
last_write_checksum: sha1:5bc0f5067f2fdd1a05409b18ec723b8b2acb4026
@@ -874,8 +926,8 @@ trackedFiles:
pristine_git_object: 13ae40be5e3c883f88789c3b5b74a3b2da4c85c2
docs/components/chatresult.md:
id: 212b0f66efd0
last_write_checksum: sha1:f40df693ad2d2d8e156aacb218af394f675bfb89
pristine_git_object: 41f82f9576591d048a504f29ca19b148ccca02bc
last_write_checksum: sha1:0a94cfb0c88a0dbf0f0abc5d83ac6fc6c48051b4
pristine_git_object: cc04eadd2f48efd93533a3ddae52ad39e91f5dee
docs/components/chatresultobject.md:
id: 668504931d18
last_write_checksum: sha1:6d550246aa007a5be94a9788ae4cfdfb75006980
@@ -898,8 +950,8 @@ trackedFiles:
pristine_git_object: 690d74b67239bf7f423039652aea3741c831137e
docs/components/chatstreamchunk.md:
id: 404d264ea22c
last_write_checksum: sha1:096b20b3777fd22cbe9c3ffb26c0d6bf51feedbe
pristine_git_object: 5cce75d63c13268740aa9fdb46f5273f77cd1c25
last_write_checksum: sha1:1353c09378850a9810c39cf3198f0fd5e049f610
pristine_git_object: 3c64aec72fb2eb9f0cf6eae975dd9c8bb183c6e6
docs/components/chatstreamchunkobject.md:
id: 5393918d9606
last_write_checksum: sha1:0765d94b3d01c811155dce29c20c2ae4bd4abd0e
@@ -998,8 +1050,8 @@ trackedFiles:
pristine_git_object: 7eb1791a9153498d5ffffc6b67d3668df59000c2
docs/components/chatusage.md:
id: 72cd0c41ec64
last_write_checksum: sha1:97805cc7bc61ef57d2279033d8c0b6859cd6e09f
pristine_git_object: 206128fbeaf4799b95c46d20265c1143f83a7898
last_write_checksum: sha1:9a6a709e2ea8f36c1f55afc3ae364917ab787e5e
pristine_git_object: 536fc52c1d3dec20dc3dd38e65714da08779e4d3
docs/components/chatusermessage.md:
id: 4ab205b0030b
last_write_checksum: sha1:4c87fbc12f54bb5b58526949e3f8ea9c161f8cdf
@@ -1376,10 +1428,6 @@ trackedFiles:
id: ec28e83091da
last_write_checksum: sha1:d0b6bd3f94972b0d6051fb9518e8eb3a1768a844
pristine_git_object: eec6060113f1177659279ced122473f4ab031a69
docs/components/data.md:
id: 097aebaf54b6
last_write_checksum: sha1:d4bb8172cfa195109540922294280699df442878
pristine_git_object: b819f7fa193e279112258c63fcf5dce2cd6b36a8
docs/components/datacollection.md:
id: cacd95d2ebf9
last_write_checksum: sha1:1d9eb4c12467860d5ef9edceb6456a4b9d6de643
@@ -1512,6 +1560,10 @@ trackedFiles:
id: 099ed6a1de82
last_write_checksum: sha1:41580565bc483b2ca1cdb981e15d324f8060f504
pristine_git_object: 8463c0cdd55e1d75e23e3d7362f0dbfeca1985c0
docs/components/elobounds.md:
id: a274cbd2e74e
last_write_checksum: sha1:516698f2d4c018cb0e999981d34f4d4d782a2382
pristine_git_object: 101203ebc6a380cabc8c7767c3d9a775bbf16dda
docs/components/endpointinfo.md:
id: 98e0e75e1121
last_write_checksum: sha1:5563b32279aeafa2725d1547df1d0f517e53789d
@@ -3920,10 +3972,6 @@ trackedFiles:
id: beee40001fda
last_write_checksum: sha1:45b7b8881a6560a468153662d61b99605a492edf
pristine_git_object: 2e0839d06f821dd97780dc22f202dedf23e4efe1
docs/components/servertoolusedetails.md:
id: b14e315828c5
last_write_checksum: sha1:2e4e747062c990a502a208c1c90382305e428fe7
pristine_git_object: fb12e181963bb9eada3294d7a605b076f695ab58
docs/components/serviceunavailableresponseerrordata.md:
id: 6d65ecfd7ad3
last_write_checksum: sha1:c0e9357b45a58f3da2d3520b502cec7dae5f3446
@@ -4484,42 +4532,6 @@ trackedFiles:
id: 79b657be05c4
last_write_checksum: sha1:69e58ae8931fc723bbb4aa1212e50b97a83db709
pristine_git_object: 1db2a3a9378d0eeb5de39f1d6621e69bbb7e0953
docs/components/unifiedbenchmarkpricing.md:
id: 2c0b1127a84f
last_write_checksum: sha1:536d10a0997b62e031564acc91dd3d1dede8ae6b
pristine_git_object: 02271ae5d1e6836b02869391fbc7a08df47aaa31
docs/components/unifiedbenchmarksaaitem.md:
id: aa98383cedbb
last_write_checksum: sha1:0c5a943891afc1617252650b539aacda66219cb3
pristine_git_object: 12ee0f9d6c843cabbeea35693eef407c7727e818
docs/components/unifiedbenchmarksaaitemsource.md:
id: a055d68005b2
last_write_checksum: sha1:a2d31b611ef768ef91be865e6ad137219baa49c0
pristine_git_object: 9c7155b69b81eb5b72455656962cd477716a5527
docs/components/unifiedbenchmarksdaitem.md:
id: 97ff97a53af6
last_write_checksum: sha1:7e75867184c7835316e3dba6c41f99915d8f66fe
pristine_git_object: 3b882c36e525b3f547b77796a644d7a533d3e275
docs/components/unifiedbenchmarksdaitemsource.md:
id: e45e347cc983
last_write_checksum: sha1:7d8c239a56a8fcabf6c8633fd174c88d21bd612c
pristine_git_object: 5690f32ab463b163e96353931423c22499ac17ab
docs/components/unifiedbenchmarksmeta.md:
id: eda2de5d8d6b
last_write_checksum: sha1:87bd1e13792184db19280b3dfd52d2bdfa662c0f
pristine_git_object: 0c7f2b688f132e315d9f118e9f322a09e114ef2e
docs/components/unifiedbenchmarksmetasource.md:
id: 093d733c42fd
last_write_checksum: sha1:279c6b724eba7a372ed091be0a5708d976559242
pristine_git_object: 7b1d3f13268aa4486b3b9c914a8574a997e73b54
docs/components/unifiedbenchmarksmetaversion.md:
id: 883a12af05e5
last_write_checksum: sha1:df710f97d758bb6403da1438fd81221a03142e64
pristine_git_object: fa7abb7a34e41e9bba65d7e902d1bffbd431a7ba
docs/components/unifiedbenchmarksresponse.md:
id: 711086447b69
last_write_checksum: sha1:3dc5c9a9383826df432fc634d0818b183fdc3e81
pristine_git_object: b33db5afa589d28b2bf3914d312913e6f8492be1
docs/components/uniqueinsight.md:
id: 8f721a7538ef
last_write_checksum: sha1:d1955a3237b8047e074df6a6cf0e158beeac10c0
@@ -4842,8 +4854,8 @@ trackedFiles:
pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf
docs/operations/arena.md:
id: a9de99ef2b33
last_write_checksum: sha1:e512fec90170ea812bad81c221a6537e2ef92f15
pristine_git_object: 1714dac53f131a38cd5cb11e270e5500b0740280
last_write_checksum: sha1:72964c86d5b8a31c3144454e0ca717b111a5c4f4
pristine_git_object: bb57edab7f915ebccc0af37e46c11b7b23f9dfd9
docs/operations/bulkaddworkspacemembersglobals.md:
id: 6cff183f93a1
last_write_checksum: sha1:39941ebc9a51b0189aed03680e2168e25b7c9692
@@ -4904,10 +4916,6 @@ trackedFiles:
id: 01cceb61d42f
last_write_checksum: sha1:7e1d73bd30584d55f4b116737c15d7c73cdf6a3a
pristine_git_object: 522f4978a3c4e1d1c0d197b541fc57e745b7d4e7
docs/operations/costdetails.md:
id: 777b240173de
last_write_checksum: sha1:b2748fc0cf305791446f5f217947d82bd74a8350
pristine_git_object: 58a1aa8485130f8b49c633dfef0439b83a5f239c
docs/operations/createaudiospeechglobals.md:
id: c67d64f11ad7
last_write_checksum: sha1:a0026b1caf2268dd4a79177fa2bb630eca1498b4
@@ -4982,8 +4990,8 @@ trackedFiles:
pristine_git_object: 1ff75cb8fa59d2b7b756ea07e9f5849995b62435
docs/operations/createembeddingsusage.md:
id: 2dc99973f6c7
last_write_checksum: sha1:292de8b3a80697b56a961d2eb7f97d54dd29c4ae
pristine_git_object: 639fb7e305ff27786b6ea858b425e36aaaf20252
last_write_checksum: sha1:b01ba733f5d1369b21a54b9f3bfb0e4059504b6f
pristine_git_object: 007fb235eef4ebb9b3dda14352e9a252004de4c2
docs/operations/createguardrailglobals.md:
id: 34f5b2a17330
last_write_checksum: sha1:a43fb357b9c08974befd14a79da7623e72bc3245
@@ -5272,14 +5280,22 @@ trackedFiles:
id: f6276c91ff17
last_write_checksum: sha1:9c80418c5384e63542ea16aa336c3bfe54c23b64
pristine_git_object: f0d402fbc8b66cc075706e056fd152e41e141c3f
docs/operations/getbenchmarksglobals.md:
id: 18c553c31212
last_write_checksum: sha1:99f5c115ff5fd28f04cb80fe4dfa280f12c7c68b
pristine_git_object: 215e03e822bc8d9945711a5b08bdb1790617dd3b
docs/operations/getbenchmarksrequest.md:
id: 0a40a540bba0
last_write_checksum: sha1:1f54c7ebf3f8cf6a4da9ea292294187792b0c614
pristine_git_object: e9088a6e0d7573ec4723f0bf912ddd30bd2eb485
docs/operations/getbenchmarksartificialanalysisglobals.md:
id: fc980e69438e
last_write_checksum: sha1:4b7871db540cc8d255518b0fb51845738a2b7d09
pristine_git_object: 8925cb558b063d232a4eab418279d6fe69443023
docs/operations/getbenchmarksartificialanalysisrequest.md:
id: 998a53047e6f
last_write_checksum: sha1:c4e6ee2f48087e0198b49e16c286f7034b043034
pristine_git_object: bca988aaed6a6fee2fa08342305a1070c2d41c95
docs/operations/getbenchmarksdesignarenaglobals.md:
id: 4e2f927bea8b
last_write_checksum: sha1:76d2ff4919b87f05d3672f5b660033d2c9e689a2
pristine_git_object: d6c6cad08146378c7794aa8af56234a01cf0df71
docs/operations/getbenchmarksdesignarenarequest.md:
id: aea9fe0d448c
last_write_checksum: sha1:433d65b3a6d7fe0b3e4a824a8ca9f9a36593a6be
pristine_git_object: 73202a7094b97faf481947434a8253f72eb872b6
docs/operations/getbyokkeyglobals.md:
id: 82a8cd8db21c
last_write_checksum: sha1:4490949622267f537def903fa3efe64142925739
@@ -5820,18 +5836,10 @@ trackedFiles:
id: 354b29241c52
last_write_checksum: sha1:baf6f1195eeabcb4742fec427127f2c33ffd9b3c
pristine_git_object: c4ba8c79c6ba3021472583b922c3ef01c4115bf4
docs/operations/source.md:
id: 8d5b4a7ef752
last_write_checksum: sha1:e46913a18472448a48f87fc83f400ef7e9624977
pristine_git_object: aeba9c144e6043108e3b6eb4446518f00f7927e5
docs/operations/subcategory.md:
id: "169243175101"
last_write_checksum: sha1:ddf3195ab7768df3095efa4cc86ea7b5ca3504f3
pristine_git_object: 912cc5d754a041cfdddbad5c704505a3f7da1cec
docs/operations/tasktype.md:
id: f741399fcc2a
last_write_checksum: sha1:e3b9c5b4a2b103ee4c7f60e7c8eb25b8a351c970
pristine_git_object: f978421391efaf8d7b0b449cbcba9b82a93d182a
docs/operations/timerange.md:
id: a5ee8c05a917
last_write_checksum: sha1:00b61805899422b836494a24088ec33674316714
@@ -5948,10 +5956,6 @@ trackedFiles:
id: e2bd25998427
last_write_checksum: sha1:82bec11fedf21eed760739e1adb08fec06239279
pristine_git_object: 6e72f51df9e9811cee424032f7dba0887e15afec
docs/sdks/benchmarks/README.md:
id: 61c16262af9b
last_write_checksum: sha1:0ebef898413dbfb2b853ca4cb6af668ee823714b
pristine_git_object: cc91680b1792bbb52eca1ef2aadebd4e49f393c9
docs/sdks/betaanalytics/README.md:
id: e037af84b386
last_write_checksum: sha1:78a1ed27ae55ac9b6e6926e2587adeda0de65aa3
@@ -5970,8 +5974,8 @@ trackedFiles:
pristine_git_object: 1837ff59343eb87482e8750c1fb5d2b5f89aae6a
docs/sdks/datasets/README.md:
id: deb5d90f4faf
last_write_checksum: sha1:c09c0c118def84591a90132f77b67f40ae9e3d1e
pristine_git_object: afcf796dfd4d793bbfe7bcd3bdd81e5fe908de94
last_write_checksum: sha1:a3585d8d399421584c3f65610c59fe5dfbf897ab
pristine_git_object: f097289cff8c229c70c4f9e3e934f28372f69167
docs/sdks/embeddings/README.md:
id: 15b5b04486c1
last_write_checksum: sha1:c2ed15521af31873f56e7813292aa30c5adf94e4
@@ -6088,10 +6092,6 @@ trackedFiles:
id: c5733c5a1e12
last_write_checksum: sha1:71f242fd9955e5a17a8d055e2210cc2708bb94fc
pristine_git_object: fcffdcc6eaa61a4b79f7f1f76458eeb27e8f896d
src/openrouter/benchmarks.py:
id: 178d2ad8d706
last_write_checksum: sha1:1848fee2325139d8d0332bee42ea2a88ce6d6fa1
pristine_git_object: 9be3aea8a1564cf0305c0b210a6134768e9f2678
src/openrouter/beta.py:
id: fffdf54fd8f5
last_write_checksum: sha1:7999d9294e23e166c6b27236262f1fb40139a4d1
@@ -6110,8 +6110,8 @@ trackedFiles:
pristine_git_object: a1894915bd32aee65f019885634eb7908970a046
src/openrouter/components/__init__.py:
id: 81754e97b3f4
last_write_checksum: sha1:e59a97a36a75c1848f5342f9c3d061dd993855d8
pristine_git_object: f2928e99d526cad8e81c673c4c03bc864c14a365
last_write_checksum: sha1:a136f824b02becfa0584a28474bb5f308a6861dc
pristine_git_object: 9df66e9e82ebd373652cc654f23b104ef315f3c5
src/openrouter/components/aabenchmarkentry.py:
id: e2e0f0b48c82
last_write_checksum: sha1:1b6b66672fb80dccdc39843a98bdef6d7d804364
@@ -6348,6 +6348,34 @@ trackedFiles:
id: 5533c01ab156
last_write_checksum: sha1:0d74bf725e24809c704e0c293d72ea96a897446b
pristine_git_object: 0e610680e018be53b3e62759ad61e9f7c416640b
src/openrouter/components/benchmarkpricing.py:
id: a7c56383dbe6
last_write_checksum: sha1:2af31e20dfde609e7d5c1b791e02b55a483d92c6
pristine_git_object: 3524f786e3f73c7436e061800ecd403d92854621
src/openrouter/components/benchmarksaaitem.py:
id: a90a5423d2ab
last_write_checksum: sha1:7b10783085a9bb672306573cf73a8a77f5d65973
pristine_git_object: 2855ffe10969511370a40e492b4956196a075864
src/openrouter/components/benchmarksaameta.py:
id: 67ea1de84da3
last_write_checksum: sha1:def05fd7d2546eeb56f2e908c1032aa2a9f8af1e
pristine_git_object: 9d751f4abb5b2d88625ecf05a447f9368b03999e
src/openrouter/components/benchmarksaaresponse.py:
id: b0b47f818fb0
last_write_checksum: sha1:9fff98aec7bdcf688bb46673949f2badf0c21c33
pristine_git_object: 787ae1ca313f84e1f958d01fbde16a7addfe30c3
src/openrouter/components/benchmarksdaitem.py:
id: 575945def054
last_write_checksum: sha1:7cd6079757b7be8f6e3add94eb05d68cf7c73bc4
pristine_git_object: 7713e2e8acdc2a75742873408b2238c163acba91
src/openrouter/components/benchmarksdameta.py:
id: dd1d01a44665
last_write_checksum: sha1:e8e640d403468fe3be115da58a843eb37cc2e292
pristine_git_object: 0ca3550d2febc93be4ef3f4df531ef4e2dca6358
src/openrouter/components/benchmarksdaresponse.py:
id: 9e8cefb8d1e1
last_write_checksum: sha1:694c9e050fec812c95cf37eeb53b9e3920773106
pristine_git_object: 7588fc5242eb12d83c24453d8dad455d6ee7e1aa
src/openrouter/components/bulkaddworkspacemembersrequest.py:
id: c042d4bce938
last_write_checksum: sha1:dd5b69cce65985231a77351be04aadeecc85c46c
@@ -6566,8 +6594,8 @@ trackedFiles:
pristine_git_object: 2ccba8386486b7a730816a9829b01754935a2e96
src/openrouter/components/chatusage.py:
id: f224a054bf45
last_write_checksum: sha1:e63f9a7b86d0091b0fddf04ee273088b51dd76a6
pristine_git_object: 62e2f91566dbcaf0794d927b679552757efe46b1
last_write_checksum: sha1:947079d2163225a49e423151de25dc6132df5bf6
pristine_git_object: 3a7357d8a6f725ba18b1f15215a197f11e917659
src/openrouter/components/chatusermessage.py:
id: 7777191e729a
last_write_checksum: sha1:1ecc9101c05178427d73e455de4d679ac8d78015
@@ -7920,26 +7948,6 @@ trackedFiles:
id: 7d9755fc8395
last_write_checksum: sha1:d614e72cc67bf6c4da7f57cf0f4367de726ec06d
pristine_git_object: 0fc3c7c3991891ae00ae2f624df78d21e0ae05a8
src/openrouter/components/unifiedbenchmarkpricing.py:
id: b08adf1a31d0
last_write_checksum: sha1:e8d1cb425c61a7094f50a73e59cec6d64dc34204
pristine_git_object: bad387cea54fcab00e8a7fe54780dd97a29d72c3
src/openrouter/components/unifiedbenchmarksaaitem.py:
id: cc8382ac1af5
last_write_checksum: sha1:39fc6f0409234ec30e6bbdba2736e278abda8756
pristine_git_object: a01518d4c996f16bd740489684b20a9682db0f0e
src/openrouter/components/unifiedbenchmarksdaitem.py:
id: 946501943ce2
last_write_checksum: sha1:22bbe61dd833db3da96796ebfdcd3141dd0ed126
pristine_git_object: 0bb8159d555e263bd875bd42e1cf0e552c3573b5
src/openrouter/components/unifiedbenchmarksmeta.py:
id: ca02b44f633a
last_write_checksum: sha1:51ddebd33c93d098e9c61a8b78bbc3c7dddd9d41
pristine_git_object: c336e5f881c0b244d7e8e77af130a7c9bcad7290
src/openrouter/components/unifiedbenchmarksresponse.py:
id: 4f7bbccaba03
last_write_checksum: sha1:1c1195908154b530fb82e0782a9cab884e833aa9
pristine_git_object: a1daaa7ca0c2794e4317902ea856dc88475acce8
src/openrouter/components/unprocessableentityresponseerrordata.py:
id: e8ca4a51f994
last_write_checksum: sha1:d9ff0dea491e12d5ccb28607eb65f00fe8d694aa
@@ -8110,8 +8118,8 @@ trackedFiles:
pristine_git_object: 0a376fb8ee2df0be8546458e0008a2fbc0fd492a
src/openrouter/datasets.py:
id: 2378f80d1d6a
last_write_checksum: sha1:057b0dde4e051f2cf5cd9fd5b82bbe45eb8fafc5
pristine_git_object: c483912549b3243f73b300bcea343914e66ef211
last_write_checksum: sha1:16857b6d0c5e815cfacb6db6eef804dd37493a38
pristine_git_object: c80a941f2da9bc4c71561fb804ca4e64dfb7c31b
src/openrouter/embeddings.py:
id: 0374ace39067
last_write_checksum: sha1:8622e7717ef639f2ee452d295c4b2c957a2fe13f
@@ -8242,8 +8250,8 @@ trackedFiles:
pristine_git_object: 37ee42a638f5fce69fc7db1e6b86efb51f381582
src/openrouter/operations/__init__.py:
id: 9afcea1e7161
last_write_checksum: sha1:b555b71cf7d07da5aa6b121a740d1ef69e513629
pristine_git_object: b9e4c525f346b441e837c4497cc2e8d723a44352
last_write_checksum: sha1:5b56b8c29c9360d44a121cdb78811b323c2f5093
pristine_git_object: 8b12f08941bfd82eabf06beb651eaced69f48158
src/openrouter/operations/bulkaddworkspacemembers.py:
id: e0ed56117619
last_write_checksum: sha1:2b9c73dd8a24d6c479d50118a309e4e0969ca7ea
@@ -8286,8 +8294,8 @@ trackedFiles:
pristine_git_object: 523d24efa869d63a145167b94e811671b84c5cfb
src/openrouter/operations/createembeddings.py:
id: fe1160a960e9
last_write_checksum: sha1:55a231d6e9a2f2a76c3fbc1f8af893e393e08bc3
pristine_git_object: 6459cab7e1a597f5a1b24f690d845b4ee8809236
last_write_checksum: sha1:5307ac65b8a4c3eec3de9158c2a3d10554212e8b
pristine_git_object: 4cc4c5c044fa87a8ae21dd7aa0f83d09f4d00f09
src/openrouter/operations/createguardrail.py:
id: 52ed4b2f5903
last_write_checksum: sha1:119141c01d19df6b6d090b67f80145e3bf4d4d60
@@ -8372,10 +8380,14 @@ trackedFiles:
id: 5ffd23dafcc1
last_write_checksum: sha1:c9011252cc7862d8c35b4ff2f3c82003c98953de
pristine_git_object: d19ef64ed4dcc19027c95ba19c9b37ed301ebb72
src/openrouter/operations/getbenchmarks.py:
id: 5fb88644491e
last_write_checksum: sha1:450e522cd4e5b332328f8567dbbbf61f4f47e20e
pristine_git_object: 6a36cea63dac2f7702b23421a8def30dd4578e80
src/openrouter/operations/getbenchmarksartificialanalysis.py:
id: c967fd553338
last_write_checksum: sha1:75aed29dbc8f9d41ba0eb3dabd077a2747018eb9
pristine_git_object: 707ed91247e14983a8fdc1241b83c9512db9144f
src/openrouter/operations/getbenchmarksdesignarena.py:
id: b05492401be4
last_write_checksum: sha1:fa36e7a28e19c67d8b72060ce85fa6c83e3b7ca9
pristine_git_object: 2ac2aed2e814ba1a8dc6ad49d05ae582a42f149d
src/openrouter/operations/getbyokkey.py:
id: d141452bd88a
last_write_checksum: sha1:16c33afc84cd0d3a68e977e739a59d14dfd3bd44
@@ -8594,8 +8606,8 @@ trackedFiles:
pristine_git_object: 944aff9aa812fff9b702d8735a37ea279d915a1d
src/openrouter/sdk.py:
id: ee9846c4c9c5
last_write_checksum: sha1:3c56a0b380306e3fd0c16cdc5119123681112ef6
pristine_git_object: 1105dc4218ffe9bb0f0ad814c2e77000497867e0
last_write_checksum: sha1:b2d1f64ba5783c98dc31e15e23966d83abaa2d9d
pristine_git_object: abc46c8355ba5cd0fee2e8e1536ac90eda7aa1b4
src/openrouter/sdkconfiguration.py:
id: 55773bb98d7c
last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001
@@ -10042,31 +10054,9 @@ examples:
application/json: {"error": {"code": 404, "message": "Resource not found"}}
"500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
getBenchmarks:
speakeasy-default-get-benchmarks:
parameters:
query:
source: "artificial-analysis"
max_results: 20
responses:
"200":
application/json: {"data": [{"agentic_index": 58.3, "coding_index": 65.8, "display_name": "GPT-4o", "intelligence_index": 71.2, "model_permaslug": "openai/gpt-4o", "pricing": {"completion": "0.00001", "prompt": "0.0000025"}, "source": "artificial-analysis"}], "meta": {"as_of": "2026-06-03T12:00:00Z", "citation": "Source: Artificial Analysis (artificialanalysis.ai) via OpenRouter (openrouter.ai/rankings).", "model_count": 1, "source": "artificial-analysis", "source_url": "https://artificialanalysis.ai", "task_type": null, "version": "v1"}}
"400":
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
"401":
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
"429":
application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}}
"500":
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
examplesVersion: 1.0.2
releaseNotes: |
## Python SDK Changes:
* `open_router.benchmarks.get_benchmarks()`: **Added**
* `open_router.datasets.get_benchmarks_artificial_analysis()`: **Deleted** **Breaking** :warning:
* `open_router.datasets.get_benchmarks_design_arena()`: **Deleted** **Breaking** :warning:
* `open_router.chat.send()`: `response` **Changed**
* `open_router.embeddings.generate()`: `response.usage` **Changed**
* `open_router.embeddings.list_models()`: `response.data.[].reasoning` **Added**
* `open_router.models.get()`: `response.data.reasoning` **Added**
* `open_router.models.list()`: `response.data.[].reasoning` **Added**
+554 -449
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -2,20 +2,20 @@ speakeasyVersion: 1.680.0
sources:
OpenRouter API:
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:1e8bbe0cea645a95cb24c3e0061459d903aca98286d2c74de7cb8359b8c3c29d
sourceBlobDigest: sha256:42b4b8df42026cfc885ee4b34e7a30aaa906f40dc6ad99ea9e6c65e4bad495de
sourceRevisionDigest: sha256:b28471bf9c3ac9b7d9b816a09bfb5b5c58d98db2d82dbc971d64f5aa980f4e10
sourceBlobDigest: sha256:8d445ea792f56fb2ebeb3f418757e6404802be1c21ab50520c66d10871bb960a
tags:
- latest
- speakeasy-sdk-regen-1781885111
- speakeasy-sdk-regen-1781726096
- 1.0.0
targets:
open-router:
source: OpenRouter API
sourceNamespace: open-router-chat-completions-api
sourceRevisionDigest: sha256:1e8bbe0cea645a95cb24c3e0061459d903aca98286d2c74de7cb8359b8c3c29d
sourceBlobDigest: sha256:42b4b8df42026cfc885ee4b34e7a30aaa906f40dc6ad99ea9e6c65e4bad495de
sourceRevisionDigest: sha256:b28471bf9c3ac9b7d9b816a09bfb5b5c58d98db2d82dbc971d64f5aa980f4e10
sourceBlobDigest: sha256:8d445ea792f56fb2ebeb3f418757e6404802be1c21ab50520c66d10871bb960a
codeSamplesNamespace: open-router-python-code-samples
codeSamplesRevisionDigest: sha256:a16acd4648a2b2c90df0256551f25bb6515c70ea239dba657f07fce770e459d5
codeSamplesRevisionDigest: sha256:0bb2447eb2e776cdc9347c290ddcde4be0b9f9ded69c93e5b29231e2c54c3e5f
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.680.0
+1 -1
View File
@@ -30,7 +30,7 @@ Based on:
### Releases
- [PyPI v0.10.0] https://pypi.org/project/openrouter/0.10.0 - .
## 2026-06-22 00:59:00
## 2026-06-18 00:58:22
### Changes
Based on:
- OpenAPI Doc
-303
View File
@@ -1,303 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from .basesdk import BaseSDK
from openrouter import components, errors, operations, utils
from openrouter._hooks import HookContext
from openrouter.types import OptionalNullable, UNSET
from openrouter.utils import get_security_from_env
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
from typing import Any, Mapping, Optional
class Benchmarks(BaseSDK):
r"""Benchmarks endpoints"""
def get_benchmarks(
self,
*,
source: operations.Source,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
task_type: Optional[operations.TaskType] = None,
arena: Optional[operations.Arena] = None,
category: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.UnifiedBenchmarksResponse:
r"""List Benchmarks
Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param source: Benchmark source to query. Determines the shape of the returned items.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param task_type: Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category.
:param arena: Design Arena only: arena to query. Defaults to `models` when source is `design-arena`.
:param category: Design Arena only: category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
:param max_results: Max results to return (1100, default 50).
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
source=source,
task_type=task_type,
arena=arena,
category=category,
max_results=max_results,
)
req = self._build_request(
method="GET",
path="/benchmarks",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarks",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.UnifiedBenchmarksResponse, http_res
)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def get_benchmarks_async(
self,
*,
source: operations.Source,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
task_type: Optional[operations.TaskType] = None,
arena: Optional[operations.Arena] = None,
category: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.UnifiedBenchmarksResponse:
r"""List Benchmarks
Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param source: Benchmark source to query. Determines the shape of the returned items.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param task_type: Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category.
:param arena: Design Arena only: arena to query. Defaults to `models` when source is `design-arena`.
:param category: Design Arena only: category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
:param max_results: Max results to return (1100, default 50).
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
source=source,
task_type=task_type,
arena=arena,
category=category,
max_results=max_results,
)
req = self._build_request_async(
method="GET",
path="/benchmarks",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarks",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(
components.UnifiedBenchmarksResponse, http_res
)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
+78 -68
View File
@@ -276,6 +276,38 @@ if TYPE_CHECKING:
BashServerToolEnvironment,
BashServerToolEnvironmentTypedDict,
)
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
from .benchmarksaameta import (
BenchmarksAAMeta,
BenchmarksAAMetaSource,
BenchmarksAAMetaSourceURL,
BenchmarksAAMetaTypedDict,
BenchmarksAAMetaVersion,
)
from .benchmarksaaresponse import (
BenchmarksAAResponse,
BenchmarksAAResponseTypedDict,
)
from .benchmarksdaitem import (
BenchmarksDAItem,
BenchmarksDAItemTypedDict,
TournamentStats,
TournamentStatsTypedDict,
)
from .benchmarksdameta import (
BenchmarksDAMeta,
BenchmarksDAMetaSource,
BenchmarksDAMetaSourceURL,
BenchmarksDAMetaTypedDict,
BenchmarksDAMetaVersion,
EloBounds,
EloBoundsTypedDict,
)
from .benchmarksdaresponse import (
BenchmarksDAResponse,
BenchmarksDAResponseTypedDict,
)
from .bulkaddworkspacemembersrequest import (
BulkAddWorkspaceMembersRequest,
BulkAddWorkspaceMembersRequestTypedDict,
@@ -527,8 +559,6 @@ if TYPE_CHECKING:
CompletionTokensDetailsTypedDict,
PromptTokensDetails,
PromptTokensDetailsTypedDict,
ServerToolUseDetails,
ServerToolUseDetailsTypedDict,
)
from .chatusermessage import (
ChatUserMessage,
@@ -2319,34 +2349,6 @@ if TYPE_CHECKING:
UnauthorizedResponseErrorData,
UnauthorizedResponseErrorDataTypedDict,
)
from .unifiedbenchmarkpricing import (
UnifiedBenchmarkPricing,
UnifiedBenchmarkPricingTypedDict,
)
from .unifiedbenchmarksaaitem import (
UnifiedBenchmarksAAItem,
UnifiedBenchmarksAAItemSource,
UnifiedBenchmarksAAItemTypedDict,
)
from .unifiedbenchmarksdaitem import (
TournamentStats,
TournamentStatsTypedDict,
UnifiedBenchmarksDAItem,
UnifiedBenchmarksDAItemSource,
UnifiedBenchmarksDAItemTypedDict,
)
from .unifiedbenchmarksmeta import (
UnifiedBenchmarksMeta,
UnifiedBenchmarksMetaSource,
UnifiedBenchmarksMetaTypedDict,
UnifiedBenchmarksMetaVersion,
)
from .unifiedbenchmarksresponse import (
Data,
DataTypedDict,
UnifiedBenchmarksResponse,
UnifiedBenchmarksResponseTypedDict,
)
from .unprocessableentityresponseerrordata import (
UnprocessableEntityResponseErrorData,
UnprocessableEntityResponseErrorDataTypedDict,
@@ -2727,6 +2729,26 @@ __all__ = [
"BashServerToolEnvironmentTypedDict",
"BashServerToolType",
"BashServerToolTypedDict",
"BenchmarkPricing",
"BenchmarkPricingTypedDict",
"BenchmarksAAItem",
"BenchmarksAAItemTypedDict",
"BenchmarksAAMeta",
"BenchmarksAAMetaSource",
"BenchmarksAAMetaSourceURL",
"BenchmarksAAMetaTypedDict",
"BenchmarksAAMetaVersion",
"BenchmarksAAResponse",
"BenchmarksAAResponseTypedDict",
"BenchmarksDAItem",
"BenchmarksDAItemTypedDict",
"BenchmarksDAMeta",
"BenchmarksDAMetaSource",
"BenchmarksDAMetaSourceURL",
"BenchmarksDAMetaTypedDict",
"BenchmarksDAMetaVersion",
"BenchmarksDAResponse",
"BenchmarksDAResponseTypedDict",
"BulkAddWorkspaceMembersRequest",
"BulkAddWorkspaceMembersRequestTypedDict",
"BulkAddWorkspaceMembersResponse",
@@ -3048,10 +3070,8 @@ __all__ = [
"CustomToolTypedDict",
"DABenchmarkEntry",
"DABenchmarkEntryTypedDict",
"Data",
"DataCollection",
"DataRegion",
"DataTypedDict",
"DatetimeServerTool",
"DatetimeServerToolConfig",
"DatetimeServerToolConfigTypedDict",
@@ -3102,6 +3122,8 @@ __all__ = [
"EditCompact20260112TypedDict",
"EditTypeInputTokens",
"EditTypedDict",
"EloBounds",
"EloBoundsTypedDict",
"EndpointInfo",
"EndpointInfoTypedDict",
"EndpointStatus",
@@ -4058,8 +4080,6 @@ __all__ = [
"SearchQualityLevel",
"Security",
"SecurityTypedDict",
"ServerToolUseDetails",
"ServerToolUseDetailsTypedDict",
"ServiceUnavailableResponseErrorData",
"ServiceUnavailableResponseErrorDataTypedDict",
"ShellCallItem",
@@ -4261,20 +4281,6 @@ __all__ = [
"URLCitationTypedDict",
"UnauthorizedResponseErrorData",
"UnauthorizedResponseErrorDataTypedDict",
"UnifiedBenchmarkPricing",
"UnifiedBenchmarkPricingTypedDict",
"UnifiedBenchmarksAAItem",
"UnifiedBenchmarksAAItemSource",
"UnifiedBenchmarksAAItemTypedDict",
"UnifiedBenchmarksDAItem",
"UnifiedBenchmarksDAItemSource",
"UnifiedBenchmarksDAItemTypedDict",
"UnifiedBenchmarksMeta",
"UnifiedBenchmarksMetaSource",
"UnifiedBenchmarksMetaTypedDict",
"UnifiedBenchmarksMetaVersion",
"UnifiedBenchmarksResponse",
"UnifiedBenchmarksResponseTypedDict",
"UniqueInsight",
"UniqueInsightTypedDict",
"UnprocessableEntityResponseErrorData",
@@ -4567,6 +4573,30 @@ _dynamic_imports: dict[str, str] = {
"BashServerToolEngine": ".bashservertoolengine",
"BashServerToolEnvironment": ".bashservertoolenvironment",
"BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment",
"BenchmarkPricing": ".benchmarkpricing",
"BenchmarkPricingTypedDict": ".benchmarkpricing",
"BenchmarksAAItem": ".benchmarksaaitem",
"BenchmarksAAItemTypedDict": ".benchmarksaaitem",
"BenchmarksAAMeta": ".benchmarksaameta",
"BenchmarksAAMetaSource": ".benchmarksaameta",
"BenchmarksAAMetaSourceURL": ".benchmarksaameta",
"BenchmarksAAMetaTypedDict": ".benchmarksaameta",
"BenchmarksAAMetaVersion": ".benchmarksaameta",
"BenchmarksAAResponse": ".benchmarksaaresponse",
"BenchmarksAAResponseTypedDict": ".benchmarksaaresponse",
"BenchmarksDAItem": ".benchmarksdaitem",
"BenchmarksDAItemTypedDict": ".benchmarksdaitem",
"TournamentStats": ".benchmarksdaitem",
"TournamentStatsTypedDict": ".benchmarksdaitem",
"BenchmarksDAMeta": ".benchmarksdameta",
"BenchmarksDAMetaSource": ".benchmarksdameta",
"BenchmarksDAMetaSourceURL": ".benchmarksdameta",
"BenchmarksDAMetaTypedDict": ".benchmarksdameta",
"BenchmarksDAMetaVersion": ".benchmarksdameta",
"EloBounds": ".benchmarksdameta",
"EloBoundsTypedDict": ".benchmarksdameta",
"BenchmarksDAResponse": ".benchmarksdaresponse",
"BenchmarksDAResponseTypedDict": ".benchmarksdaresponse",
"BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest",
"BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest",
"BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse",
@@ -4746,8 +4776,6 @@ _dynamic_imports: dict[str, str] = {
"CompletionTokensDetailsTypedDict": ".chatusage",
"PromptTokensDetails": ".chatusage",
"PromptTokensDetailsTypedDict": ".chatusage",
"ServerToolUseDetails": ".chatusage",
"ServerToolUseDetailsTypedDict": ".chatusage",
"ChatUserMessage": ".chatusermessage",
"ChatUserMessageContent": ".chatusermessage",
"ChatUserMessageContentTypedDict": ".chatusermessage",
@@ -6106,24 +6134,6 @@ _dynamic_imports: dict[str, str] = {
"Truncation": ".truncation",
"UnauthorizedResponseErrorData": ".unauthorizedresponseerrordata",
"UnauthorizedResponseErrorDataTypedDict": ".unauthorizedresponseerrordata",
"UnifiedBenchmarkPricing": ".unifiedbenchmarkpricing",
"UnifiedBenchmarkPricingTypedDict": ".unifiedbenchmarkpricing",
"UnifiedBenchmarksAAItem": ".unifiedbenchmarksaaitem",
"UnifiedBenchmarksAAItemSource": ".unifiedbenchmarksaaitem",
"UnifiedBenchmarksAAItemTypedDict": ".unifiedbenchmarksaaitem",
"TournamentStats": ".unifiedbenchmarksdaitem",
"TournamentStatsTypedDict": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksDAItem": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksDAItemSource": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksDAItemTypedDict": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksMeta": ".unifiedbenchmarksmeta",
"UnifiedBenchmarksMetaSource": ".unifiedbenchmarksmeta",
"UnifiedBenchmarksMetaTypedDict": ".unifiedbenchmarksmeta",
"UnifiedBenchmarksMetaVersion": ".unifiedbenchmarksmeta",
"Data": ".unifiedbenchmarksresponse",
"DataTypedDict": ".unifiedbenchmarksresponse",
"UnifiedBenchmarksResponse": ".unifiedbenchmarksresponse",
"UnifiedBenchmarksResponseTypedDict": ".unifiedbenchmarksresponse",
"UnprocessableEntityResponseErrorData": ".unprocessableentityresponseerrordata",
"UnprocessableEntityResponseErrorDataTypedDict": ".unprocessableentityresponseerrordata",
"UpdateBYOKKeyRequest": ".updatebyokkeyrequest",
@@ -5,7 +5,7 @@ from openrouter.types import BaseModel
from typing_extensions import TypedDict
class UnifiedBenchmarkPricingTypedDict(TypedDict):
class BenchmarkPricingTypedDict(TypedDict):
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
completion: str
@@ -14,7 +14,7 @@ class UnifiedBenchmarkPricingTypedDict(TypedDict):
r"""Cost per input token (USD, decimal string)."""
class UnifiedBenchmarkPricing(BaseModel):
class BenchmarkPricing(BaseModel):
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
completion: str
@@ -1,59 +1,46 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .unifiedbenchmarkpricing import (
UnifiedBenchmarkPricing,
UnifiedBenchmarkPricingTypedDict,
)
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
UnifiedBenchmarksAAItemSource = Literal["artificial-analysis",]
r"""Benchmark source discriminator."""
class UnifiedBenchmarksAAItemTypedDict(TypedDict):
class BenchmarksAAItemTypedDict(TypedDict):
aa_name: str
r"""Model name as listed on Artificial Analysis."""
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index composite score. Higher is better."""
display_name: str
r"""Model name as listed on Artificial Analysis."""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
model_permaslug: str
r"""Stable OpenRouter model identifier."""
pricing: Nullable[UnifiedBenchmarkPricingTypedDict]
pricing: Nullable[BenchmarkPricingTypedDict]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksAAItemSource
r"""Benchmark source discriminator."""
class UnifiedBenchmarksAAItem(BaseModel):
class BenchmarksAAItem(BaseModel):
aa_name: str
r"""Model name as listed on Artificial Analysis."""
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index composite score. Higher is better."""
display_name: str
r"""Model name as listed on Artificial Analysis."""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
model_permaslug: str
r"""Stable OpenRouter model identifier."""
pricing: Nullable[UnifiedBenchmarkPricing]
pricing: Nullable[BenchmarkPricing]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksAAItemSource
r"""Benchmark source discriminator."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
@@ -0,0 +1,53 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
BenchmarksAAMetaSource = Literal["artificial-analysis",]
r"""Data source identifier."""
BenchmarksAAMetaSourceURL = Literal["https://artificialanalysis.ai",]
r"""URL of the upstream data source."""
BenchmarksAAMetaVersion = Literal["v1",]
r"""Dataset version."""
class BenchmarksAAMetaTypedDict(TypedDict):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksAAMetaSource
r"""Data source identifier."""
source_url: BenchmarksAAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksAAMetaVersion
r"""Dataset version."""
class BenchmarksAAMeta(BaseModel):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksAAMetaSource
r"""Data source identifier."""
source_url: BenchmarksAAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksAAMetaVersion
r"""Dataset version."""
@@ -0,0 +1,19 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
from .benchmarksaameta import BenchmarksAAMeta, BenchmarksAAMetaTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BenchmarksAAResponseTypedDict(TypedDict):
data: List[BenchmarksAAItemTypedDict]
meta: BenchmarksAAMetaTypedDict
class BenchmarksAAResponse(BaseModel):
data: List[BenchmarksAAItem]
meta: BenchmarksAAMeta
@@ -1,20 +1,12 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .unifiedbenchmarkpricing import (
UnifiedBenchmarkPricing,
UnifiedBenchmarkPricingTypedDict,
)
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
UnifiedBenchmarksDAItemSource = Literal["design-arena",]
r"""Benchmark source discriminator."""
class TournamentStatsTypedDict(TypedDict):
r"""Placement distribution from tournament matches."""
@@ -75,7 +67,7 @@ class TournamentStats(BaseModel):
return m
class UnifiedBenchmarksDAItemTypedDict(TypedDict):
class BenchmarksDAItemTypedDict(TypedDict):
arena: str
r"""Arena this ranking belongs to."""
avg_generation_time_ms: Nullable[float]
@@ -87,18 +79,16 @@ class UnifiedBenchmarksDAItemTypedDict(TypedDict):
elo: float
r"""ELO rating from head-to-head arena battles."""
model_permaslug: str
r"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id."""
pricing: Nullable[UnifiedBenchmarkPricingTypedDict]
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
pricing: Nullable[BenchmarkPricingTypedDict]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksDAItemSource
r"""Benchmark source discriminator."""
tournament_stats: TournamentStatsTypedDict
r"""Placement distribution from tournament matches."""
win_rate: float
r"""Win rate as a percentage (0100)."""
class UnifiedBenchmarksDAItem(BaseModel):
class BenchmarksDAItem(BaseModel):
arena: str
r"""Arena this ranking belongs to."""
@@ -115,14 +105,11 @@ class UnifiedBenchmarksDAItem(BaseModel):
r"""ELO rating from head-to-head arena battles."""
model_permaslug: str
r"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id."""
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
pricing: Nullable[UnifiedBenchmarkPricing]
pricing: Nullable[BenchmarkPricing]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksDAItemSource
r"""Benchmark source discriminator."""
tournament_stats: TournamentStats
r"""Placement distribution from tournament matches."""
@@ -0,0 +1,118 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
class EloBoundsTypedDict(TypedDict):
r"""ELO range across all returned models for normalization."""
max: float
r"""Maximum ELO in the result set."""
min: float
r"""Minimum ELO in the result set."""
class EloBounds(BaseModel):
r"""ELO range across all returned models for normalization."""
max: float
r"""Maximum ELO in the result set."""
min: float
r"""Minimum ELO in the result set."""
BenchmarksDAMetaSource = Literal["design-arena",]
r"""Data source identifier."""
BenchmarksDAMetaSourceURL = Literal["https://www.designarena.ai",]
r"""URL of the upstream data source."""
BenchmarksDAMetaVersion = Literal["v1",]
r"""Dataset version."""
class BenchmarksDAMetaTypedDict(TypedDict):
arena: str
r"""The arena filter applied."""
as_of: str
r"""ISO-8601 timestamp of when this data was generated."""
category: Nullable[str]
r"""The category filter applied, or null if showing all."""
citation: str
r"""Required attribution when republishing this data."""
elo_bounds: EloBoundsTypedDict
r"""ELO range across all returned models for normalization."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksDAMetaSource
r"""Data source identifier."""
source_url: BenchmarksDAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksDAMetaVersion
r"""Dataset version."""
class BenchmarksDAMeta(BaseModel):
arena: str
r"""The arena filter applied."""
as_of: str
r"""ISO-8601 timestamp of when this data was generated."""
category: Nullable[str]
r"""The category filter applied, or null if showing all."""
citation: str
r"""Required attribution when republishing this data."""
elo_bounds: EloBounds
r"""ELO range across all returned models for normalization."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksDAMetaSource
r"""Data source identifier."""
source_url: BenchmarksDAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksDAMetaVersion
r"""Dataset version."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["category"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,19 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict
from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BenchmarksDAResponseTypedDict(TypedDict):
data: List[BenchmarksDAItemTypedDict]
meta: BenchmarksDAMetaTypedDict
class BenchmarksDAResponse(BaseModel):
data: List[BenchmarksDAItem]
meta: BenchmarksDAMeta
-69
View File
@@ -112,68 +112,6 @@ class PromptTokensDetails(BaseModel):
r"""Video input tokens"""
class ServerToolUseDetailsTypedDict(TypedDict):
r"""Usage for server-side tool execution (e.g., web search)"""
tool_calls_executed: NotRequired[Nullable[int]]
r"""Number of OpenRouter server tool calls that executed and produced a result"""
tool_calls_requested: NotRequired[Nullable[int]]
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
web_search_requests: NotRequired[Nullable[int]]
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
class ServerToolUseDetails(BaseModel):
r"""Usage for server-side tool execution (e.g., web search)"""
tool_calls_executed: OptionalNullable[int] = UNSET
r"""Number of OpenRouter server tool calls that executed and produced a result"""
tool_calls_requested: OptionalNullable[int] = UNSET
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
web_search_requests: OptionalNullable[int] = UNSET
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"tool_calls_executed",
"tool_calls_requested",
"web_search_requests",
]
nullable_fields = [
"tool_calls_executed",
"tool_calls_requested",
"web_search_requests",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ChatUsageTypedDict(TypedDict):
r"""Token usage statistics"""
@@ -193,8 +131,6 @@ class ChatUsageTypedDict(TypedDict):
r"""Whether a request was made using a Bring Your Own Key configuration"""
prompt_tokens_details: NotRequired[Nullable[PromptTokensDetailsTypedDict]]
r"""Detailed prompt token usage"""
server_tool_use_details: NotRequired[Nullable[ServerToolUseDetailsTypedDict]]
r"""Usage for server-side tool execution (e.g., web search)"""
class ChatUsage(BaseModel):
@@ -224,9 +160,6 @@ class ChatUsage(BaseModel):
prompt_tokens_details: OptionalNullable[PromptTokensDetails] = UNSET
r"""Detailed prompt token usage"""
server_tool_use_details: OptionalNullable[ServerToolUseDetails] = UNSET
r"""Usage for server-side tool execution (e.g., web search)"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -235,14 +168,12 @@ class ChatUsage(BaseModel):
"cost_details",
"is_byok",
"prompt_tokens_details",
"server_tool_use_details",
]
nullable_fields = [
"completion_tokens_details",
"cost",
"cost_details",
"prompt_tokens_details",
"server_tool_use_details",
]
null_default_fields = []
@@ -1,95 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypedDict
UnifiedBenchmarksMetaSource = Union[
Literal[
"artificial-analysis",
"design-arena",
],
UnrecognizedStr,
]
r"""The source filter applied."""
UnifiedBenchmarksMetaVersion = Literal["v1",]
r"""Dataset version."""
class UnifiedBenchmarksMetaTypedDict(TypedDict):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: UnifiedBenchmarksMetaSource
r"""The source filter applied."""
source_url: str
r"""URL of the upstream data source."""
task_type: Nullable[str]
r"""The task_type filter applied, or null if showing all."""
version: UnifiedBenchmarksMetaVersion
r"""Dataset version."""
class UnifiedBenchmarksMeta(BaseModel):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: Annotated[
UnifiedBenchmarksMetaSource, PlainValidator(validate_open_enum(False))
]
r"""The source filter applied."""
source_url: str
r"""URL of the upstream data source."""
task_type: Nullable[str]
r"""The task_type filter applied, or null if showing all."""
version: UnifiedBenchmarksMetaVersion
r"""Dataset version."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["task_type"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,43 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .unifiedbenchmarksaaitem import (
UnifiedBenchmarksAAItem,
UnifiedBenchmarksAAItemTypedDict,
)
from .unifiedbenchmarksdaitem import (
UnifiedBenchmarksDAItem,
UnifiedBenchmarksDAItemTypedDict,
)
from .unifiedbenchmarksmeta import UnifiedBenchmarksMeta, UnifiedBenchmarksMetaTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import List, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict
DataTypedDict = TypeAliasType(
"DataTypedDict",
Union[UnifiedBenchmarksAAItemTypedDict, UnifiedBenchmarksDAItemTypedDict],
)
Data = Annotated[
Union[
Annotated[UnifiedBenchmarksAAItem, Tag("artificial-analysis")],
Annotated[UnifiedBenchmarksDAItem, Tag("design-arena")],
],
Discriminator(lambda m: get_discriminator(m, "source", "source")),
]
class UnifiedBenchmarksResponseTypedDict(TypedDict):
data: List[DataTypedDict]
meta: UnifiedBenchmarksMetaTypedDict
class UnifiedBenchmarksResponse(BaseModel):
data: List[Data]
meta: UnifiedBenchmarksMeta
+536
View File
@@ -426,6 +426,542 @@ class Datasets(BaseSDK):
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def get_benchmarks_artificial_analysis(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksAAResponse:
r"""Artificial Analysis Benchmark Indices
Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param max_results: Max results to return (1100, default 50).
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksArtificialAnalysisRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
max_results=max_results,
)
req = self._build_request(
method="GET",
path="/datasets/benchmarks/artificial-analysis",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksArtificialAnalysisGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksArtificialAnalysis",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksAAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def get_benchmarks_artificial_analysis_async(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksAAResponse:
r"""Artificial Analysis Benchmark Indices
Returns composite index scores (Intelligence, Coding, Agentic) from Artificial Analysis for LLM models. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param max_results: Max results to return (1100, default 50).
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksArtificialAnalysisRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
max_results=max_results,
)
req = self._build_request_async(
method="GET",
path="/datasets/benchmarks/artificial-analysis",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksArtificialAnalysisGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksArtificialAnalysis",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksAAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def get_benchmarks_design_arena(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
arena: Optional[operations.Arena] = "models",
category: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksDAResponse:
r"""Design Arena Benchmark Rankings
Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param arena: Arena to query. Defaults to `models`.
:param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
:param max_results: Max results to return: per category when no category filter is applied (1100, default 50).
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksDesignArenaRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
arena=arena,
category=category,
max_results=max_results,
)
req = self._build_request(
method="GET",
path="/datasets/benchmarks/design-arena",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksDesignArenaGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = self.do_request(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksDesignArena",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksDAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
async def get_benchmarks_design_arena_async(
self,
*,
http_referer: Optional[str] = None,
x_open_router_title: Optional[str] = None,
x_open_router_categories: Optional[str] = None,
arena: Optional[operations.Arena] = "models",
category: Optional[str] = None,
max_results: Optional[int] = 50,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
http_headers: Optional[Mapping[str, str]] = None,
) -> components.BenchmarksDAResponse:
r"""Design Arena Benchmark Rankings
Returns ELO ratings from head-to-head arena battles on Design Arena. Filterable by arena (models/builders/agents) and category. Includes OpenRouter pricing per model. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
:param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param arena: Arena to query. Defaults to `models`.
:param category: Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories.
:param max_results: Max results to return: per category when no category filter is applied (1100, default 50).
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
:param http_headers: Additional headers to set or replace on requests.
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
else:
base_url = self._get_url(base_url, url_variables)
request = operations.GetBenchmarksDesignArenaRequest(
http_referer=http_referer,
x_open_router_title=x_open_router_title,
x_open_router_categories=x_open_router_categories,
arena=arena,
category=category,
max_results=max_results,
)
req = self._build_request_async(
method="GET",
path="/datasets/benchmarks/design-arena",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
_globals=operations.GetBenchmarksDesignArenaGlobals(
http_referer=self.sdk_configuration.globals.http_referer,
x_open_router_title=self.sdk_configuration.globals.x_open_router_title,
x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories,
),
security=self.sdk_configuration.security,
allow_empty_value=None,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
else:
retries = utils.RetryConfig(
"backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True
)
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["5XX"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getBenchmarksDesignArena",
oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, components.Security
),
),
request=req,
error_status_codes=["400", "401", "429", "4XX", "500", "5XX"],
retry_config=retry_config,
)
response_data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return unmarshal_json_response(components.BenchmarksDAResponse, http_res)
if utils.match_response(http_res, "400", "application/json"):
response_data = unmarshal_json_response(
errors.BadRequestResponseErrorData, http_res
)
raise errors.BadRequestResponseError(response_data, http_res)
if utils.match_response(http_res, "401", "application/json"):
response_data = unmarshal_json_response(
errors.UnauthorizedResponseErrorData, http_res
)
raise errors.UnauthorizedResponseError(response_data, http_res)
if utils.match_response(http_res, "429", "application/json"):
response_data = unmarshal_json_response(
errors.TooManyRequestsResponseErrorData, http_res
)
raise errors.TooManyRequestsResponseError(response_data, http_res)
if utils.match_response(http_res, "500", "application/json"):
response_data = unmarshal_json_response(
errors.InternalServerResponseErrorData, http_res
)
raise errors.InternalServerResponseError(response_data, http_res)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
if utils.match_response(http_res, "5XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.OpenRouterDefaultError(
"API error occurred", http_res, http_res_text
)
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
def get_rankings_daily(
self,
*,
+28 -26
View File
@@ -81,8 +81,6 @@ if TYPE_CHECKING:
ContentText,
ContentTextTypedDict,
ContentTypedDict,
CostDetails,
CostDetailsTypedDict,
CreateEmbeddingsData,
CreateEmbeddingsDataTypedDict,
CreateEmbeddingsGlobals,
@@ -292,14 +290,18 @@ if TYPE_CHECKING:
GetAppRankingsSort,
Subcategory,
)
from .getbenchmarks import (
from .getbenchmarksartificialanalysis import (
GetBenchmarksArtificialAnalysisGlobals,
GetBenchmarksArtificialAnalysisGlobalsTypedDict,
GetBenchmarksArtificialAnalysisRequest,
GetBenchmarksArtificialAnalysisRequestTypedDict,
)
from .getbenchmarksdesignarena import (
Arena,
GetBenchmarksGlobals,
GetBenchmarksGlobalsTypedDict,
GetBenchmarksRequest,
GetBenchmarksRequestTypedDict,
Source,
TaskType,
GetBenchmarksDesignArenaGlobals,
GetBenchmarksDesignArenaGlobalsTypedDict,
GetBenchmarksDesignArenaRequest,
GetBenchmarksDesignArenaRequestTypedDict,
)
from .getbyokkey import (
GetBYOKKeyGlobals,
@@ -721,8 +723,6 @@ __all__ = [
"ContentText",
"ContentTextTypedDict",
"ContentTypedDict",
"CostDetails",
"CostDetailsTypedDict",
"CreateAudioSpeechGlobals",
"CreateAudioSpeechGlobalsTypedDict",
"CreateAudioSpeechRequest",
@@ -899,10 +899,14 @@ __all__ = [
"GetBYOKKeyGlobalsTypedDict",
"GetBYOKKeyRequest",
"GetBYOKKeyRequestTypedDict",
"GetBenchmarksGlobals",
"GetBenchmarksGlobalsTypedDict",
"GetBenchmarksRequest",
"GetBenchmarksRequestTypedDict",
"GetBenchmarksArtificialAnalysisGlobals",
"GetBenchmarksArtificialAnalysisGlobalsTypedDict",
"GetBenchmarksArtificialAnalysisRequest",
"GetBenchmarksArtificialAnalysisRequestTypedDict",
"GetBenchmarksDesignArenaGlobals",
"GetBenchmarksDesignArenaGlobalsTypedDict",
"GetBenchmarksDesignArenaRequest",
"GetBenchmarksDesignArenaRequestTypedDict",
"GetCreditsData",
"GetCreditsDataTypedDict",
"GetCreditsGlobals",
@@ -1159,9 +1163,7 @@ __all__ = [
"SendChatCompletionRequestRequestTypedDict",
"SendChatCompletionRequestResponse",
"SendChatCompletionRequestResponseTypedDict",
"Source",
"Subcategory",
"TaskType",
"TimeRange",
"TimeRangeTypedDict",
"TypeImageURL",
@@ -1267,8 +1269,6 @@ _dynamic_imports: dict[str, str] = {
"ContentText": ".createembeddings",
"ContentTextTypedDict": ".createembeddings",
"ContentTypedDict": ".createembeddings",
"CostDetails": ".createembeddings",
"CostDetailsTypedDict": ".createembeddings",
"CreateEmbeddingsData": ".createembeddings",
"CreateEmbeddingsDataTypedDict": ".createembeddings",
"CreateEmbeddingsGlobals": ".createembeddings",
@@ -1435,13 +1435,15 @@ _dynamic_imports: dict[str, str] = {
"GetAppRankingsResponseTypedDict": ".getapprankings",
"GetAppRankingsSort": ".getapprankings",
"Subcategory": ".getapprankings",
"Arena": ".getbenchmarks",
"GetBenchmarksGlobals": ".getbenchmarks",
"GetBenchmarksGlobalsTypedDict": ".getbenchmarks",
"GetBenchmarksRequest": ".getbenchmarks",
"GetBenchmarksRequestTypedDict": ".getbenchmarks",
"Source": ".getbenchmarks",
"TaskType": ".getbenchmarks",
"GetBenchmarksArtificialAnalysisGlobals": ".getbenchmarksartificialanalysis",
"GetBenchmarksArtificialAnalysisGlobalsTypedDict": ".getbenchmarksartificialanalysis",
"GetBenchmarksArtificialAnalysisRequest": ".getbenchmarksartificialanalysis",
"GetBenchmarksArtificialAnalysisRequestTypedDict": ".getbenchmarksartificialanalysis",
"Arena": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaGlobals": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaGlobalsTypedDict": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaRequest": ".getbenchmarksdesignarena",
"GetBenchmarksDesignArenaRequestTypedDict": ".getbenchmarksdesignarena",
"GetBYOKKeyGlobals": ".getbyokkey",
"GetBYOKKeyGlobalsTypedDict": ".getbyokkey",
"GetBYOKKeyRequest": ".getbyokkey",
@@ -344,54 +344,6 @@ class CreateEmbeddingsData(BaseModel):
Object = Literal["list",]
class CostDetailsTypedDict(TypedDict):
r"""Breakdown of upstream inference costs"""
upstream_inference_completions_cost: float
upstream_inference_prompt_cost: float
upstream_inference_cost: NotRequired[Nullable[float]]
class CostDetails(BaseModel):
r"""Breakdown of upstream inference costs"""
upstream_inference_completions_cost: float
upstream_inference_prompt_cost: float
upstream_inference_cost: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["upstream_inference_cost"]
nullable_fields = ["upstream_inference_cost"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class PromptTokensDetailsTypedDict(TypedDict):
r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included."""
@@ -435,10 +387,6 @@ class CreateEmbeddingsUsageTypedDict(TypedDict):
r"""Total number of tokens used"""
cost: NotRequired[float]
r"""Cost of the request in credits"""
cost_details: NotRequired[Nullable[CostDetailsTypedDict]]
r"""Breakdown of upstream inference costs"""
is_byok: NotRequired[bool]
r"""Whether a request was made using a Bring Your Own Key configuration"""
prompt_tokens_details: NotRequired[PromptTokensDetailsTypedDict]
r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included."""
@@ -455,45 +403,9 @@ class CreateEmbeddingsUsage(BaseModel):
cost: Optional[float] = None
r"""Cost of the request in credits"""
cost_details: OptionalNullable[CostDetails] = UNSET
r"""Breakdown of upstream inference costs"""
is_byok: Optional[bool] = None
r"""Whether a request was made using a Bring Your Own Key configuration"""
prompt_tokens_details: Optional[PromptTokensDetails] = None
r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["cost", "cost_details", "is_byok", "prompt_tokens_details"]
nullable_fields = ["cost_details"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
r"""Embeddings response containing embedding vectors"""
@@ -0,0 +1,108 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class GetBenchmarksArtificialAnalysisGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetBenchmarksArtificialAnalysisGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetBenchmarksArtificialAnalysisRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
max_results: NotRequired[int]
r"""Max results to return (1100, default 50)."""
class GetBenchmarksArtificialAnalysisRequest(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
max_results: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = 50
r"""Max results to return (1100, default 50)."""
@@ -14,7 +14,7 @@ from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class GetBenchmarksGlobalsTypedDict(TypedDict):
class GetBenchmarksDesignArenaGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
@@ -30,7 +30,7 @@ class GetBenchmarksGlobalsTypedDict(TypedDict):
"""
class GetBenchmarksGlobals(BaseModel):
class GetBenchmarksDesignArenaGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
@@ -60,27 +60,6 @@ class GetBenchmarksGlobals(BaseModel):
"""
Source = Union[
Literal[
"artificial-analysis",
"design-arena",
],
UnrecognizedStr,
]
r"""Benchmark source to query. Determines the shape of the returned items."""
TaskType = Union[
Literal[
"coding",
"intelligence",
"agentic",
],
UnrecognizedStr,
]
r"""Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category."""
Arena = Union[
Literal[
"models",
@@ -89,12 +68,10 @@ Arena = Union[
],
UnrecognizedStr,
]
r"""Design Arena only: arena to query. Defaults to `models` when source is `design-arena`."""
r"""Arena to query. Defaults to `models`."""
class GetBenchmarksRequestTypedDict(TypedDict):
source: Source
r"""Benchmark source to query. Determines the shape of the returned items."""
class GetBenchmarksDesignArenaRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
@@ -108,23 +85,15 @@ class GetBenchmarksRequestTypedDict(TypedDict):
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
task_type: NotRequired[TaskType]
r"""Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category."""
arena: NotRequired[Arena]
r"""Design Arena only: arena to query. Defaults to `models` when source is `design-arena`."""
r"""Arena to query. Defaults to `models`."""
category: NotRequired[str]
r"""Design Arena only: category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
max_results: NotRequired[int]
r"""Max results to return (1100, default 50)."""
r"""Max results to return: per category when no category filter is applied (1100, default 50)."""
class GetBenchmarksRequest(BaseModel):
source: Annotated[
Annotated[Source, PlainValidator(validate_open_enum(False))],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
]
r"""Benchmark source to query. Determines the shape of the returned items."""
class GetBenchmarksDesignArenaRequest(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
@@ -153,26 +122,20 @@ class GetBenchmarksRequest(BaseModel):
"""
task_type: Annotated[
Annotated[Optional[TaskType], PlainValidator(validate_open_enum(False))],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Filter results by task type. For Artificial Analysis, maps to the corresponding index. For Design Arena, maps to the matching category."""
arena: Annotated[
Annotated[Optional[Arena], PlainValidator(validate_open_enum(False))],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Design Arena only: arena to query. Defaults to `models` when source is `design-arena`."""
] = "models"
r"""Arena to query. Defaults to `models`."""
category: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Design Arena only: category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
r"""Category within the arena (e.g. `codecategories`, `uicomponent`, `gamedev`, `3d`, `dataviz`, `image`, `video`, `svg`). When omitted, returns all categories."""
max_results: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = 50
r"""Max results to return (1100, default 50)."""
r"""Max results to return: per category when no category filter is applied (1100, default 50)."""
-4
View File
@@ -18,7 +18,6 @@ import weakref
if TYPE_CHECKING:
from openrouter.analytics import Analytics
from openrouter.api_keys import APIKeys
from openrouter.benchmarks import Benchmarks
from openrouter.beta import Beta
from openrouter.byok import Byok
from openrouter.chat import Chat
@@ -56,8 +55,6 @@ class OpenRouter(BaseSDK):
r"""Speech-to-text endpoints"""
o_auth: "OAuth"
r"""OAuth authentication endpoints"""
benchmarks: "Benchmarks"
r"""Benchmarks endpoints"""
byok: "Byok"
r"""BYOK endpoints"""
chat: "Chat"
@@ -99,7 +96,6 @@ class OpenRouter(BaseSDK):
"tts": ("openrouter.tts", "Tts"),
"stt": ("openrouter.stt", "Stt"),
"o_auth": ("openrouter.oauth", "OAuth"),
"benchmarks": ("openrouter.benchmarks", "Benchmarks"),
"byok": ("openrouter.byok", "Byok"),
"chat": ("openrouter.chat", "Chat"),
"credits": ("openrouter.credits", "Credits"),