diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index f1e4cb50..739339a0 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 802f771745200ec789ec40b84cde6c16 + docChecksum: 680fc6fa04d244928916183cf36d5375 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.3.7 - configChecksum: 4f3beb0365ac0e410ce9346ead2bc186 + releaseVersion: 1.3.8 + configChecksum: 671c5e534a8a5271fcb53f7930e22139 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: a76b44ea-974e-4345-a9c0-a0cb4de6b2c6 - pristine_commit_hash: 10e7143eb49447f9ba97d237e81cbfa63e99c955 - pristine_tree_hash: 2755b9e7af9258a5a5ace0e1ac9b760849618af2 + generation_id: 31c71c6c-4d49-4241-9e02-97d6720b2375 + pristine_commit_hash: f0c232d4899ee30970fea7b63c5703c1846c3eeb + pristine_tree_hash: 5a65cbde2272cd0b98ca14cc72cd0ce7fcf22a2c features: python: acceptHeaders: 3.0.0 @@ -1574,6 +1574,10 @@ trackedFiles: id: ba68e75edfab last_write_checksum: sha1:403af1a9a0e45871f7ce46d9c0c35e5bfc469bd2 pristine_git_object: 8dd2b456e53244a5eaf7e3e957b00840f6fd9601 + docs/components/byok.mdx: + id: 315668e315f4 + last_write_checksum: sha1:493598c1e615084e02c892afec6b6f912cded8a7 + pristine_git_object: ab64c8c0210948fce5ca2c155f3b535158aa59b0 docs/components/byokkey.mdx: id: f67303c7207c last_write_checksum: sha1:fe8cc7b80b0b01c07683163c02ac1c8f7ad36d47 @@ -2558,10 +2562,6 @@ trackedFiles: id: c29a8011151c last_write_checksum: sha1:e4f8c70da5562a17752390debc0d3540c594d2b9 pristine_git_object: 307b625ad02378014bcaa5be4c21e32708edf9cc - docs/components/dataregion.mdx: - id: dac6201df667 - last_write_checksum: sha1:5e1116ce3f6d51afbe53c7e9d603e691ce0284d6 - pristine_git_object: a02dd93656eaf63ff8fbd7052d45807490896b2a docs/components/datetimeservertool.mdx: id: 709ed5cdd4da last_write_checksum: sha1:2920ba9d11c4c1600dfdd4293442407b4482cc0f @@ -3240,8 +3240,12 @@ trackedFiles: pristine_git_object: b876dce8ca019098465106bf05b11c5e0b9536f0 docs/components/generationresponsedata.mdx: id: 5c92bc415596 - last_write_checksum: sha1:bfd323dcacd9548a6fa16ff15a1d5def429fbf71 - pristine_git_object: d8beea524e93ab8059a7eca00b12316e681252da + last_write_checksum: sha1:db8eda900c4086286abef96719bd5a0c5ed49920 + pristine_git_object: bf175271cdb05d90514c5859ffbd57b077104af8 + docs/components/generationresponsedataregion.mdx: + id: 7c78bc2a4522 + last_write_checksum: sha1:743f7db7a6249896ec86d3bae131e7dc34a1e13b + pristine_git_object: 780b8f17488040e3a5fda077e100ad88dd91380f docs/components/getbyokkeyresponse.mdx: id: 451f36940fbd last_write_checksum: sha1:eb48f4135b67e3098078260259b9077ede26578c @@ -3270,6 +3274,10 @@ trackedFiles: id: b6ce94617601 last_write_checksum: sha1:4f7f13820a8f5d4da47e82136568c39d684a0d71 pristine_git_object: e671eabcbd7f603a2b687276bca29de1b9ac235d + docs/components/gettoolresponse.mdx: + id: 68c5d7719463 + last_write_checksum: sha1:bbf29c0ab25063cfdee4b431ac6f596ca7ca2bff + pristine_git_object: 50b8d7f4b993b7be7a139ee561e9f79042d45725 docs/components/getworkspacebudgetresponse.mdx: id: 9a7d2b80e512 last_write_checksum: sha1:a299ce75f8736a4d572a06a48e54e00854a63f0b @@ -4018,10 +4026,6 @@ trackedFiles: id: 241b46c3af41 last_write_checksum: sha1:87f6ccd952555f98fa58ea6231cb5e02dea633ba pristine_git_object: 84e5be99fde18ac05e85c2ec21e97204be5957c4 - docs/components/links.mdx: - id: 70a0fc77c7ab - last_write_checksum: sha1:67b732d632e9dee1437f8de51c8160568a3a5ac5 - pristine_git_object: 6debf47da9bcab18bf9b0387b70decb269dead18 docs/components/listbyokkeysresponse.mdx: id: be41921e1cce last_write_checksum: sha1:cc039aaf6927478fd3d3db9eb6a1f84c51e9caa4 @@ -4066,6 +4070,14 @@ trackedFiles: id: b7b20d46cf95 last_write_checksum: sha1:fbdf5e1ed9651ac69b03e6b07d2f061480c15f0d pristine_git_object: 6c0e6c816c9cc4a625f1d341773ede7888ea5a4d + docs/components/listtoolsresponse.mdx: + id: 51bafdfebe6d + last_write_checksum: sha1:0a483da6adcda8d547c0a3789397f31e5136e389 + pristine_git_object: c62bef38ec48b7200e53bfc351e1347a5818d366 + docs/components/listtoolsresponselinks.mdx: + id: ba9a9081bda7 + last_write_checksum: sha1:50544758a31a85e95931ce6e68d7447be8d39b66 + pristine_git_object: fe7710735a1c5d3f1fa0fbbd9afc8ac6eb47f316 docs/components/listworkspacebudgetsresponse.mdx: id: be60b3aa222d last_write_checksum: sha1:69367bef2e3cfa9073fa41794a9af4a3344f16ee @@ -4488,8 +4500,12 @@ trackedFiles: pristine_git_object: 9e1b9145d0352d47192a8427975702517923ef66 docs/components/modelslistresponse.mdx: id: 1880eae9f45e - last_write_checksum: sha1:37dc51e0d818c3561d0b7094cf6ab9e2cf44167d - pristine_git_object: ac531b92ce061a5062aa91aeac7ce68242c35fcf + last_write_checksum: sha1:da6ddcb5fd872eb373acef259190077b018c3c65 + pristine_git_object: 505a1c0736b6e6a04153f85a38ec408670aa49b7 + docs/components/modelslistresponselinks.mdx: + id: da69c5c95166 + last_write_checksum: sha1:9b63cb20f8d9a0231955bbfca9d1212273f3e833 + pristine_git_object: 4c3a5021318905acba956cfbf74065ac463de77b docs/components/moderation.mdx: id: d145b88b8b67 last_write_checksum: sha1:ed7cedc44d3043ef40007d3135774d168b30683d @@ -4550,6 +4566,10 @@ trackedFiles: id: fb5e85bb77da last_write_checksum: sha1:50190d6fb52c7d673ef87f34e39c620460cf932b pristine_git_object: f6803b05fdd0332c58b0d07e2aa819de4a8087c5 + docs/components/nativesupport.mdx: + id: ec3bab117cd9 + last_write_checksum: sha1:3b4d138d8d3c417acd6a724f5029b3365033656b + pristine_git_object: a45fc5f1210c046f6a3f080fec92310e2ebaf6fe docs/components/nativetools.mdx: id: 15bb54542fc2 last_write_checksum: sha1:0b6d30bcbc44a2914c2d7265e5fb1e8cd05f6c89 @@ -5778,6 +5798,10 @@ trackedFiles: id: 74675f38c1c6 last_write_checksum: sha1:eeb486b65e66a55269aeafcc60f310501a98dbd6 pristine_git_object: b7d539e20f7337822a45f726f451fac321f875f6 + docs/components/pricingsource.mdx: + id: 280f12cf1171 + last_write_checksum: sha1:b33bf671a24f15ec15ccd0ee843c6cbf6607117d + pristine_git_object: 2a33f9c0274fbeb2cbd61b691c384e9e8efcd0d5 docs/components/primarymetric.mdx: id: c6ec097bacaf last_write_checksum: sha1:fc7d89ac02ff585424b5bc8cc9b0ac82338c7b6f @@ -6310,6 +6334,70 @@ trackedFiles: id: 126e702b7c97 last_write_checksum: sha1:3fbb5c3145b96472437de6e6384ae222b0ae5210 pristine_git_object: 185abbfd59b8369f9e7475ab4cd7acdfc58962a3 + docs/components/servertool.mdx: + id: 4faa55488ef4 + last_write_checksum: sha1:d7095487baa7be99256568e23fbb3b270ae38795 + pristine_git_object: 8f8f0d4e9f6b8834d090f49d4260fb8cb0d3a471 + docs/components/servertooldetails.mdx: + id: 453049b652fc + last_write_checksum: sha1:7138c34f9f47f1bf24aa5305f34f7ca5092cc0fa + pristine_git_object: 2ec8bf7ad9b33fff8503f5c7e3065448be37b154 + docs/components/servertooldetailsstatus.mdx: + id: f5323566fa91 + last_write_checksum: sha1:d534dcc47af105b735ff6b2f8ceeffc11340bbc5 + pristine_git_object: 576d28fdf06c7192e5cbb71184d5c7a79878f9c1 + docs/components/servertooldetailssupportedapiformat.mdx: + id: d9213b5a3c75 + last_write_checksum: sha1:a77b33cdc959e3199c187913f5c741efbcbf1ab8 + pristine_git_object: 16944784585692bcfd9de5aa1aa65c166eed8c47 + docs/components/servertoolengine.mdx: + id: 66b26e1d6cc9 + last_write_checksum: sha1:e3a02bac502d3ffef3fe320a002bdf005d9cad13 + pristine_git_object: 65e059679c867c8c0ced1df3567f79eeb5635420 + docs/components/servertoolenginedataregion.mdx: + id: 1481257cbf2a + last_write_checksum: sha1:537420a33052594863d73672d464785480fb3990 + pristine_git_object: eb983c6ab087b02ffcd1c6088acce268e6ddd4b5 + docs/components/servertoolexecutedby.mdx: + id: fdc7c2498109 + last_write_checksum: sha1:9e9abd3fc156b540074751d7d6eec5dd01bec24d + pristine_git_object: 9d1711b938a91057a4e31a10c411a0812bb5fd71 + docs/components/servertoolinputname.mdx: + id: 93279a0859d2 + last_write_checksum: sha1:3e068e785bb198f12e1974b48cf8a65a91385bfa + pristine_git_object: 24c1351281e20065c208fd560223387a8a693c0a + docs/components/servertoolinputnameapiformat.mdx: + id: 93b065af4932 + last_write_checksum: sha1:74ea144883369725b3220260db6b60367858da82 + pristine_git_object: cce7c33332ed6d9c5befd5987bd929df0f67d25b + docs/components/servertoolnativemodel.mdx: + id: 2615ee8c7b8c + last_write_checksum: sha1:aa5f25d9d34b73353baed3e3a2da9a2ee412f046 + pristine_git_object: 5cd668a0862f70adc460fbe9fa70d449feb0fd99 + docs/components/servertoolnativesupport.mdx: + id: 3832b1000963 + last_write_checksum: sha1:1f39260e6cbce2a3ca734f4e2550e241a849d82a + pristine_git_object: b746ac366dee33c571972eb3fe8ea90c03509b9e + docs/components/servertooloutputname.mdx: + id: c024c36be548 + last_write_checksum: sha1:66aa13bc282dce389d74064568785ccf23fbc2d3 + pristine_git_object: 1d29864ad6096867ce92b272d82086f9f2918cc5 + docs/components/servertooloutputnameapiformat.mdx: + id: eba69a346650 + last_write_checksum: sha1:c2ae18660fec3c2327070ea7bb57064807df56d8 + pristine_git_object: 9a7ecb1b72770936140de70d4a0afc29ce79068d + docs/components/servertoolprice.mdx: + id: a23aba1add8e + last_write_checksum: sha1:982f26aecbbcf07218d9a9595658855eac095197 + pristine_git_object: 78fe83c076598b0df3caf435042befd1c29ec8b1 + docs/components/servertoolstatus.mdx: + id: 5cbadeb5e875 + last_write_checksum: sha1:a2f16550b38cdf799680ec30415e3a987b1ea2eb + pristine_git_object: 524b8ce261ac306f66bedab26335a555b6450e87 + docs/components/servertoolsupportedapiformat.mdx: + id: 2c8060fac991 + last_write_checksum: sha1:80684c46187ad6c6b58f19946b2ff32024c6c93f + pristine_git_object: 2d16959325937dbbe2dc39aca6988afb57909b75 docs/components/servertoolusedetails.mdx: id: 5a7d75562dec last_write_checksum: sha1:c2a156aba0f34118e3c681561f817d8deb4a06ac @@ -7630,6 +7718,10 @@ trackedFiles: id: 9bb0791d7b23 last_write_checksum: sha1:74f92842ef5b92abfdbe951f754b240f83673194 pristine_git_object: 098bd77e93814e8a3c888b3d20e5a2f9890dd7a5 + docs/operations/apiformat.mdx: + id: d047a1744214 + last_write_checksum: sha1:ba678b3021e3f9de6d60629b1e8afc7db870c8ea + pristine_git_object: 024ea3a4ef0592aa95ee61184e29914afd30fb4d docs/operations/arena.mdx: id: fd0c961ea26d last_write_checksum: sha1:48d0112803ed464cb9f9fe06d4b58f982f936522 @@ -8514,6 +8606,22 @@ trackedFiles: id: b4c12a5cf637 last_write_checksum: sha1:7f91cb78496179abe81547ed00168e0f0fc15a68 pristine_git_object: acb6b4834361e285dfb35c137f2aef8d551c59dd + docs/operations/gettoolglobals.mdx: + id: e88fdfb11e03 + last_write_checksum: sha1:178ecc33d0a7c0054c7568173995337f0be256cf + pristine_git_object: 2babeb71b2bd369294be836242118b3b0617171f + docs/operations/gettoolrequest.mdx: + id: a97513cc3131 + last_write_checksum: sha1:c6109e026955c20e34981ed2e24dee12ddb9e47c + pristine_git_object: 0d357688acc4d82af523b57aff86b01a5b768eaa + docs/operations/gettoolresponse.mdx: + id: 427560128f57 + last_write_checksum: sha1:b7c5852c00c32c5c338526bb69a2ae95d8a7a0f3 + pristine_git_object: ebca60fe778757523c63a25cb70707ddcc7242f5 + docs/operations/gettoolsecurity.mdx: + id: f3248505cd23 + last_write_checksum: sha1:903aee11579581e9b675cd6fdad78b6eb394afd9 + pristine_git_object: 84b78828d42f3dbedc296a418af98d2a5c947d83 docs/operations/getuseractivityglobals.mdx: id: 9cbf7459a650 last_write_checksum: sha1:26d89a9bb9563265b796d096d7d2ddf892019244 @@ -8938,6 +9046,18 @@ trackedFiles: id: b763a3eaa70b last_write_checksum: sha1:2421768f7c35319a79083c02017056bd40f21c4e pristine_git_object: 80f9a41f5527839636e8a51814d420a22a28a82f + docs/operations/listtoolsglobals.mdx: + id: a03447166c23 + last_write_checksum: sha1:90dc9f06c1eb65a456d76bb1b4c7b08906313f54 + pristine_git_object: 39d3d2c10526946fbc5d0876b727e23c8df87b86 + docs/operations/listtoolsrequest.mdx: + id: 320a553315bd + last_write_checksum: sha1:36a48744c4ac043c9083ab2b6a9acce4a32ecac9 + pristine_git_object: 4a996545da0089b8a68405a09890841ab42267f1 + docs/operations/listtoolssecurity.mdx: + id: 4f45e0e45460 + last_write_checksum: sha1:4f8940a74a9ca249673f29615c0c18dc7e328f08 + pristine_git_object: 92fe7946ee9a4867538563b5569c0ef6a3b2aea1 docs/operations/listvaultsecretsglobals.mdx: id: 9f2a43038606 last_write_checksum: sha1:b06f69a57d6f67af8a67f67baa105a16953c1b99 @@ -9458,6 +9578,10 @@ trackedFiles: id: 55c317c71f3d last_write_checksum: sha1:b1ad82361fe1dbef6bedeead3783c75ec36283b6 pristine_git_object: fc7688ebea8e973bebc0525a820ba246b6491f81 + docs/sdks/tools/README.mdx: + id: 32d2a83beeba + last_write_checksum: sha1:bc4af37f429416ebbd32955c2b75876a8ff65835 + pristine_git_object: 1dd30f0b898f2a842d1bb585b03d887be90e7845 docs/sdks/tts/README.mdx: id: cd1132543884 last_write_checksum: sha1:5a8e24e62e0b41a781f38f22eed4369e4feaa960 @@ -9480,8 +9604,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:ffbd5d5d3a1a3aaa413ae93da4d950ab87dd6f20 - pristine_git_object: 953dedaac785f704a55815a976a56ea2d0542c57 + last_write_checksum: sha1:55b8a867c83337403926d0dc4e6b7703e27643e7 + pristine_git_object: 19e9bba5fe3c16b66c532e0642bc02b4f5f22162 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -9508,8 +9632,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:c4880ef34499c45e2dc27fde44c9b19cc342197f - pristine_git_object: 0f901af47cee90907a21b2f6b0f0c75fd3104d39 + last_write_checksum: sha1:10ba7c290d3a47f157806e1176264976787e2067 + pristine_git_object: e4352c0c9174ee9721f412b062c40c37feecb3ad src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:30f55a360f41376ab194b9ea725fe4e001a5ae1a @@ -9556,8 +9680,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:031f8a9dc89c46b53f83b4848cc479232b2fc07e - pristine_git_object: d95413f20103ac38ac4c5bd6c304f29507b28d83 + last_write_checksum: sha1:8f4e4ddc9dea6509bb8b11ab04ab7a660bce0854 + pristine_git_object: c7b4addcc99cd642f00b63fb3d3b3017e4da5635 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -10912,8 +11036,8 @@ trackedFiles: pristine_git_object: 5caeacf169f3edff5b6e9823264aeeff8be1e8ff src/openrouter/components/generationresponse.py: id: 84d4e3e7da8b - last_write_checksum: sha1:08ca137ea6dce62a09e0eb8d16f0821cee769a66 - pristine_git_object: f09bb92b8ae24346009107a3b14a7f826645ec1f + last_write_checksum: sha1:59154d0011d5bfee6a874ac7a66cbccd6eed1ec8 + pristine_git_object: ac86c1281db121fac5adb0f87317b02aaa1bf15b src/openrouter/components/getbyokkeyresponse.py: id: ca3a8db80018 last_write_checksum: sha1:9b428028a01ffb73915a278096ca51bd1c660326 @@ -10942,6 +11066,10 @@ trackedFiles: id: 3e8fd58a9e6f last_write_checksum: sha1:e229017fe78fa9f455bf9e80022d8d24a2b502da pristine_git_object: 0512c0e4de62d22081a4037985574191297dee30 + src/openrouter/components/gettoolresponse.py: + id: 0c114086dd8b + last_write_checksum: sha1:07c2883d6b7095501e6f47bc16271a8dddf7ccad + pristine_git_object: c49ee33c269cc1b45ead89726ab12d575c280bf5 src/openrouter/components/getworkspacebudgetresponse.py: id: 5ae557de0b72 last_write_checksum: sha1:49ee6ebadd481997bf9285d709847e5db8c0911c @@ -11310,6 +11438,10 @@ trackedFiles: id: 7c20d71efb80 last_write_checksum: sha1:1a8318984c6789d39fcfb26950003decd43e8671 pristine_git_object: 8eedc46ae432ebaf1dcf40a15a918456c801f836 + src/openrouter/components/listtoolsresponse.py: + id: 55d1f4305b3a + last_write_checksum: sha1:688d9f42382bb250f0e49449bd1437deca731ada + pristine_git_object: 43da08d3b42144a1cd0035f1443bf3d6c31c01e2 src/openrouter/components/listworkspacebudgetsresponse.py: id: 64fa8723acb0 last_write_checksum: sha1:7a1c0108d9d1f53c17f339c40b012e9472089fb8 @@ -11460,8 +11592,8 @@ trackedFiles: pristine_git_object: 8d68ee4aa093ba2754a65f28e46a23a1848fd99b src/openrouter/components/modelslistresponse.py: id: c2d4bb2cac89 - last_write_checksum: sha1:54461c815f518a71ba9f9b5a00ffad57c2d62c20 - pristine_git_object: a1cd85a3ba7fbb5c4b28936c5a3d0a70ca87aa38 + last_write_checksum: sha1:7aed32b04707f657a8e09d6897efeb9e8800d21c + pristine_git_object: c767f01a74dfd6bee9f6fdeab9c7c7ce26bea6a4 src/openrouter/components/moderationplugin.py: id: d99bd9d505d3 last_write_checksum: sha1:58ff3e6829b973b3db5ed7dda3fa11558ded04b2 @@ -12206,6 +12338,42 @@ trackedFiles: id: ae2ca334218a last_write_checksum: sha1:4f739c60ede675286c18e898f4cc9505480897a4 pristine_git_object: fce3d0742de43f714ec40da747e6dcf7ff5e4075 + src/openrouter/components/servertool.py: + id: 394a2a899d07 + last_write_checksum: sha1:609d5e0097b3509db54b4a8a47ed3f9e50327558 + pristine_git_object: 984f771a7b58264dc12c65994201439aec265eeb + src/openrouter/components/servertooldetails.py: + id: 66cffbacb75e + last_write_checksum: sha1:75eefff5e8b635d02dbbe1f5044ac3f17e774e48 + pristine_git_object: 73e0ad82e2efb02e89bcd9dcb60c303aba9456f7 + src/openrouter/components/servertoolengine.py: + id: ca09e0cebabb + last_write_checksum: sha1:74e6352bca6d05df3cfc086b4149ffc90a0a4b01 + pristine_git_object: e7aba2f41b3ef295005bf521d496a2cd27a2b4c5 + src/openrouter/components/servertoolexecutedby.py: + id: 56f7c8e060ce + last_write_checksum: sha1:9a8553192ea08c4ff408bb1d3f4776667935a883 + pristine_git_object: 941c90109b5611ce524a6d04f4619c1943b962c0 + src/openrouter/components/servertoolinputname.py: + id: 3cd99531edf1 + last_write_checksum: sha1:decfd06b4436e504997d994cc91d243658aa07b3 + pristine_git_object: 8024b62336f11c25f8fa35b0eeaa600799bb4c1d + src/openrouter/components/servertoolnativemodel.py: + id: b5bfcc6f6d2e + last_write_checksum: sha1:65951e538d4a8b98e4b56a6369205fea7c884021 + pristine_git_object: 8260ac3e5ecf0ab18ba5b8f54da95d0062da334d + src/openrouter/components/servertoolnativesupport.py: + id: 147e49ad46ee + last_write_checksum: sha1:42f4b950adc287979e73dcfc2092771c82e1008c + pristine_git_object: 32145d1d2e2196ade44de004bbd7d8adc836dd55 + src/openrouter/components/servertooloutputname.py: + id: b65201031bc9 + last_write_checksum: sha1:fa40a4da62984dd489d5fecee85fa7f81f8c6d6b + pristine_git_object: bbcec6255641d414f5b660e258390d70da1cffea + src/openrouter/components/servertoolprice.py: + id: 0c6c311bf349 + last_write_checksum: sha1:3c16001ca60d1069dcaab6c404bc30a2cab99ba7 + pristine_git_object: 2c93ff0d7677dcb1295601d5cc7c320582d3f284 src/openrouter/components/servertoolusedetails.py: id: b681965db7f8 last_write_checksum: sha1:071f2fee04f80ccff9139c7909b4e3ed331fdb0c @@ -12944,8 +13112,8 @@ trackedFiles: pristine_git_object: 8680343bbc90107ae6413bd5686012b1fd75d665 src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:9c8d909d254649414cbc38ac980ce571f4522fa7 - pristine_git_object: 021994be6f7184f84b27c360adb3c056d4107d0e + last_write_checksum: sha1:9214c0287f7eb88eee096235ebe428439c308f51 + pristine_git_object: ee19e0cac6af2d20d360c529b6786531ab10b239 src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -13258,6 +13426,10 @@ trackedFiles: id: ba6156d68acf last_write_checksum: sha1:c569572d21aa766ac542d5c535208e8b1caae503 pristine_git_object: a8b610cad3ca3792798e40b31cada48b0ed3845b + src/openrouter/operations/gettool.py: + id: f0997d66f38e + last_write_checksum: sha1:f3e11b59741e20041a219c423c1392fc69a2a7f1 + pristine_git_object: 1e0725f81674559cbf5f017c0dde04e0a36ba727 src/openrouter/operations/getuseractivity.py: id: 560a0e01c2c3 last_write_checksum: sha1:5de9ab321a939fe40adb6626721fd327890f2850 @@ -13398,6 +13570,10 @@ trackedFiles: id: 9f32309bb157 last_write_checksum: sha1:2319b023e5e8bd308df04a66e535edc2ffaa289d pristine_git_object: ac0de5426e797ff26d835fd88c0a4d7cb86844d3 + src/openrouter/operations/listtools.py: + id: e8a478b7266e + last_write_checksum: sha1:6170d2c5211602d778c9bca2a9f637ef240b13cc + pristine_git_object: 2a66b9d148bd036b60b8a6ecf54b56329b1d35b6 src/openrouter/operations/listvaultsecrets.py: id: 460dacce49ab last_write_checksum: sha1:c6fcb7a5e7f2f587888a3b087142a2c4c1f23cf9 @@ -13536,8 +13712,8 @@ trackedFiles: pristine_git_object: a28df9a26e2dd834e5bc8974c3a61d18609c79c0 src/openrouter/sdk.py: id: ee9846c4c9c5 - last_write_checksum: sha1:95b32fe060d0c2c11f136411102992b4b0220652 - pristine_git_object: 78cbf5d32cbf0e22a7786aa17a92b3218135ebb4 + last_write_checksum: sha1:61f29c3c30502f852822fa16b2d16d1a778273df + pristine_git_object: 0a110f2cdff3e7c31e971721166593cc792bc424 src/openrouter/sdkconfiguration.py: id: 55773bb98d7c last_write_checksum: sha1:c01826125c31a8b8bc99d9d679782c8758fae001 @@ -13550,6 +13726,10 @@ trackedFiles: id: 7e0a0e237bb1 last_write_checksum: sha1:fffd7413e70f4840b793888763631b51929eb766 pristine_git_object: aac5cbef3468a6b9c9fe04c3bd6c86e23de4b4e9 + src/openrouter/tools.py: + id: acb8a24e2c5b + last_write_checksum: sha1:7a06c5fa2d5b142bf137818db076c01e3c177e18 + pristine_git_object: 701fa8597ff85f41a60736ade55fcb32f9ec7125 src/openrouter/tts.py: id: 5055d4b95f1d last_write_checksum: sha1:505003b62781347ac707761c8d082f3b2738025d @@ -17405,5 +17585,41 @@ examples: responses: "504": application/json: {"error": {"code": 504, "message": "Vault request timed out"}} + listTools: + speakeasy-default-list-tools: + parameters: + query: + offset: 0 + limit: 50 + responses: + "200": + application/json: {"data": [], "links": {"next": null}, "total_count": 12} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getTool: + speakeasy-default-get-tool: + parameters: + path: + name: "openrouter:web_search" + responses: + "200": + application/json: {"data": {"aliases": [], "default_engine": "native", "docs_url": "https://mad-skyline.info/", "engines": [{"byok": "none", "data_regions": ["global", "us"], "default_mode": "auto", "executed_by": "openrouter", "id": "exa", "name": "Exa", "pricing": [], "pricing_doc_url": null, "pricing_source": "openrouter"}], "fallback_engine": "exa", "id": "openrouter:web_search", "input_schema": {"properties": {}, "type": "object"}, "name": "Web search", "native_support": {"endpoint_count": 18, "model_count": 12, "models": []}, "output_schema": {"properties": {}, "type": "object"}, "parameters_schema": {"properties": {}, "type": "object"}, "status": "active", "summary": "", "supported_api_formats": [], "tool_description": ""}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request.service_tier.enum(ultrafast)` **Added**\n* `open_router.generations.get_generation()`: `response.data.provider_responses[].routed_service_tier.enum(ultrafast)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.service_tier.enum(ultrafast)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.service_tier.enum(ultrafast)` **Added**\n* `open_router.responses.send()`: \n * `request.service_tier.enum(ultrafast)` **Added**\n* `open_router.beta.responses.send()`: \n * `request.service_tier.enum(ultrafast)` **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.tools.list_tools()`: **Added** + * `open_router.tools.get_tool()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 90199269..6551bbd8 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.7 + version: 1.3.8 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 7079a9aa..3bf98d49 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -12449,6 +12449,13 @@ components: required: - 'data' type: 'object' + GetToolResponse: + properties: + data: + $ref: '#/components/schemas/ServerToolDetails' + required: + - 'data' + type: 'object' GetWorkspaceBudgetResponse: example: data: @@ -15510,6 +15517,32 @@ components: - 'data' - 'total_count' type: 'object' + ListToolsResponse: + properties: + data: + items: + $ref: '#/components/schemas/ServerTool' + type: 'array' + links: + properties: + next: + description: 'URL for the next page of results, or null if this is the last page' + example: null + type: + - 'string' + - 'null' + required: + - 'next' + type: 'object' + total_count: + description: 'Total number of tools' + example: 12 + type: 'integer' + required: + - 'data' + - 'total_count' + - 'links' + type: 'object' ListWorkspaceBudgetsResponse: example: data: @@ -27537,6 +27570,306 @@ components: example: 'medium' type: 'string' x-speakeasy-unknown-values: allow + ServerTool: + properties: + aliases: + description: 'Every spelling accepted in `tools[].type` for this tool, including the canonical `id`, and what the call surfaces as under each' + items: + $ref: '#/components/schemas/ServerToolInputName' + type: 'array' + default_engine: + description: 'The engine a request without `parameters.engine` (or with `engine: "auto"`) runs on; `native` applies where the endpoint runs the tool itself, otherwise `fallback_engine`. A request pinned to a data region skips either engine when its `data_regions` does not list that region. Null for a tool without an engine parameter' + example: 'native' + type: + - 'string' + - 'null' + docs_url: + format: 'uri' + type: 'string' + engines: + items: + $ref: '#/components/schemas/ServerToolEngine' + type: 'array' + fallback_engine: + description: 'The engine an unpinned request runs on when `default_engine` is `native` and the endpoint does not run the tool itself; null when there is no fallback' + example: 'exa' + type: + - 'string' + - 'null' + id: + description: 'Canonical `openrouter:*` name; the stable `tools[].type` on every API format in `supported_api_formats`' + example: 'openrouter:web_search' + type: 'string' + input_schema: + additionalProperties: {} + description: 'JSON Schema of the arguments the model emits when calling the tool' + example: + properties: {} + type: 'object' + type: 'object' + name: + example: 'Web search' + type: 'string' + native_support: + $ref: '#/components/schemas/ServerToolNativeSupport' + output_schema: + additionalProperties: {} + description: 'JSON Schema of the result returned to the model; null when undeclared' + example: + properties: {} + type: 'object' + type: + - 'object' + - 'null' + parameters_schema: + additionalProperties: {} + description: 'JSON Schema for the caller-side `tools[].parameters` object' + example: + properties: {} + type: 'object' + type: 'object' + status: + enum: + - 'active' + - 'deprecated' + example: 'active' + type: 'string' + x-speakeasy-unknown-values: allow + summary: + description: 'One sentence for cards and search results; never sent to a model' + type: 'string' + supported_api_formats: + items: + enum: + - 'responses' + - 'chat-completions' + - 'anthropic-messages' + type: 'string' + x-speakeasy-unknown-values: allow + type: 'array' + tool_description: + description: 'The description sent upstream as the function tool description' + type: 'string' + required: + - 'id' + - 'name' + - 'summary' + - 'tool_description' + - 'status' + - 'docs_url' + - 'aliases' + - 'supported_api_formats' + - 'default_engine' + - 'fallback_engine' + - 'parameters_schema' + - 'input_schema' + - 'output_schema' + - 'engines' + - 'native_support' + type: 'object' + ServerToolDetails: + allOf: + - $ref: '#/components/schemas/ServerTool' + - properties: + native_support: + allOf: + - $ref: '#/components/schemas/ServerToolNativeSupport' + - properties: + models: + items: + $ref: '#/components/schemas/ServerToolNativeModel' + type: 'array' + required: + - 'models' + type: 'object' + description: 'Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.' + example: + endpoint_count: 18 + model_count: 12 + type: 'object' + ServerToolEngine: + properties: + byok: + description: 'Whether the engine needs the caller''s own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter''s key is used unless the caller saved one), or `none`' + enum: + - 'required' + - 'optional' + - 'none' + example: 'none' + type: 'string' + x-speakeasy-unknown-values: allow + data_regions: + description: 'The data regions whose requests this engine serves without leaving the region. A request pinned to a region can only use engines that list it; `global` is always listed.' + example: + - 'global' + - 'us' + items: + enum: + - 'global' + - 'europe' + - 'us' + type: 'string' + x-speakeasy-unknown-values: allow + type: 'array' + default_mode: + description: 'The `parameters.mode` a request without one runs and bills as; null for engines without modes. The `pricing[]` row with this `mode` is what an unmoded request bills' + example: 'auto' + type: + - 'string' + - 'null' + executed_by: + $ref: '#/components/schemas/ServerToolExecutedBy' + id: + description: 'The `parameters.engine` value that selects this engine; null for the single engine of a tool without an engine parameter' + example: 'exa' + type: + - 'string' + - 'null' + name: + example: 'Exa' + type: 'string' + pricing: + description: 'The rows OpenRouter bills; non-empty exactly when `pricing_source` is `openrouter`' + items: + $ref: '#/components/schemas/ServerToolPrice' + type: 'array' + pricing_doc_url: + description: 'Where the rates are documented when `pricing_source` is `provider` or `byok`; null otherwise' + example: null + type: + - 'string' + - 'null' + pricing_source: + description: 'Who bills the engine''s calls beyond the model''s tokens: `openrouter` (the `pricing` rows, from the caller''s credits), `provider` (a per-call tool fee from the model''s provider on the inference call, at its own rates), `byok` (the engine''s vendor, against the caller''s own key), or `none` (no charge)' + enum: + - 'openrouter' + - 'provider' + - 'byok' + - 'none' + example: 'openrouter' + type: 'string' + x-speakeasy-unknown-values: allow + required: + - 'id' + - 'name' + - 'executed_by' + - 'data_regions' + - 'byok' + - 'default_mode' + - 'pricing_source' + - 'pricing_doc_url' + - 'pricing' + type: 'object' + ServerToolExecutedBy: + description: 'Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller''s application after the call is returned (`client`).' + enum: + - 'provider' + - 'openrouter' + - 'client' + example: 'openrouter' + type: 'string' + x-speakeasy-unknown-values: allow + ServerToolInputName: + properties: + api_formats: + description: 'API formats that accept this spelling in `tools[].type`' + items: + enum: + - 'responses' + - 'chat-completions' + - 'anthropic-messages' + type: 'string' + x-speakeasy-unknown-values: allow + type: 'array' + output_names: + description: 'What the call surfaces as on each accepting API format when requested under this spelling; a format is absent when the call is not visible to the caller' + items: + $ref: '#/components/schemas/ServerToolOutputName' + type: 'array' + type: + example: 'web_search_20250305' + type: 'string' + required: + - 'type' + - 'api_formats' + - 'output_names' + type: 'object' + ServerToolNativeModel: + properties: + providers: + example: + - 'Anthropic' + - 'Google' + items: + type: 'string' + type: 'array' + slug: + example: 'anthropic/claude-4.5-sonnet' + type: 'string' + required: + - 'slug' + - 'providers' + type: 'object' + ServerToolNativeSupport: + description: 'Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.' + example: + endpoint_count: 18 + model_count: 12 + properties: + endpoint_count: + example: 18 + type: 'integer' + model_count: + example: 12 + type: 'integer' + required: + - 'endpoint_count' + - 'model_count' + type: 'object' + ServerToolOutputName: + properties: + api_format: + enum: + - 'responses' + - 'chat-completions' + - 'anthropic-messages' + type: 'string' + x-speakeasy-unknown-values: allow + name: + description: 'Anthropic Messages `server_tool_use` block `name`, when the call surfaces as one' + example: 'web_search' + type: 'string' + type: + description: 'Output item `type` on Responses, content block `type` on Anthropic Messages, `reasoning_details[].type` on Chat Completions' + example: 'web_search_call' + type: 'string' + required: + - 'api_format' + - 'type' + type: 'object' + ServerToolPrice: + properties: + max_units_per_call: + type: 'integer' + mode: + description: 'The `parameters.mode` this price applies to; null for prices that do not depend on the mode. A request bills exactly one `request` row' + example: 'auto' + type: + - 'string' + - 'null' + price: + description: 'USD per unit, as a decimal string' + example: '0.007' + type: 'string' + unit: + example: 'request' + type: 'string' + required: + - 'mode' + - 'unit' + - 'price' + - 'max_units_per_call' + type: 'object' ServerToolUseDetails: description: 'Usage for server-side tool execution (e.g., web search)' example: @@ -48577,6 +48910,181 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /tools: + get: + description: 'Lists every server tool OpenRouter can run on behalf of a model: accepted `tools[].type` spellings per API format, the engines behind it with their pricing, and how many endpoints run it natively.' + operationId: 'listTools' + parameters: + - description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'offset' + required: false + schema: + default: 0 + description: 'Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned' + example: 0 + minimum: 0 + type: + - 'integer' + - 'null' + nullable: false + - description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + in: 'query' + name: 'limit' + required: false + schema: + default: 50 + description: 'Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned' + example: 50 + maximum: 100 + minimum: 1 + type: 'integer' + - description: 'Only tools usable on this API format' + in: 'query' + name: 'api_format' + required: false + schema: + description: 'Only tools usable on this API format' + enum: + - 'responses' + - 'chat-completions' + - 'anthropic-messages' + example: 'responses' + type: 'string' + x-speakeasy-unknown-values: allow + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListToolsResponse' + description: 'The server tool catalog' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + security: + - bearer: [] + summary: 'List server tools' + tags: + - 'Tools' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /tools/{name}: + get: + description: 'One server tool by canonical name or any accepted alias, with the models that run it natively.' + operationId: 'getTool' + parameters: + - description: 'Canonical `openrouter:*` name or any accepted `tools[].type` alias' + in: 'path' + name: 'name' + required: true + schema: + description: 'Canonical `openrouter:*` name or any accepted `tools[].type` alias' + example: 'openrouter:web_search' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetToolResponse' + description: 'The server tool' + '308': + description: 'An alias was given; `Location` is the canonical tool URL' + headers: + Location: + required: true + schema: + example: '/api/v1/tools/openrouter:web_search' + type: 'string' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + security: + - bearer: [] + summary: 'Get a server tool' + tags: + - 'Tools' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /vault/interns/{internId}/effective-secrets: get: description: 'Lists, one entry per name, the secret the intern''s outbound requests receive: its own secrets, secrets from an attached vault, and workspace secrets, including ones stored before workspace-scoped storage. Where several vaults hold a name, the entry is the one that wins, in the order intern, attached, workspace. The same resolution decides what outbound requests receive, so this list and the intern''s requests agree. `scope` says which vault the entry comes from. Responses carry metadata only, never values. Results are ordered by name and paginated with `limit` and `offset`. Returns 404 when the intern''s attached vault is no longer available, since the intern then receives no secrets. The scope is selected by the API key: workspace routes act on the key''s active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. An intern''s own API key is confined to that intern: it can always read the intern''s secrets and effective secrets, writes to them follow the rules above, and every other intern and every workspace route answers 404. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.' @@ -51789,6 +52297,8 @@ tags: - description: 'Text-to-speech endpoints' name: 'TTS' x-displayName: 'Speech' + - description: 'The catalog of server tools OpenRouter runs on behalf of a model: accepted `tools[].type` spellings per API format, engines and pricing, and which endpoints run each tool natively. See https://openrouter.ai/docs/guides/features/server-tools.' + name: 'Tools' - description: 'Store host-bound secrets for a workspace or for one intern. Scope is selected by the API key. Responses return metadata only, never secret values. See https://openrouter.ai/docs/guides/ori/vault.' name: 'Vault' - description: 'Video Generation endpoints' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ad35fdc8..fbaca05d 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:468a0f30895dcd4a5b86d7ea89839daa81f79dccb0c2af8f8ec3dea52b216ad1 - sourceBlobDigest: sha256:de433ae6845c61966cf3cff7a0dde2c7e38fd61a7228067b768298d3463093c1 + sourceRevisionDigest: sha256:96e63eebaae3842f82b49f0d1def7283cd57894df75dae45854b9455dc6b619a + sourceBlobDigest: sha256:a2de19ccdc88bcfba918829ad828ed8cddd69a023cc18af3e545c0063346108a tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:468a0f30895dcd4a5b86d7ea89839daa81f79dccb0c2af8f8ec3dea52b216ad1 - sourceBlobDigest: sha256:de433ae6845c61966cf3cff7a0dde2c7e38fd61a7228067b768298d3463093c1 + sourceRevisionDigest: sha256:96e63eebaae3842f82b49f0d1def7283cd57894df75dae45854b9455dc6b619a + sourceBlobDigest: sha256:a2de19ccdc88bcfba918829ad828ed8cddd69a023cc18af3e545c0063346108a codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:97272069449099b7e76284cc25b252790cecc78c736278104bd0d422cc02c93f + codeSamplesRevisionDigest: sha256:7f0eb7a8b694d3011f5d68e23151224c6e695fc5959c863638268ed11a51a0e2 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 8212ed9d..a556d342 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2839,4 +2839,14 @@ Based on: ### Generated - [python v1.3.7] . ### Releases -- [PyPI v1.3.7] https://pypi.org/project/openrouter/1.3.7 - . \ No newline at end of file +- [PyPI v1.3.7] https://pypi.org/project/openrouter/1.3.7 - . + +## 2026-09-29 22:04:54 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.8] . +### Releases +- [PyPI v1.3.8] https://pypi.org/project/openrouter/1.3.8 - . \ No newline at end of file diff --git a/docs/components/byok.mdx b/docs/components/byok.mdx new file mode 100644 index 00000000..ab64c8c0 --- /dev/null +++ b/docs/components/byok.mdx @@ -0,0 +1,23 @@ +--- +title: "BYOK" +--- + +Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none` + +## Example Usage + +```python +from openrouter.components import BYOK + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: BYOK = "required" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"required"` +- `"optional"` +- `"none"` diff --git a/docs/components/generationresponsedata.mdx b/docs/components/generationresponsedata.mdx index d8beea52..bf175271 100644 --- a/docs/components/generationresponsedata.mdx +++ b/docs/components/generationresponsedata.mdx @@ -14,7 +14,7 @@ Generation data | `cache_discount` | *Nullable[float]* | :heavy_check_mark: | Discount applied due to caching | 0.0002 | | `cancelled` | *Nullable[bool]* | :heavy_check_mark: | Whether the generation was cancelled | false | | `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the generation was created | 2024-07-15T23:33:19.433273+00:00 | -| `data_region` | [components.DataRegion](../components/dataregion.mdx) | :heavy_check_mark: | The data region this generation was routed through: 'global', 'europe', or 'us'. | global | +| `data_region` | [components.GenerationResponseDataRegion](../components/generationresponsedataregion.mdx) | :heavy_check_mark: | The data region this generation was routed through: 'global', 'europe', or 'us'. | global | | `external_user` | *Nullable[str]* | :heavy_check_mark: | External user identifier | user-123 | | `finish_reason` | *Nullable[str]* | :heavy_check_mark: | Reason the generation finished | stop | | `generation_time` | *Nullable[float]* | :heavy_check_mark: | Time taken for generation in milliseconds | 1200 | diff --git a/docs/components/dataregion.mdx b/docs/components/generationresponsedataregion.mdx similarity index 67% rename from docs/components/dataregion.mdx rename to docs/components/generationresponsedataregion.mdx index a02dd936..780b8f17 100644 --- a/docs/components/dataregion.mdx +++ b/docs/components/generationresponsedataregion.mdx @@ -1,5 +1,5 @@ --- -title: "DataRegion" +title: "GenerationResponseDataRegion" --- The data region this generation was routed through: 'global', 'europe', or 'us'. @@ -7,10 +7,10 @@ The data region this generation was routed through: 'global', 'europe', or 'us'. ## Example Usage ```python -from openrouter.components import DataRegion +from openrouter.components import GenerationResponseDataRegion # Open enum: unrecognized values are captured as UnrecognizedStr -value: DataRegion = "global" +value: GenerationResponseDataRegion = "global" ``` diff --git a/docs/components/gettoolresponse.mdx b/docs/components/gettoolresponse.mdx new file mode 100644 index 00000000..50b8d7f4 --- /dev/null +++ b/docs/components/gettoolresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "GetToolResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `data` | [components.ServerToolDetails](../components/servertooldetails.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/listtoolsresponse.mdx b/docs/components/listtoolsresponse.mdx new file mode 100644 index 00000000..c62bef38 --- /dev/null +++ b/docs/components/listtoolsresponse.mdx @@ -0,0 +1,11 @@ +--- +title: "ListToolsResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `data` | List[[components.ServerTool](../components/servertool.mdx)] | :heavy_check_mark: | N/A | | +| `links` | [components.ListToolsResponseLinks](../components/listtoolsresponselinks.mdx) | :heavy_check_mark: | N/A | | +| `total_count` | *int* | :heavy_check_mark: | Total number of tools | 12 | \ No newline at end of file diff --git a/docs/components/listtoolsresponselinks.mdx b/docs/components/listtoolsresponselinks.mdx new file mode 100644 index 00000000..fe771073 --- /dev/null +++ b/docs/components/listtoolsresponselinks.mdx @@ -0,0 +1,9 @@ +--- +title: "ListToolsResponseLinks" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `next` | *Nullable[str]* | :heavy_check_mark: | URL for the next page of results, or null if this is the last page | null | \ No newline at end of file diff --git a/docs/components/modelslistresponse.mdx b/docs/components/modelslistresponse.mdx index ac531b92..505a1c07 100644 --- a/docs/components/modelslistresponse.mdx +++ b/docs/components/modelslistresponse.mdx @@ -10,5 +10,5 @@ List of available models | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | List[[components.Model](../components/model.mdx)] | :heavy_check_mark: | List of available models | [
\{
"architecture": \{
"input_modalities": [
"text"
],
"instruct_type": "chatml",
"modality": "text-\u003etext",
"output_modalities": [
"text"
],
"tokenizer": "GPT"
},
"canonical_slug": "openai/gpt-4",
"context_length": 8192,
"created": 1692901234,
"default_parameters": null,
"description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.",
"expiration_date": null,
"id": "openai/gpt-4",
"knowledge_cutoff": null,
"links": \{
"details": "/api/v1/models/openai/gpt-4/endpoints"
},
"name": "GPT-4",
"per_request_limits": null,
"pricing": \{
"completion": "0.00006",
"image": "0",
"prompt": "0.00003",
"request": "0"
},
"supported_parameters": [
"temperature",
"top_p",
"max_tokens"
],
"supported_voices": null,
"top_provider": \{
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
}
}
] | -| `links` | [components.Links](../components/links.mdx) | :heavy_check_mark: | Pagination links | | +| `links` | [components.ModelsListResponseLinks](../components/modelslistresponselinks.mdx) | :heavy_check_mark: | Pagination links | | | `total_count` | *int* | :heavy_check_mark: | Total number of models matching the query | 150 | \ No newline at end of file diff --git a/docs/components/links.mdx b/docs/components/modelslistresponselinks.mdx similarity index 97% rename from docs/components/links.mdx rename to docs/components/modelslistresponselinks.mdx index 6debf47d..4c3a5021 100644 --- a/docs/components/links.mdx +++ b/docs/components/modelslistresponselinks.mdx @@ -1,5 +1,5 @@ --- -title: "Links" +title: "ModelsListResponseLinks" --- Pagination links diff --git a/docs/components/nativesupport.mdx b/docs/components/nativesupport.mdx new file mode 100644 index 00000000..a45fc5f1 --- /dev/null +++ b/docs/components/nativesupport.mdx @@ -0,0 +1,14 @@ +--- +title: "NativeSupport" +--- + +Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `endpoint_count` | *int* | :heavy_check_mark: | N/A | 18 | +| `model_count` | *int* | :heavy_check_mark: | N/A | 12 | +| `models` | List[[components.ServerToolNativeModel](../components/servertoolnativemodel.mdx)] | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/pricingsource.mdx b/docs/components/pricingsource.mdx new file mode 100644 index 00000000..2a33f9c0 --- /dev/null +++ b/docs/components/pricingsource.mdx @@ -0,0 +1,24 @@ +--- +title: "PricingSource" +--- + +Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge) + +## Example Usage + +```python +from openrouter.components import PricingSource + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: PricingSource = "openrouter" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"openrouter"` +- `"provider"` +- `"byok"` +- `"none"` diff --git a/docs/components/servertool.mdx b/docs/components/servertool.mdx new file mode 100644 index 00000000..8f8f0d4e --- /dev/null +++ b/docs/components/servertool.mdx @@ -0,0 +1,23 @@ +--- +title: "ServerTool" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `aliases` | List[[components.ServerToolInputName](../components/servertoolinputname.mdx)] | :heavy_check_mark: | Every spelling accepted in `tools[].type` for this tool, including the canonical `id`, and what the call surfaces as under each | | +| `default_engine` | *Nullable[str]* | :heavy_check_mark: | The engine a request without `parameters.engine` (or with `engine: "auto"`) runs on; `native` applies where the endpoint runs the tool itself, otherwise `fallback_engine`. A request pinned to a data region skips either engine when its `data_regions` does not list that region. Null for a tool without an engine parameter | native | +| `docs_url` | *str* | :heavy_check_mark: | N/A | | +| `engines` | List[[components.ServerToolEngine](../components/servertoolengine.mdx)] | :heavy_check_mark: | N/A | | +| `fallback_engine` | *Nullable[str]* | :heavy_check_mark: | The engine an unpinned request runs on when `default_engine` is `native` and the endpoint does not run the tool itself; null when there is no fallback | exa | +| `id` | *str* | :heavy_check_mark: | Canonical `openrouter:*` name; the stable `tools[].type` on every API format in `supported_api_formats` | openrouter:web_search | +| `input_schema` | Dict[str, *Any*] | :heavy_check_mark: | JSON Schema of the arguments the model emits when calling the tool | \{
"properties": \{},
"type": "object"
} | +| `name` | *str* | :heavy_check_mark: | N/A | Web search | +| `native_support` | [components.ServerToolNativeSupport](../components/servertoolnativesupport.mdx) | :heavy_check_mark: | Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively. | \{
"endpoint_count": 18,
"model_count": 12
} | +| `output_schema` | Dict[str, *Any*] | :heavy_check_mark: | JSON Schema of the result returned to the model; null when undeclared | \{
"properties": \{},
"type": "object"
} | +| `parameters_schema` | Dict[str, *Any*] | :heavy_check_mark: | JSON Schema for the caller-side `tools[].parameters` object | \{
"properties": \{},
"type": "object"
} | +| `status` | [components.ServerToolStatus](../components/servertoolstatus.mdx) | :heavy_check_mark: | N/A | active | +| `summary` | *str* | :heavy_check_mark: | One sentence for cards and search results; never sent to a model | | +| `supported_api_formats` | List[[components.ServerToolSupportedAPIFormat](../components/servertoolsupportedapiformat.mdx)] | :heavy_check_mark: | N/A | | +| `tool_description` | *str* | :heavy_check_mark: | The description sent upstream as the function tool description | | \ No newline at end of file diff --git a/docs/components/servertooldetails.mdx b/docs/components/servertooldetails.mdx new file mode 100644 index 00000000..2ec8bf7a --- /dev/null +++ b/docs/components/servertooldetails.mdx @@ -0,0 +1,23 @@ +--- +title: "ServerToolDetails" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `aliases` | List[[components.ServerToolInputName](../components/servertoolinputname.mdx)] | :heavy_check_mark: | Every spelling accepted in `tools[].type` for this tool, including the canonical `id`, and what the call surfaces as under each | | +| `default_engine` | *Nullable[str]* | :heavy_check_mark: | The engine a request without `parameters.engine` (or with `engine: "auto"`) runs on; `native` applies where the endpoint runs the tool itself, otherwise `fallback_engine`. A request pinned to a data region skips either engine when its `data_regions` does not list that region. Null for a tool without an engine parameter | native | +| `docs_url` | *str* | :heavy_check_mark: | N/A | | +| `engines` | List[[components.ServerToolEngine](../components/servertoolengine.mdx)] | :heavy_check_mark: | N/A | | +| `fallback_engine` | *Nullable[str]* | :heavy_check_mark: | The engine an unpinned request runs on when `default_engine` is `native` and the endpoint does not run the tool itself; null when there is no fallback | exa | +| `id` | *str* | :heavy_check_mark: | Canonical `openrouter:*` name; the stable `tools[].type` on every API format in `supported_api_formats` | openrouter:web_search | +| `input_schema` | Dict[str, *Any*] | :heavy_check_mark: | JSON Schema of the arguments the model emits when calling the tool | \{
"properties": \{},
"type": "object"
} | +| `name` | *str* | :heavy_check_mark: | N/A | Web search | +| `native_support` | [components.NativeSupport](../components/nativesupport.mdx) | :heavy_check_mark: | Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively. | \{
"endpoint_count": 18,
"model_count": 12
} | +| `output_schema` | Dict[str, *Any*] | :heavy_check_mark: | JSON Schema of the result returned to the model; null when undeclared | \{
"properties": \{},
"type": "object"
} | +| `parameters_schema` | Dict[str, *Any*] | :heavy_check_mark: | JSON Schema for the caller-side `tools[].parameters` object | \{
"properties": \{},
"type": "object"
} | +| `status` | [components.ServerToolDetailsStatus](../components/servertooldetailsstatus.mdx) | :heavy_check_mark: | N/A | active | +| `summary` | *str* | :heavy_check_mark: | One sentence for cards and search results; never sent to a model | | +| `supported_api_formats` | List[[components.ServerToolDetailsSupportedAPIFormat](../components/servertooldetailssupportedapiformat.mdx)] | :heavy_check_mark: | N/A | | +| `tool_description` | *str* | :heavy_check_mark: | The description sent upstream as the function tool description | | \ No newline at end of file diff --git a/docs/components/servertooldetailsstatus.mdx b/docs/components/servertooldetailsstatus.mdx new file mode 100644 index 00000000..576d28fd --- /dev/null +++ b/docs/components/servertooldetailsstatus.mdx @@ -0,0 +1,20 @@ +--- +title: "ServerToolDetailsStatus" +--- + +## Example Usage + +```python +from openrouter.components import ServerToolDetailsStatus + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolDetailsStatus = "active" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"active"` +- `"deprecated"` diff --git a/docs/components/servertooldetailssupportedapiformat.mdx b/docs/components/servertooldetailssupportedapiformat.mdx new file mode 100644 index 00000000..16944784 --- /dev/null +++ b/docs/components/servertooldetailssupportedapiformat.mdx @@ -0,0 +1,21 @@ +--- +title: "ServerToolDetailsSupportedAPIFormat" +--- + +## Example Usage + +```python +from openrouter.components import ServerToolDetailsSupportedAPIFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolDetailsSupportedAPIFormat = "responses" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"responses"` +- `"chat-completions"` +- `"anthropic-messages"` diff --git a/docs/components/servertoolengine.mdx b/docs/components/servertoolengine.mdx new file mode 100644 index 00000000..65e05967 --- /dev/null +++ b/docs/components/servertoolengine.mdx @@ -0,0 +1,17 @@ +--- +title: "ServerToolEngine" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `byok` | [components.BYOK](../components/byok.mdx) | :heavy_check_mark: | Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none` | none | +| `data_regions` | List[[components.ServerToolEngineDataRegion](../components/servertoolenginedataregion.mdx)] | :heavy_check_mark: | The data regions whose requests this engine serves without leaving the region. A request pinned to a region can only use engines that list it; `global` is always listed. | [
"global",
"us"
] | +| `default_mode` | *Nullable[str]* | :heavy_check_mark: | The `parameters.mode` a request without one runs and bills as; null for engines without modes. The `pricing[]` row with this `mode` is what an unmoded request bills | auto | +| `executed_by` | [components.ServerToolExecutedBy](../components/servertoolexecutedby.mdx) | :heavy_check_mark: | Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`). | openrouter | +| `id` | *Nullable[str]* | :heavy_check_mark: | The `parameters.engine` value that selects this engine; null for the single engine of a tool without an engine parameter | exa | +| `name` | *str* | :heavy_check_mark: | N/A | Exa | +| `pricing` | List[[components.ServerToolPrice](../components/servertoolprice.mdx)] | :heavy_check_mark: | The rows OpenRouter bills; non-empty exactly when `pricing_source` is `openrouter` | | +| `pricing_doc_url` | *Nullable[str]* | :heavy_check_mark: | Where the rates are documented when `pricing_source` is `provider` or `byok`; null otherwise | null | +| `pricing_source` | [components.PricingSource](../components/pricingsource.mdx) | :heavy_check_mark: | Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge) | openrouter | \ No newline at end of file diff --git a/docs/components/servertoolenginedataregion.mdx b/docs/components/servertoolenginedataregion.mdx new file mode 100644 index 00000000..eb983c6a --- /dev/null +++ b/docs/components/servertoolenginedataregion.mdx @@ -0,0 +1,21 @@ +--- +title: "ServerToolEngineDataRegion" +--- + +## Example Usage + +```python +from openrouter.components import ServerToolEngineDataRegion + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolEngineDataRegion = "global" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"global"` +- `"europe"` +- `"us"` diff --git a/docs/components/servertoolexecutedby.mdx b/docs/components/servertoolexecutedby.mdx new file mode 100644 index 00000000..9d1711b9 --- /dev/null +++ b/docs/components/servertoolexecutedby.mdx @@ -0,0 +1,23 @@ +--- +title: "ServerToolExecutedBy" +--- + +Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`). + +## Example Usage + +```python +from openrouter.components import ServerToolExecutedBy + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolExecutedBy = "provider" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"provider"` +- `"openrouter"` +- `"client"` diff --git a/docs/components/servertoolinputname.mdx b/docs/components/servertoolinputname.mdx new file mode 100644 index 00000000..24c13512 --- /dev/null +++ b/docs/components/servertoolinputname.mdx @@ -0,0 +1,11 @@ +--- +title: "ServerToolInputName" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_formats` | List[[components.ServerToolInputNameAPIFormat](../components/servertoolinputnameapiformat.mdx)] | :heavy_check_mark: | API formats that accept this spelling in `tools[].type` | | +| `output_names` | List[[components.ServerToolOutputName](../components/servertooloutputname.mdx)] | :heavy_check_mark: | What the call surfaces as on each accepting API format when requested under this spelling; a format is absent when the call is not visible to the caller | | +| `type` | *str* | :heavy_check_mark: | N/A | web_search_20250305 | \ No newline at end of file diff --git a/docs/components/servertoolinputnameapiformat.mdx b/docs/components/servertoolinputnameapiformat.mdx new file mode 100644 index 00000000..cce7c333 --- /dev/null +++ b/docs/components/servertoolinputnameapiformat.mdx @@ -0,0 +1,21 @@ +--- +title: "ServerToolInputNameAPIFormat" +--- + +## Example Usage + +```python +from openrouter.components import ServerToolInputNameAPIFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolInputNameAPIFormat = "responses" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"responses"` +- `"chat-completions"` +- `"anthropic-messages"` diff --git a/docs/components/servertoolnativemodel.mdx b/docs/components/servertoolnativemodel.mdx new file mode 100644 index 00000000..5cd668a0 --- /dev/null +++ b/docs/components/servertoolnativemodel.mdx @@ -0,0 +1,10 @@ +--- +title: "ServerToolNativeModel" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `providers` | List[*str*] | :heavy_check_mark: | N/A | [
"Anthropic",
"Google"
] | +| `slug` | *str* | :heavy_check_mark: | N/A | anthropic/claude-4.5-sonnet | \ No newline at end of file diff --git a/docs/components/servertoolnativesupport.mdx b/docs/components/servertoolnativesupport.mdx new file mode 100644 index 00000000..b746ac36 --- /dev/null +++ b/docs/components/servertoolnativesupport.mdx @@ -0,0 +1,13 @@ +--- +title: "ServerToolNativeSupport" +--- + +Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `endpoint_count` | *int* | :heavy_check_mark: | N/A | 18 | +| `model_count` | *int* | :heavy_check_mark: | N/A | 12 | \ No newline at end of file diff --git a/docs/components/servertooloutputname.mdx b/docs/components/servertooloutputname.mdx new file mode 100644 index 00000000..1d29864a --- /dev/null +++ b/docs/components/servertooloutputname.mdx @@ -0,0 +1,11 @@ +--- +title: "ServerToolOutputName" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `api_format` | [components.ServerToolOutputNameAPIFormat](../components/servertooloutputnameapiformat.mdx) | :heavy_check_mark: | N/A | | +| `name` | *Optional[str]* | :heavy_minus_sign: | Anthropic Messages `server_tool_use` block `name`, when the call surfaces as one | web_search | +| `type` | *str* | :heavy_check_mark: | Output item `type` on Responses, content block `type` on Anthropic Messages, `reasoning_details[].type` on Chat Completions | web_search_call | \ No newline at end of file diff --git a/docs/components/servertooloutputnameapiformat.mdx b/docs/components/servertooloutputnameapiformat.mdx new file mode 100644 index 00000000..9a7ecb1b --- /dev/null +++ b/docs/components/servertooloutputnameapiformat.mdx @@ -0,0 +1,21 @@ +--- +title: "ServerToolOutputNameAPIFormat" +--- + +## Example Usage + +```python +from openrouter.components import ServerToolOutputNameAPIFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolOutputNameAPIFormat = "responses" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"responses"` +- `"chat-completions"` +- `"anthropic-messages"` diff --git a/docs/components/servertoolprice.mdx b/docs/components/servertoolprice.mdx new file mode 100644 index 00000000..78fe83c0 --- /dev/null +++ b/docs/components/servertoolprice.mdx @@ -0,0 +1,12 @@ +--- +title: "ServerToolPrice" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `max_units_per_call` | *int* | :heavy_check_mark: | N/A | | +| `mode` | *Nullable[str]* | :heavy_check_mark: | The `parameters.mode` this price applies to; null for prices that do not depend on the mode. A request bills exactly one `request` row | auto | +| `price` | *str* | :heavy_check_mark: | USD per unit, as a decimal string | 0.007 | +| `unit` | *str* | :heavy_check_mark: | N/A | request | \ No newline at end of file diff --git a/docs/components/servertoolstatus.mdx b/docs/components/servertoolstatus.mdx new file mode 100644 index 00000000..524b8ce2 --- /dev/null +++ b/docs/components/servertoolstatus.mdx @@ -0,0 +1,20 @@ +--- +title: "ServerToolStatus" +--- + +## Example Usage + +```python +from openrouter.components import ServerToolStatus + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolStatus = "active" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"active"` +- `"deprecated"` diff --git a/docs/components/servertoolsupportedapiformat.mdx b/docs/components/servertoolsupportedapiformat.mdx new file mode 100644 index 00000000..2d169593 --- /dev/null +++ b/docs/components/servertoolsupportedapiformat.mdx @@ -0,0 +1,21 @@ +--- +title: "ServerToolSupportedAPIFormat" +--- + +## Example Usage + +```python +from openrouter.components import ServerToolSupportedAPIFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ServerToolSupportedAPIFormat = "responses" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"responses"` +- `"chat-completions"` +- `"anthropic-messages"` diff --git a/docs/docs.json b/docs/docs.json index af21c6d8..b16f280d 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -41,6 +41,7 @@ "sdks/scim/README", "sdks/stt/README", "sdks/systemone/README", + "sdks/tools/README", "sdks/tts/README", "sdks/vault/README", "sdks/videogeneration/README", diff --git a/docs/operations/apiformat.mdx b/docs/operations/apiformat.mdx new file mode 100644 index 00000000..024ea3a4 --- /dev/null +++ b/docs/operations/apiformat.mdx @@ -0,0 +1,23 @@ +--- +title: "APIFormat" +--- + +Only tools usable on this API format + +## Example Usage + +```python +from openrouter.operations import APIFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: APIFormat = "responses" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"responses"` +- `"chat-completions"` +- `"anthropic-messages"` diff --git a/docs/operations/gettoolglobals.mdx b/docs/operations/gettoolglobals.mdx new file mode 100644 index 00000000..2babeb71 --- /dev/null +++ b/docs/operations/gettoolglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetToolGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/gettoolrequest.mdx b/docs/operations/gettoolrequest.mdx new file mode 100644 index 00000000..0d357688 --- /dev/null +++ b/docs/operations/gettoolrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "GetToolRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `name` | *str* | :heavy_check_mark: | Canonical `openrouter:*` name or any accepted `tools[].type` alias | openrouter:web_search | \ No newline at end of file diff --git a/docs/operations/gettoolresponse.mdx b/docs/operations/gettoolresponse.mdx new file mode 100644 index 00000000..ebca60fe --- /dev/null +++ b/docs/operations/gettoolresponse.mdx @@ -0,0 +1,10 @@ +--- +title: "GetToolResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `headers` | Dict[str, List[*str*]] | :heavy_check_mark: | N/A | +| `result` | [Optional[components.GetToolResponse]](../components/gettoolresponse.mdx) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/gettoolsecurity.mdx b/docs/operations/gettoolsecurity.mdx new file mode 100644 index 00000000..84b78828 --- /dev/null +++ b/docs/operations/gettoolsecurity.mdx @@ -0,0 +1,9 @@ +--- +title: "GetToolSecurity" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `bearer` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/listtoolsglobals.mdx b/docs/operations/listtoolsglobals.mdx new file mode 100644 index 00000000..39d3d2c1 --- /dev/null +++ b/docs/operations/listtoolsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListToolsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listtoolsrequest.mdx b/docs/operations/listtoolsrequest.mdx new file mode 100644 index 00000000..4a996545 --- /dev/null +++ b/docs/operations/listtoolsrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "ListToolsRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `api_format` | [Optional[operations.APIFormat]](../operations/apiformat.mdx) | :heavy_minus_sign: | Only tools usable on this API format | responses | \ No newline at end of file diff --git a/docs/operations/listtoolssecurity.mdx b/docs/operations/listtoolssecurity.mdx new file mode 100644 index 00000000..92fe7946 --- /dev/null +++ b/docs/operations/listtoolssecurity.mdx @@ -0,0 +1,9 @@ +--- +title: "ListToolsSecurity" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `bearer` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/tools/README.mdx b/docs/sdks/tools/README.mdx new file mode 100644 index 00000000..1dd30f0b --- /dev/null +++ b/docs/sdks/tools/README.mdx @@ -0,0 +1,117 @@ +--- +title: "Tools" +description: "The catalog of server tools OpenRouter runs on behalf of a model: accepted `tools[].type` spellings per API format, engines and pricing, and which endpoints run each tool natively. See https://openrouter.ai/docs/guides/features/server-tools." +--- + +## Overview + +The catalog of server tools OpenRouter runs on behalf of a model: accepted `tools[].type` spellings per API format, engines and pricing, and which endpoints run each tool natively. See https://openrouter.ai/docs/guides/features/server-tools. + +### Available Operations + +* [list_tools](#list_tools) - List server tools +* [get_tool](#get_tool) - Get a server tool + +## list_tools + +Lists every server tool OpenRouter can run on behalf of a model: accepted `tools[].type` spellings per API format, the engines behind it with their pricing, and how many endpoints run it natively. + +### Example Usage + +```python +from openrouter import OpenRouter, operations +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", +) as open_router: + + res = open_router.tools.list_tools(security=operations.ListToolsSecurity( + bearer=os.getenv("OPENROUTER_BEARER", ""), + ), offset=0, limit=50) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `security` | [operations.ListToolsSecurity](../../operations/listtoolssecurity.mdx) | :heavy_check_mark: | N/A | | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `offset` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 | +| `api_format` | [Optional[operations.APIFormat]](../../operations/apiformat.mdx) | :heavy_minus_sign: | Only tools usable on this API format | responses | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.ListToolsResponse](../../components/listtoolsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_tool + +One server tool by canonical name or any accepted alias, with the models that run it natively. + +### Example Usage + +```python +from openrouter import OpenRouter, operations +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", +) as open_router: + + res = open_router.tools.get_tool(security=operations.GetToolSecurity( + bearer=os.getenv("OPENROUTER_BEARER", ""), + ), name="openrouter:web_search") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `security` | [operations.GetToolSecurity](../../operations/gettoolsecurity.mdx) | :heavy_check_mark: | N/A | | +| `name` | *str* | :heavy_check_mark: | Canonical `openrouter:*` name or any accepted `tools[].type` alias | openrouter:web_search | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[operations.GetToolResponse](../../operations/gettoolresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 953dedaa..19e9bba5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.7" +version = "1.3.8" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 0f901af4..e4352c0c 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.7" +__version__: str = "1.3.8" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.3.7 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.8 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index d95413f2..c7b4addc 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1827,9 +1827,9 @@ ) from .generationresponse import ( APIType, - DataRegion, GenerationResponse, GenerationResponseData, + GenerationResponseDataRegion, GenerationResponseDataTypedDict, GenerationResponseTypedDict, ) @@ -1855,6 +1855,7 @@ GetScimSyncJobResponse, GetScimSyncJobResponseTypedDict, ) + from .gettoolresponse import GetToolResponse, GetToolResponseTypedDict from .getworkspacebudgetresponse import ( GetWorkspaceBudgetResponse, GetWorkspaceBudgetResponseTypedDict, @@ -2278,6 +2279,12 @@ ListScimGroupsResponse, ListScimGroupsResponseTypedDict, ) + from .listtoolsresponse import ( + ListToolsResponse, + ListToolsResponseLinks, + ListToolsResponseLinksTypedDict, + ListToolsResponseTypedDict, + ) from .listworkspacebudgetsresponse import ( ListWorkspaceBudgetsResponse, ListWorkspaceBudgetsResponseTypedDict, @@ -2588,9 +2595,9 @@ ModelsCountResponseTypedDict, ) from .modelslistresponse import ( - Links, - LinksTypedDict, ModelsListResponse, + ModelsListResponseLinks, + ModelsListResponseLinksTypedDict, ModelsListResponseTypedDict, ) from .moderationplugin import ( @@ -3570,6 +3577,47 @@ ) from .searchqualitylevel import SearchQualityLevel from .security import Security, SecurityTypedDict + from .servertool import ( + ServerTool, + ServerToolStatus, + ServerToolSupportedAPIFormat, + ServerToolTypedDict, + ) + from .servertooldetails import ( + NativeSupport, + NativeSupportTypedDict, + ServerToolDetails, + ServerToolDetailsStatus, + ServerToolDetailsSupportedAPIFormat, + ServerToolDetailsTypedDict, + ) + from .servertoolengine import ( + BYOK, + PricingSource, + ServerToolEngine, + ServerToolEngineDataRegion, + ServerToolEngineTypedDict, + ) + from .servertoolexecutedby import ServerToolExecutedBy + from .servertoolinputname import ( + ServerToolInputName, + ServerToolInputNameAPIFormat, + ServerToolInputNameTypedDict, + ) + from .servertoolnativemodel import ( + ServerToolNativeModel, + ServerToolNativeModelTypedDict, + ) + from .servertoolnativesupport import ( + ServerToolNativeSupport, + ServerToolNativeSupportTypedDict, + ) + from .servertooloutputname import ( + ServerToolOutputName, + ServerToolOutputNameAPIFormat, + ServerToolOutputNameTypedDict, + ) + from .servertoolprice import ServerToolPrice, ServerToolPriceTypedDict from .servertoolusedetails import ( ServerToolUseDetails, ServerToolUseDetailsTypedDict, @@ -4538,6 +4586,7 @@ "AutoRouterPluginCostTier", "AutoRouterPluginID", "AutoRouterPluginTypedDict", + "BYOK", "BYOKKey", "BYOKKeyTypedDict", "BYOKProviderSlug", @@ -5119,7 +5168,6 @@ "DABenchmarkEntry", "DABenchmarkEntryTypedDict", "DataCollection", - "DataRegion", "DatetimeServerTool", "DatetimeServerToolConfig", "DatetimeServerToolConfigTypedDict", @@ -5394,6 +5442,7 @@ "GenerationContentResponseTypedDict", "GenerationResponse", "GenerationResponseData", + "GenerationResponseDataRegion", "GenerationResponseDataTypedDict", "GenerationResponseTypedDict", "GetBYOKKeyResponse", @@ -5410,6 +5459,8 @@ "GetScimGroupMappingResponseTypedDict", "GetScimSyncJobResponse", "GetScimSyncJobResponseTypedDict", + "GetToolResponse", + "GetToolResponseTypedDict", "GetWorkspaceBudgetResponse", "GetWorkspaceBudgetResponseTypedDict", "GetWorkspaceResponse", @@ -5706,8 +5757,6 @@ "LegacyWebSearchServerToolTypedDict", "Legend", "LegendTypedDict", - "Links", - "LinksTypedDict", "ListBYOKKeysResponse", "ListBYOKKeysResponseTypedDict", "ListEndpointsResponse", @@ -5730,6 +5779,10 @@ "ListScimGroupMappingsResponseTypedDict", "ListScimGroupsResponse", "ListScimGroupsResponseTypedDict", + "ListToolsResponse", + "ListToolsResponseLinks", + "ListToolsResponseLinksTypedDict", + "ListToolsResponseTypedDict", "ListWorkspaceBudgetsResponse", "ListWorkspaceBudgetsResponseTypedDict", "ListWorkspaceMembersResponse", @@ -5901,6 +5954,8 @@ "ModelsCountResponseDataTypedDict", "ModelsCountResponseTypedDict", "ModelsListResponse", + "ModelsListResponseLinks", + "ModelsListResponseLinksTypedDict", "ModelsListResponseTypedDict", "Moderation", "ModerationPlugin", @@ -5921,6 +5976,8 @@ "NamespaceToolToolTypedDict", "NamespaceToolType", "NamespaceToolTypedDict", + "NativeSupport", + "NativeSupportTypedDict", "NativeTools", "NativeToolsTypedDict", "Never", @@ -6395,6 +6452,7 @@ "Pricing", "PricingOverride", "PricingOverrideTypedDict", + "PricingSource", "PricingTypedDict", "PrimaryMetric", "PrivateEndpoint", @@ -6631,6 +6689,30 @@ "SearchSurface", "Security", "SecurityTypedDict", + "ServerTool", + "ServerToolDetails", + "ServerToolDetailsStatus", + "ServerToolDetailsSupportedAPIFormat", + "ServerToolDetailsTypedDict", + "ServerToolEngine", + "ServerToolEngineDataRegion", + "ServerToolEngineTypedDict", + "ServerToolExecutedBy", + "ServerToolInputName", + "ServerToolInputNameAPIFormat", + "ServerToolInputNameTypedDict", + "ServerToolNativeModel", + "ServerToolNativeModelTypedDict", + "ServerToolNativeSupport", + "ServerToolNativeSupportTypedDict", + "ServerToolOutputName", + "ServerToolOutputNameAPIFormat", + "ServerToolOutputNameTypedDict", + "ServerToolPrice", + "ServerToolPriceTypedDict", + "ServerToolStatus", + "ServerToolSupportedAPIFormat", + "ServerToolTypedDict", "ServerToolUseDetails", "ServerToolUseDetailsTypedDict", "ServiceUnavailableResponseErrorData", @@ -8423,9 +8505,9 @@ "GenerationContentResponse": ".generationcontentresponse", "GenerationContentResponseTypedDict": ".generationcontentresponse", "APIType": ".generationresponse", - "DataRegion": ".generationresponse", "GenerationResponse": ".generationresponse", "GenerationResponseData": ".generationresponse", + "GenerationResponseDataRegion": ".generationresponse", "GenerationResponseDataTypedDict": ".generationresponse", "GenerationResponseTypedDict": ".generationresponse", "GetBYOKKeyResponse": ".getbyokkeyresponse", @@ -8442,6 +8524,8 @@ "GetScimGroupMappingResponseTypedDict": ".getscimgroupmappingresponse", "GetScimSyncJobResponse": ".getscimsyncjobresponse", "GetScimSyncJobResponseTypedDict": ".getscimsyncjobresponse", + "GetToolResponse": ".gettoolresponse", + "GetToolResponseTypedDict": ".gettoolresponse", "GetWorkspaceBudgetResponse": ".getworkspacebudgetresponse", "GetWorkspaceBudgetResponseTypedDict": ".getworkspacebudgetresponse", "GetWorkspaceResponse": ".getworkspaceresponse", @@ -8744,6 +8828,10 @@ "ListScimGroupMappingsResponseTypedDict": ".listscimgroupmappingsresponse", "ListScimGroupsResponse": ".listscimgroupsresponse", "ListScimGroupsResponseTypedDict": ".listscimgroupsresponse", + "ListToolsResponse": ".listtoolsresponse", + "ListToolsResponseLinks": ".listtoolsresponse", + "ListToolsResponseLinksTypedDict": ".listtoolsresponse", + "ListToolsResponseTypedDict": ".listtoolsresponse", "ListWorkspaceBudgetsResponse": ".listworkspacebudgetsresponse", "ListWorkspaceBudgetsResponseTypedDict": ".listworkspacebudgetsresponse", "ListWorkspaceMembersResponse": ".listworkspacemembersresponse", @@ -9019,9 +9107,9 @@ "ModelsCountResponseData": ".modelscountresponse", "ModelsCountResponseDataTypedDict": ".modelscountresponse", "ModelsCountResponseTypedDict": ".modelscountresponse", - "Links": ".modelslistresponse", - "LinksTypedDict": ".modelslistresponse", "ModelsListResponse": ".modelslistresponse", + "ModelsListResponseLinks": ".modelslistresponse", + "ModelsListResponseLinksTypedDict": ".modelslistresponse", "ModelsListResponseTypedDict": ".modelslistresponse", "ModerationPlugin": ".moderationplugin", "ModerationPluginID": ".moderationplugin", @@ -9742,6 +9830,34 @@ "SearchQualityLevel": ".searchqualitylevel", "Security": ".security", "SecurityTypedDict": ".security", + "ServerTool": ".servertool", + "ServerToolStatus": ".servertool", + "ServerToolSupportedAPIFormat": ".servertool", + "ServerToolTypedDict": ".servertool", + "NativeSupport": ".servertooldetails", + "NativeSupportTypedDict": ".servertooldetails", + "ServerToolDetails": ".servertooldetails", + "ServerToolDetailsStatus": ".servertooldetails", + "ServerToolDetailsSupportedAPIFormat": ".servertooldetails", + "ServerToolDetailsTypedDict": ".servertooldetails", + "BYOK": ".servertoolengine", + "PricingSource": ".servertoolengine", + "ServerToolEngine": ".servertoolengine", + "ServerToolEngineDataRegion": ".servertoolengine", + "ServerToolEngineTypedDict": ".servertoolengine", + "ServerToolExecutedBy": ".servertoolexecutedby", + "ServerToolInputName": ".servertoolinputname", + "ServerToolInputNameAPIFormat": ".servertoolinputname", + "ServerToolInputNameTypedDict": ".servertoolinputname", + "ServerToolNativeModel": ".servertoolnativemodel", + "ServerToolNativeModelTypedDict": ".servertoolnativemodel", + "ServerToolNativeSupport": ".servertoolnativesupport", + "ServerToolNativeSupportTypedDict": ".servertoolnativesupport", + "ServerToolOutputName": ".servertooloutputname", + "ServerToolOutputNameAPIFormat": ".servertooloutputname", + "ServerToolOutputNameTypedDict": ".servertooloutputname", + "ServerToolPrice": ".servertoolprice", + "ServerToolPriceTypedDict": ".servertoolprice", "ServerToolUseDetails": ".servertoolusedetails", "ServerToolUseDetailsTypedDict": ".servertoolusedetails", "ServiceUnavailableResponseErrorData": ".serviceunavailableresponseerrordata", diff --git a/src/openrouter/components/generationresponse.py b/src/openrouter/components/generationresponse.py index f09bb92b..ac86c128 100644 --- a/src/openrouter/components/generationresponse.py +++ b/src/openrouter/components/generationresponse.py @@ -31,7 +31,7 @@ r"""Type of API used for the generation""" -DataRegion = Union[ +GenerationResponseDataRegion = Union[ Literal[ "global", "europe", @@ -55,7 +55,7 @@ class GenerationResponseDataTypedDict(TypedDict): r"""Whether the generation was cancelled""" created_at: str r"""ISO 8601 timestamp of when the generation was created""" - data_region: DataRegion + data_region: GenerationResponseDataRegion r"""The data region this generation was routed through: 'global', 'europe', or 'us'.""" external_user: Nullable[str] r"""External user identifier""" @@ -155,7 +155,7 @@ class GenerationResponseData(BaseModel): created_at: str r"""ISO 8601 timestamp of when the generation was created""" - data_region: DataRegion + data_region: GenerationResponseDataRegion r"""The data region this generation was routed through: 'global', 'europe', or 'us'.""" external_user: Nullable[str] diff --git a/src/openrouter/components/gettoolresponse.py b/src/openrouter/components/gettoolresponse.py new file mode 100644 index 00000000..c49ee33c --- /dev/null +++ b/src/openrouter/components/gettoolresponse.py @@ -0,0 +1,14 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .servertooldetails import ServerToolDetails, ServerToolDetailsTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class GetToolResponseTypedDict(TypedDict): + data: ServerToolDetailsTypedDict + + +class GetToolResponse(BaseModel): + data: ServerToolDetails diff --git a/src/openrouter/components/listtoolsresponse.py b/src/openrouter/components/listtoolsresponse.py new file mode 100644 index 00000000..43da08d3 --- /dev/null +++ b/src/openrouter/components/listtoolsresponse.py @@ -0,0 +1,48 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .servertool import ServerTool, ServerToolTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List +from typing_extensions import TypedDict + + +class ListToolsResponseLinksTypedDict(TypedDict): + next: Nullable[str] + r"""URL for the next page of results, or null if this is the last page""" + + +class ListToolsResponseLinks(BaseModel): + next: Nullable[str] + r"""URL for the next page of results, or null if this is the last page""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class ListToolsResponseTypedDict(TypedDict): + data: List[ServerToolTypedDict] + links: ListToolsResponseLinksTypedDict + total_count: int + r"""Total number of tools""" + + +class ListToolsResponse(BaseModel): + data: List[ServerTool] + + links: ListToolsResponseLinks + + total_count: int + r"""Total number of tools""" diff --git a/src/openrouter/components/modelslistresponse.py b/src/openrouter/components/modelslistresponse.py index a1cd85a3..c767f01a 100644 --- a/src/openrouter/components/modelslistresponse.py +++ b/src/openrouter/components/modelslistresponse.py @@ -8,14 +8,14 @@ from typing_extensions import TypedDict -class LinksTypedDict(TypedDict): +class ModelsListResponseLinksTypedDict(TypedDict): r"""Pagination links""" next: Nullable[str] r"""URL for the next page of results, or null if this is the last page""" -class Links(BaseModel): +class ModelsListResponseLinks(BaseModel): r"""Pagination links""" next: Nullable[str] @@ -41,7 +41,7 @@ class ModelsListResponseTypedDict(TypedDict): data: List[ModelTypedDict] r"""List of available models""" - links: LinksTypedDict + links: ModelsListResponseLinksTypedDict r"""Pagination links""" total_count: int r"""Total number of models matching the query""" @@ -53,7 +53,7 @@ class ModelsListResponse(BaseModel): data: List[Model] r"""List of available models""" - links: Links + links: ModelsListResponseLinks r"""Pagination links""" total_count: int diff --git a/src/openrouter/components/servertool.py b/src/openrouter/components/servertool.py new file mode 100644 index 00000000..984f771a --- /dev/null +++ b/src/openrouter/components/servertool.py @@ -0,0 +1,116 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .servertoolengine import ServerToolEngine, ServerToolEngineTypedDict +from .servertoolinputname import ServerToolInputName, ServerToolInputNameTypedDict +from .servertoolnativesupport import ( + ServerToolNativeSupport, + ServerToolNativeSupportTypedDict, +) +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Union +from typing_extensions import TypedDict + + +ServerToolStatus = Union[ + Literal[ + "active", + "deprecated", + ], + UnrecognizedStr, +] + + +ServerToolSupportedAPIFormat = Union[ + Literal[ + "responses", + "chat-completions", + "anthropic-messages", + ], + UnrecognizedStr, +] + + +class ServerToolTypedDict(TypedDict): + aliases: List[ServerToolInputNameTypedDict] + r"""Every spelling accepted in `tools[].type` for this tool, including the canonical `id`, and what the call surfaces as under each""" + default_engine: Nullable[str] + r"""The engine a request without `parameters.engine` (or with `engine: \"auto\"`) runs on; `native` applies where the endpoint runs the tool itself, otherwise `fallback_engine`. A request pinned to a data region skips either engine when its `data_regions` does not list that region. Null for a tool without an engine parameter""" + docs_url: str + engines: List[ServerToolEngineTypedDict] + fallback_engine: Nullable[str] + r"""The engine an unpinned request runs on when `default_engine` is `native` and the endpoint does not run the tool itself; null when there is no fallback""" + id: str + r"""Canonical `openrouter:*` name; the stable `tools[].type` on every API format in `supported_api_formats`""" + input_schema: Dict[str, Any] + r"""JSON Schema of the arguments the model emits when calling the tool""" + name: str + native_support: ServerToolNativeSupportTypedDict + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + output_schema: Nullable[Dict[str, Any]] + r"""JSON Schema of the result returned to the model; null when undeclared""" + parameters_schema: Dict[str, Any] + r"""JSON Schema for the caller-side `tools[].parameters` object""" + status: ServerToolStatus + summary: str + r"""One sentence for cards and search results; never sent to a model""" + supported_api_formats: List[ServerToolSupportedAPIFormat] + tool_description: str + r"""The description sent upstream as the function tool description""" + + +class ServerTool(BaseModel): + aliases: List[ServerToolInputName] + r"""Every spelling accepted in `tools[].type` for this tool, including the canonical `id`, and what the call surfaces as under each""" + + default_engine: Nullable[str] + r"""The engine a request without `parameters.engine` (or with `engine: \"auto\"`) runs on; `native` applies where the endpoint runs the tool itself, otherwise `fallback_engine`. A request pinned to a data region skips either engine when its `data_regions` does not list that region. Null for a tool without an engine parameter""" + + docs_url: str + + engines: List[ServerToolEngine] + + fallback_engine: Nullable[str] + r"""The engine an unpinned request runs on when `default_engine` is `native` and the endpoint does not run the tool itself; null when there is no fallback""" + + id: str + r"""Canonical `openrouter:*` name; the stable `tools[].type` on every API format in `supported_api_formats`""" + + input_schema: Dict[str, Any] + r"""JSON Schema of the arguments the model emits when calling the tool""" + + name: str + + native_support: ServerToolNativeSupport + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + + output_schema: Nullable[Dict[str, Any]] + r"""JSON Schema of the result returned to the model; null when undeclared""" + + parameters_schema: Dict[str, Any] + r"""JSON Schema for the caller-side `tools[].parameters` object""" + + status: ServerToolStatus + + summary: str + r"""One sentence for cards and search results; never sent to a model""" + + supported_api_formats: List[ServerToolSupportedAPIFormat] + + tool_description: str + r"""The description sent upstream as the function tool description""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/servertooldetails.py b/src/openrouter/components/servertooldetails.py new file mode 100644 index 00000000..73e0ad82 --- /dev/null +++ b/src/openrouter/components/servertooldetails.py @@ -0,0 +1,131 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .servertoolengine import ServerToolEngine, ServerToolEngineTypedDict +from .servertoolinputname import ServerToolInputName, ServerToolInputNameTypedDict +from .servertoolnativemodel import ServerToolNativeModel, ServerToolNativeModelTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Union +from typing_extensions import TypedDict + + +class NativeSupportTypedDict(TypedDict): + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + + endpoint_count: int + model_count: int + models: List[ServerToolNativeModelTypedDict] + + +class NativeSupport(BaseModel): + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + + endpoint_count: int + + model_count: int + + models: List[ServerToolNativeModel] + + +ServerToolDetailsStatus = Union[ + Literal[ + "active", + "deprecated", + ], + UnrecognizedStr, +] + + +ServerToolDetailsSupportedAPIFormat = Union[ + Literal[ + "responses", + "chat-completions", + "anthropic-messages", + ], + UnrecognizedStr, +] + + +class ServerToolDetailsTypedDict(TypedDict): + aliases: List[ServerToolInputNameTypedDict] + r"""Every spelling accepted in `tools[].type` for this tool, including the canonical `id`, and what the call surfaces as under each""" + default_engine: Nullable[str] + r"""The engine a request without `parameters.engine` (or with `engine: \"auto\"`) runs on; `native` applies where the endpoint runs the tool itself, otherwise `fallback_engine`. A request pinned to a data region skips either engine when its `data_regions` does not list that region. Null for a tool without an engine parameter""" + docs_url: str + engines: List[ServerToolEngineTypedDict] + fallback_engine: Nullable[str] + r"""The engine an unpinned request runs on when `default_engine` is `native` and the endpoint does not run the tool itself; null when there is no fallback""" + id: str + r"""Canonical `openrouter:*` name; the stable `tools[].type` on every API format in `supported_api_formats`""" + input_schema: Dict[str, Any] + r"""JSON Schema of the arguments the model emits when calling the tool""" + name: str + native_support: NativeSupportTypedDict + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + output_schema: Nullable[Dict[str, Any]] + r"""JSON Schema of the result returned to the model; null when undeclared""" + parameters_schema: Dict[str, Any] + r"""JSON Schema for the caller-side `tools[].parameters` object""" + status: ServerToolDetailsStatus + summary: str + r"""One sentence for cards and search results; never sent to a model""" + supported_api_formats: List[ServerToolDetailsSupportedAPIFormat] + tool_description: str + r"""The description sent upstream as the function tool description""" + + +class ServerToolDetails(BaseModel): + aliases: List[ServerToolInputName] + r"""Every spelling accepted in `tools[].type` for this tool, including the canonical `id`, and what the call surfaces as under each""" + + default_engine: Nullable[str] + r"""The engine a request without `parameters.engine` (or with `engine: \"auto\"`) runs on; `native` applies where the endpoint runs the tool itself, otherwise `fallback_engine`. A request pinned to a data region skips either engine when its `data_regions` does not list that region. Null for a tool without an engine parameter""" + + docs_url: str + + engines: List[ServerToolEngine] + + fallback_engine: Nullable[str] + r"""The engine an unpinned request runs on when `default_engine` is `native` and the endpoint does not run the tool itself; null when there is no fallback""" + + id: str + r"""Canonical `openrouter:*` name; the stable `tools[].type` on every API format in `supported_api_formats`""" + + input_schema: Dict[str, Any] + r"""JSON Schema of the arguments the model emits when calling the tool""" + + name: str + + native_support: NativeSupport + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + + output_schema: Nullable[Dict[str, Any]] + r"""JSON Schema of the result returned to the model; null when undeclared""" + + parameters_schema: Dict[str, Any] + r"""JSON Schema for the caller-side `tools[].parameters` object""" + + status: ServerToolDetailsStatus + + summary: str + r"""One sentence for cards and search results; never sent to a model""" + + supported_api_formats: List[ServerToolDetailsSupportedAPIFormat] + + tool_description: str + r"""The description sent upstream as the function tool description""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/servertoolengine.py b/src/openrouter/components/servertoolengine.py new file mode 100644 index 00000000..e7aba2f4 --- /dev/null +++ b/src/openrouter/components/servertoolengine.py @@ -0,0 +1,104 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .servertoolexecutedby import ServerToolExecutedBy +from .servertoolprice import ServerToolPrice, ServerToolPriceTypedDict +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import List, Literal, Union +from typing_extensions import TypedDict + + +BYOK = Union[ + Literal[ + "required", + "optional", + "none", + ], + UnrecognizedStr, +] +r"""Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none`""" + + +ServerToolEngineDataRegion = Union[ + Literal[ + "global", + "europe", + "us", + ], + UnrecognizedStr, +] + + +PricingSource = Union[ + Literal[ + "openrouter", + "provider", + "byok", + "none", + ], + UnrecognizedStr, +] +r"""Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge)""" + + +class ServerToolEngineTypedDict(TypedDict): + byok: BYOK + r"""Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none`""" + data_regions: List[ServerToolEngineDataRegion] + r"""The data regions whose requests this engine serves without leaving the region. A request pinned to a region can only use engines that list it; `global` is always listed.""" + default_mode: Nullable[str] + r"""The `parameters.mode` a request without one runs and bills as; null for engines without modes. The `pricing[]` row with this `mode` is what an unmoded request bills""" + executed_by: ServerToolExecutedBy + r"""Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`).""" + id: Nullable[str] + r"""The `parameters.engine` value that selects this engine; null for the single engine of a tool without an engine parameter""" + name: str + pricing: List[ServerToolPriceTypedDict] + r"""The rows OpenRouter bills; non-empty exactly when `pricing_source` is `openrouter`""" + pricing_doc_url: Nullable[str] + r"""Where the rates are documented when `pricing_source` is `provider` or `byok`; null otherwise""" + pricing_source: PricingSource + r"""Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge)""" + + +class ServerToolEngine(BaseModel): + byok: BYOK + r"""Whether the engine needs the caller's own key, saved in plugin settings: `required` (OpenRouter holds none), `optional` (OpenRouter's key is used unless the caller saved one), or `none`""" + + data_regions: List[ServerToolEngineDataRegion] + r"""The data regions whose requests this engine serves without leaving the region. A request pinned to a region can only use engines that list it; `global` is always listed.""" + + default_mode: Nullable[str] + r"""The `parameters.mode` a request without one runs and bills as; null for engines without modes. The `pricing[]` row with this `mode` is what an unmoded request bills""" + + executed_by: ServerToolExecutedBy + r"""Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`).""" + + id: Nullable[str] + r"""The `parameters.engine` value that selects this engine; null for the single engine of a tool without an engine parameter""" + + name: str + + pricing: List[ServerToolPrice] + r"""The rows OpenRouter bills; non-empty exactly when `pricing_source` is `openrouter`""" + + pricing_doc_url: Nullable[str] + r"""Where the rates are documented when `pricing_source` is `provider` or `byok`; null otherwise""" + + pricing_source: PricingSource + r"""Who bills the engine's calls beyond the model's tokens: `openrouter` (the `pricing` rows, from the caller's credits), `provider` (a per-call tool fee from the model's provider on the inference call, at its own rates), `byok` (the engine's vendor, against the caller's own key), or `none` (no charge)""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/components/servertoolexecutedby.py b/src/openrouter/components/servertoolexecutedby.py new file mode 100644 index 00000000..941c9010 --- /dev/null +++ b/src/openrouter/components/servertoolexecutedby.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +ServerToolExecutedBy = Union[ + Literal[ + "provider", + "openrouter", + "client", + ], + UnrecognizedStr, +] +r"""Who runs the tool call: the model provider during inference (`provider`), OpenRouter (`openrouter`), or the caller's application after the call is returned (`client`).""" diff --git a/src/openrouter/components/servertoolinputname.py b/src/openrouter/components/servertoolinputname.py new file mode 100644 index 00000000..8024b623 --- /dev/null +++ b/src/openrouter/components/servertoolinputname.py @@ -0,0 +1,35 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .servertooloutputname import ServerToolOutputName, ServerToolOutputNameTypedDict +from openrouter.types import BaseModel, UnrecognizedStr +from typing import List, Literal, Union +from typing_extensions import TypedDict + + +ServerToolInputNameAPIFormat = Union[ + Literal[ + "responses", + "chat-completions", + "anthropic-messages", + ], + UnrecognizedStr, +] + + +class ServerToolInputNameTypedDict(TypedDict): + api_formats: List[ServerToolInputNameAPIFormat] + r"""API formats that accept this spelling in `tools[].type`""" + output_names: List[ServerToolOutputNameTypedDict] + r"""What the call surfaces as on each accepting API format when requested under this spelling; a format is absent when the call is not visible to the caller""" + type: str + + +class ServerToolInputName(BaseModel): + api_formats: List[ServerToolInputNameAPIFormat] + r"""API formats that accept this spelling in `tools[].type`""" + + output_names: List[ServerToolOutputName] + r"""What the call surfaces as on each accepting API format when requested under this spelling; a format is absent when the call is not visible to the caller""" + + type: str diff --git a/src/openrouter/components/servertoolnativemodel.py b/src/openrouter/components/servertoolnativemodel.py new file mode 100644 index 00000000..8260ac3e --- /dev/null +++ b/src/openrouter/components/servertoolnativemodel.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ServerToolNativeModelTypedDict(TypedDict): + providers: List[str] + slug: str + + +class ServerToolNativeModel(BaseModel): + providers: List[str] + + slug: str diff --git a/src/openrouter/components/servertoolnativesupport.py b/src/openrouter/components/servertoolnativesupport.py new file mode 100644 index 00000000..32145d1d --- /dev/null +++ b/src/openrouter/components/servertoolnativesupport.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ServerToolNativeSupportTypedDict(TypedDict): + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + + endpoint_count: int + model_count: int + + +class ServerToolNativeSupport(BaseModel): + r"""Endpoints whose provider runs this tool itself during inference. Zero for tools no provider runs natively.""" + + endpoint_count: int + + model_count: int diff --git a/src/openrouter/components/servertooloutputname.py b/src/openrouter/components/servertooloutputname.py new file mode 100644 index 00000000..bbcec625 --- /dev/null +++ b/src/openrouter/components/servertooloutputname.py @@ -0,0 +1,51 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from pydantic import model_serializer +from typing import Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict + + +ServerToolOutputNameAPIFormat = Union[ + Literal[ + "responses", + "chat-completions", + "anthropic-messages", + ], + UnrecognizedStr, +] + + +class ServerToolOutputNameTypedDict(TypedDict): + api_format: ServerToolOutputNameAPIFormat + type: str + r"""Output item `type` on Responses, content block `type` on Anthropic Messages, `reasoning_details[].type` on Chat Completions""" + name: NotRequired[str] + r"""Anthropic Messages `server_tool_use` block `name`, when the call surfaces as one""" + + +class ServerToolOutputName(BaseModel): + api_format: ServerToolOutputNameAPIFormat + + type: str + r"""Output item `type` on Responses, content block `type` on Anthropic Messages, `reasoning_details[].type` on Chat Completions""" + + name: Optional[str] = None + r"""Anthropic Messages `server_tool_use` block `name`, when the call surfaces as one""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/components/servertoolprice.py b/src/openrouter/components/servertoolprice.py new file mode 100644 index 00000000..2c93ff0d --- /dev/null +++ b/src/openrouter/components/servertoolprice.py @@ -0,0 +1,41 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing_extensions import TypedDict + + +class ServerToolPriceTypedDict(TypedDict): + max_units_per_call: int + mode: Nullable[str] + r"""The `parameters.mode` this price applies to; null for prices that do not depend on the mode. A request bills exactly one `request` row""" + price: str + r"""USD per unit, as a decimal string""" + unit: str + + +class ServerToolPrice(BaseModel): + max_units_per_call: int + + mode: Nullable[str] + r"""The `parameters.mode` this price applies to; null for prices that do not depend on the mode. A request bills exactly one `request` row""" + + price: str + r"""USD per unit, as a decimal string""" + + unit: str + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 021994be..ee19e0ca 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -622,6 +622,16 @@ GetTaskClassificationsRequestTypedDict, Window, ) + from .gettool import ( + GetToolGlobals, + GetToolGlobalsTypedDict, + GetToolRequest, + GetToolRequestTypedDict, + GetToolResponse, + GetToolResponseTypedDict, + GetToolSecurity, + GetToolSecurityTypedDict, + ) from .getuseractivity import ( GetUserActivityGlobals, GetUserActivityGlobalsTypedDict, @@ -891,6 +901,15 @@ ListScimGroupsResponse, ListScimGroupsResponseTypedDict, ) + from .listtools import ( + APIFormat, + ListToolsGlobals, + ListToolsGlobalsTypedDict, + ListToolsRequest, + ListToolsRequestTypedDict, + ListToolsSecurity, + ListToolsSecurityTypedDict, + ) from .listvaultsecrets import ( ListVaultSecretsGlobals, ListVaultSecretsGlobalsTypedDict, @@ -1097,6 +1116,7 @@ ) __all__ = [ + "APIFormat", "ActivatePrivateEndpointGlobals", "ActivatePrivateEndpointGlobalsTypedDict", "ActivatePrivateEndpointRequest", @@ -1528,6 +1548,14 @@ "GetTaskClassificationsGlobalsTypedDict", "GetTaskClassificationsRequest", "GetTaskClassificationsRequestTypedDict", + "GetToolGlobals", + "GetToolGlobalsTypedDict", + "GetToolRequest", + "GetToolRequestTypedDict", + "GetToolResponse", + "GetToolResponseTypedDict", + "GetToolSecurity", + "GetToolSecurityTypedDict", "GetUserActivityGlobals", "GetUserActivityGlobalsTypedDict", "GetUserActivityRequest", @@ -1735,6 +1763,12 @@ "ListScimGroupsRequestTypedDict", "ListScimGroupsResponse", "ListScimGroupsResponseTypedDict", + "ListToolsGlobals", + "ListToolsGlobalsTypedDict", + "ListToolsRequest", + "ListToolsRequestTypedDict", + "ListToolsSecurity", + "ListToolsSecurityTypedDict", "ListVaultSecretsGlobals", "ListVaultSecretsGlobalsTypedDict", "ListVaultSecretsRequest", @@ -2373,6 +2407,14 @@ "GetTaskClassificationsRequest": ".gettaskclassifications", "GetTaskClassificationsRequestTypedDict": ".gettaskclassifications", "Window": ".gettaskclassifications", + "GetToolGlobals": ".gettool", + "GetToolGlobalsTypedDict": ".gettool", + "GetToolRequest": ".gettool", + "GetToolRequestTypedDict": ".gettool", + "GetToolResponse": ".gettool", + "GetToolResponseTypedDict": ".gettool", + "GetToolSecurity": ".gettool", + "GetToolSecurityTypedDict": ".gettool", "GetUserActivityGlobals": ".getuseractivity", "GetUserActivityGlobalsTypedDict": ".getuseractivity", "GetUserActivityRequest": ".getuseractivity", @@ -2572,6 +2614,13 @@ "ListScimGroupsRequestTypedDict": ".listscimgroups", "ListScimGroupsResponse": ".listscimgroups", "ListScimGroupsResponseTypedDict": ".listscimgroups", + "APIFormat": ".listtools", + "ListToolsGlobals": ".listtools", + "ListToolsGlobalsTypedDict": ".listtools", + "ListToolsRequest": ".listtools", + "ListToolsRequestTypedDict": ".listtools", + "ListToolsSecurity": ".listtools", + "ListToolsSecurityTypedDict": ".listtools", "ListVaultSecretsGlobals": ".listvaultsecrets", "ListVaultSecretsGlobalsTypedDict": ".listvaultsecrets", "ListVaultSecretsRequest": ".listvaultsecrets", diff --git a/src/openrouter/operations/gettool.py b/src/openrouter/operations/gettool.py new file mode 100644 index 00000000..1e0725f8 --- /dev/null +++ b/src/openrouter/operations/gettool.py @@ -0,0 +1,195 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import gettoolresponse as components_gettoolresponse +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + SecurityMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetToolGlobalsTypedDict(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 GetToolGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetToolSecurityTypedDict(TypedDict): + bearer: str + + +class GetToolSecurity(BaseModel): + bearer: Annotated[ + str, + FieldMetadata( + security=SecurityMetadata( + scheme=True, + scheme_type="http", + sub_type="bearer", + field_name="Authorization", + ) + ), + ] + + +class GetToolRequestTypedDict(TypedDict): + name: str + r"""Canonical `openrouter:*` name or any accepted `tools[].type` alias""" + 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 GetToolRequest(BaseModel): + name: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""Canonical `openrouter:*` name or any accepted `tools[].type` alias""" + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetToolResponseTypedDict(TypedDict): + headers: Dict[str, List[str]] + result: NotRequired[components_gettoolresponse.GetToolResponseTypedDict] + + +class GetToolResponse(BaseModel): + headers: Dict[str, List[str]] + + result: Optional[components_gettoolresponse.GetToolResponse] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["Result"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/openrouter/operations/listtools.py b/src/openrouter/operations/listtools.py new file mode 100644 index 00000000..2a66b9d1 --- /dev/null +++ b/src/openrouter/operations/listtools.py @@ -0,0 +1,217 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + QueryParamMetadata, + SecurityMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListToolsGlobalsTypedDict(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 ListToolsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListToolsSecurityTypedDict(TypedDict): + bearer: str + + +class ListToolsSecurity(BaseModel): + bearer: Annotated[ + str, + FieldMetadata( + security=SecurityMetadata( + scheme=True, + scheme_type="http", + sub_type="bearer", + field_name="Authorization", + ) + ), + ] + + +APIFormat = Union[ + Literal[ + "responses", + "chat-completions", + "anthropic-messages", + ], + UnrecognizedStr, +] +r"""Only tools usable on this API format""" + + +class ListToolsRequestTypedDict(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. + + """ + offset: NotRequired[Nullable[int]] + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + limit: NotRequired[int] + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + api_format: NotRequired[APIFormat] + r"""Only tools usable on this API format""" + + +class ListToolsRequest(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. + + """ + + offset: Annotated[ + OptionalNullable[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 0 + r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned""" + + limit: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 50 + r"""Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned""" + + api_format: Annotated[ + Optional[APIFormat], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Only tools usable on this API format""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + "api_format", + ] + ) + nullable_fields = set(["offset"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index 78cbf5d3..0a110f2c 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -47,6 +47,7 @@ from openrouter.scim import Scim from openrouter.stt import STT from openrouter.systemone import SystemOne + from openrouter.tools import Tools from openrouter.tts import TTS from openrouter.vault import Vault from openrouter.video_generation import VideoGeneration @@ -119,6 +120,8 @@ class OpenRouter(BaseSDK): r"""Management endpoints for SCIM group-to-workspace mappings, authenticated with a management key. These are not the SCIM 2.0 connector endpoints for your identity provider. In your identity provider, enter the SCIM endpoint URL shown when you enable provisioning under Settings > Members > SCIM Mappings. See https://openrouter.ai/docs/guides/features/scim-mappings#set-up-provisioning.""" system_one: "SystemOne" r"""System One endpoints for models such as Jev, compatible with the TypeSafe SDKs. See https://openrouter.ai/docs/guides/community/typesafe-sdk.""" + tools: "Tools" + r"""The catalog of server tools OpenRouter runs on behalf of a model: accepted `tools[].type` spellings per API format, engines and pricing, and which endpoints run each tool natively. See https://openrouter.ai/docs/guides/features/server-tools.""" vault: "Vault" r"""Store host-bound secrets for a workspace or for one intern. Scope is selected by the API key. Responses return metadata only, never secret values. See https://openrouter.ai/docs/guides/ori/vault.""" video_generation: "VideoGeneration" @@ -158,6 +161,7 @@ class OpenRouter(BaseSDK): "beta": ("openrouter.beta", "Beta"), "scim": ("openrouter.scim", "Scim"), "system_one": ("openrouter.systemone", "SystemOne"), + "tools": ("openrouter.tools", "Tools"), "vault": ("openrouter.vault", "Vault"), "video_generation": ("openrouter.video_generation", "VideoGeneration"), "workspaces": ("openrouter.workspaces", "Workspaces"), diff --git a/src/openrouter/tools.py b/src/openrouter/tools.py new file mode 100644 index 00000000..701fa859 --- /dev/null +++ b/src/openrouter/tools.py @@ -0,0 +1,579 @@ +"""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, Union + + +class Tools(BaseSDK): + r"""The catalog of server tools OpenRouter runs on behalf of a model: accepted `tools[].type` spellings per API format, engines and pricing, and which endpoints run each tool natively. See https://openrouter.ai/docs/guides/features/server-tools.""" + + def list_tools( + self, + *, + security: Union[ + operations.ListToolsSecurity, operations.ListToolsSecurityTypedDict + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: OptionalNullable[int] = 0, + limit: Optional[int] = 50, + api_format: Optional[operations.APIFormat] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ListToolsResponse: + r"""List server tools + + Lists every server tool OpenRouter can run on behalf of a model: accepted `tools[].type` spellings per API format, the engines behind it with their pricing, and how many endpoints run it natively. + + :param security: + :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 offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param api_format: Only tools usable on this API format + :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.ListToolsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + api_format=api_format, + ) + + req = self._build_request( + method="GET", + path="/tools", + 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.ListToolsGlobals( + 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=utils.get_pydantic_model(security, operations.ListToolsSecurity), + 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="listTools", + oauth2_scopes=None, + security_source=get_security_from_env(security, components.Security), + tags=["Tools"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.ListToolsResponse, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_tools_async( + self, + *, + security: Union[ + operations.ListToolsSecurity, operations.ListToolsSecurityTypedDict + ], + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + offset: OptionalNullable[int] = 0, + limit: Optional[int] = 50, + api_format: Optional[operations.APIFormat] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ListToolsResponse: + r"""List server tools + + Lists every server tool OpenRouter can run on behalf of a model: accepted `tools[].type` spellings per API format, the engines behind it with their pricing, and how many endpoints run it natively. + + :param security: + :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 offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned + :param limit: Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned + :param api_format: Only tools usable on this API format + :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.ListToolsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, + api_format=api_format, + ) + + req = self._build_request_async( + method="GET", + path="/tools", + 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.ListToolsGlobals( + 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=utils.get_pydantic_model(security, operations.ListToolsSecurity), + 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="listTools", + oauth2_scopes=None, + security_source=get_security_from_env(security, components.Security), + tags=["Tools"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(components.ListToolsResponse, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "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_tool( + self, + *, + security: Union[ + operations.GetToolSecurity, operations.GetToolSecurityTypedDict + ], + name: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetToolResponse: + r"""Get a server tool + + One server tool by canonical name or any accepted alias, with the models that run it natively. + + :param security: + :param name: Canonical `openrouter:*` name or any accepted `tools[].type` alias + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetToolRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + name=name, + ) + + req = self._build_request( + method="GET", + path="/tools/{name}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetToolGlobals( + 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=utils.get_pydantic_model(security, operations.GetToolSecurity), + 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="getTool", + oauth2_scopes=None, + security_source=get_security_from_env(security, components.Security), + tags=["Tools"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetToolResponse( + result=unmarshal_json_response(components.GetToolResponse, http_res), + headers={}, + ) + if utils.match_response(http_res, "308", "*"): + return operations.GetToolResponse( + result=None, headers=utils.get_response_headers(http_res.headers) + ) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "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_tool_async( + self, + *, + security: Union[ + operations.GetToolSecurity, operations.GetToolSecurityTypedDict + ], + name: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetToolResponse: + r"""Get a server tool + + One server tool by canonical name or any accepted alias, with the models that run it natively. + + :param security: + :param name: Canonical `openrouter:*` name or any accepted `tools[].type` alias + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = operations.GetToolRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + name=name, + ) + + req = self._build_request_async( + method="GET", + path="/tools/{name}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetToolGlobals( + 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=utils.get_pydantic_model(security, operations.GetToolSecurity), + 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="getTool", + oauth2_scopes=None, + security_source=get_security_from_env(security, components.Security), + tags=["Tools"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetToolResponse( + result=unmarshal_json_response(components.GetToolResponse, http_res), + headers={}, + ) + if utils.match_response(http_res, "308", "*"): + return operations.GetToolResponse( + result=None, headers=utils.get_response_headers(http_res.headers) + ) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/uv.lock b/uv.lock index 1bf62969..467af1a8 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.7" +version = "1.3.8" source = { editable = "." } dependencies = [ { name = "httpcore" },