From 404b1fe790d0397568717213c77c721543de0869 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:21:05 +0000 Subject: [PATCH 01/62] chore: update OpenAPI spec from monorepo (#393) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 11afda5..5e9935c 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -17442,6 +17442,7 @@ components: enabled: true id: pareto-router min_coding_score: 0.8 + price_source: prompt properties: enabled: description: Set to false to disable the pareto-router plugin for this request. Defaults to true. @@ -17452,14 +17453,23 @@ components: type: string min_coding_score: description: >- - Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding - models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, - medium, high). Omit to use the router default tier. + Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding + models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to + default to the highest tier (equivalent to >= 0.66). example: 0.8 format: double maximum: 1 minimum: 0 type: number + price_source: + description: >- + Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). + "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for + models without traffic data. Defaults to "prompt". + enum: + - prompt + - weighted_avg + type: string required: - id type: object From 60589be74b83e74f39c837d2e48ebea1704c67f8 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 17:01:32 +0000 Subject: [PATCH 02/62] chore: update OpenAPI spec from monorepo (#394) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 5e9935c..5aeabf8 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -9489,9 +9489,9 @@ components: size: description: >- Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels - ("2048x2048") and we normalize it to the right dimensions for the chosen provider. Interchangeable with - resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting - size + resolution/aspect_ratio is rejected. + ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent + to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a + mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. example: 2K type: string stream: From 34403bd42248bdc13c986c144cfa51038457f189 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:29:07 +0000 Subject: [PATCH 03/62] chore: update OpenAPI spec from monorepo (#395) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 5aeabf8..ffe40d4 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -23896,7 +23896,9 @@ paths: x-speakeasy-name-override: createSpeech /audio/transcriptions: post: - description: Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text. + description: >- + Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data + file upload, and returns the transcribed text. operationId: createAudioTranscriptions requestBody: content: @@ -23909,6 +23911,37 @@ paths: model: openai/whisper-large-v3 schema: $ref: '#/components/schemas/STTRequest' + multipart/form-data: + example: + file: audio.wav + language: en + model: openai/whisper-large-v3 + schema: + properties: + file: + description: >- + The audio file to transcribe. The format is derived from the filename extension or the file part + content type. Max 25 MB; send larger files as base64 JSON via input_audio. + format: binary + type: string + language: + description: The language of the input audio (ISO-639-1). + type: string + model: + description: The model to use for transcription. + type: string + response_format: + description: The response format. Only "json" is supported. + enum: + - json + type: string + temperature: + description: The sampling temperature. + type: number + required: + - file + - model + type: object required: true responses: '200': From 1e88de89885619017474cc4b32edf65f07c9106b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:35:05 +0000 Subject: [PATCH 04/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.4=20(#396)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 152 ++++--- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 46 ++- .speakeasy/workflow.lock | 10 +- README-PYPI.md | 4 +- README.md | 4 +- RELEASES.md | 12 +- docs/components/imagegenerationrequest.mdx | 32 +- docs/components/paretorouterplugin.mdx | 11 +- docs/components/pricesource.mdx | 22 + ...createaudiotranscriptionsmultipartfile.mdx | 11 + ...ateaudiotranscriptionsmultipartglobals.mdx | 11 + ...ateaudiotranscriptionsmultipartrequest.mdx | 12 + ...udiotranscriptionsmultipartrequestbody.mdx | 13 + docs/operations/responseformat.mdx | 17 + .../{file.mdx => uploadfilefile.mdx} | 2 +- docs/operations/uploadfilerequestbody.mdx | 6 +- docs/sdks/files/README.mdx | 2 +- docs/sdks/images/README.mdx | 40 +- docs/sdks/stt/README.mdx | 65 ++- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 3 + src/openrouter/components/chatrequest.py | 2 +- .../components/imagegenerationrequest.py | 4 +- src/openrouter/components/messagesrequest.py | 2 +- .../components/paretorouterplugin.py | 25 +- src/openrouter/components/responsesrequest.py | 2 +- src/openrouter/files.py | 8 +- src/openrouter/images.py | 16 +- src/openrouter/operations/__init__.py | 41 +- .../createaudiotranscriptions_multipart.py | 244 +++++++++++ src/openrouter/operations/uploadfile.py | 10 +- src/openrouter/stt.py | 382 +++++++++++++++++- uv.lock | 2 +- 35 files changed, 1073 insertions(+), 148 deletions(-) create mode 100644 docs/components/pricesource.mdx create mode 100644 docs/operations/createaudiotranscriptionsmultipartfile.mdx create mode 100644 docs/operations/createaudiotranscriptionsmultipartglobals.mdx create mode 100644 docs/operations/createaudiotranscriptionsmultipartrequest.mdx create mode 100644 docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx create mode 100644 docs/operations/responseformat.mdx rename docs/operations/{file.mdx => uploadfilefile.mdx} (97%) create mode 100644 src/openrouter/operations/createaudiotranscriptions_multipart.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 52eceb3..47b869c 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: 1b3480b82990a39f968571a292695e01 + docChecksum: 9ce928049e3e28d0a94005ba9f3feae0 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.3 - configChecksum: 9580963049895d84eccfc135025854cb + releaseVersion: 0.11.4 + configChecksum: 4bdce4423724fbc3e27157c1593f7b74 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 00a7dc9a-a2f7-46bb-898f-e804c87aa438 - pristine_commit_hash: 22206487f7eccf058be8483fb016c65abc71aef9 - pristine_tree_hash: c724440db515750df210411562157b40257083ef + generation_id: 050680d0-830b-4b43-af34-44a6c0807b04 + pristine_commit_hash: 7115aa4a60edab70391136ff35b553ee7d958e42 + pristine_tree_hash: 361cb3b699fe64a78518445b7184f4a488605777 features: python: acceptHeaders: 3.0.0 @@ -2070,8 +2070,8 @@ trackedFiles: pristine_git_object: df5a9a53d2ea20bb548913c902b0bffdf2dc5d15 docs/components/imagegenerationrequest.mdx: id: b093cb0f5e81 - last_write_checksum: sha1:68096752052ef76c094d2e49782962a0facad4d8 - pristine_git_object: 1d6369db6d2d6de74df8a6d7366ba627a5389a70 + last_write_checksum: sha1:4a0e2091a23f660c3e706c0e695504fb090e94d1 + pristine_git_object: f9b74f407b1fbc065f271341d42c94142b2e2503 docs/components/imagegenerationrequestaspectratio.mdx: id: bda89377f32d last_write_checksum: sha1:9cc231ee222c01ce471ecff3804a9e5acb8a054f @@ -3658,8 +3658,8 @@ trackedFiles: pristine_git_object: eef5a5c4a33f4a956032328641888fc336a5a55d docs/components/paretorouterplugin.mdx: id: 92e7a1e63fd0 - last_write_checksum: sha1:0d27d564e181cecd6570c92ce027afd447518536 - pristine_git_object: c7ff4bd17a8c4fa61b9a02abad2257ce6c931dc6 + last_write_checksum: sha1:493693e42545592735e9103c9c0a343911a3ac55 + pristine_git_object: 072b9b7e8859caae7e50577a4ed7a2efff48a3b8 docs/components/paretorouterpluginid.mdx: id: 1142f2f64cc8 last_write_checksum: sha1:6e5b2bd86e73db92a9b4b93f014acb57cc61e1ae @@ -3776,6 +3776,10 @@ trackedFiles: id: 35ac43fbcda0 last_write_checksum: sha1:ac447a848769901eb347e8d4ab81494a79d4101f pristine_git_object: 414a5204c691ee0766f05498ff467eeaddebcb6c + docs/components/pricesource.mdx: + id: 815a5cfaf906 + last_write_checksum: sha1:7a7ed23b3c6a5feb64f8428c7e62eab575883a7f + pristine_git_object: 3d340325d192b54a5d039336cce2bd35d12445ac docs/components/pricing.mdx: id: 6816d700f8b1 last_write_checksum: sha1:ac5c56af4e56eb98da5686e33a224950dfbb8207 @@ -5192,6 +5196,22 @@ trackedFiles: id: 3a50c3fec9de last_write_checksum: sha1:df0aebe1971befd5930236620a6ea94dbec73898 pristine_git_object: 2427dcaa5a305401e2e863eaaa6a99bb53183c51 + docs/operations/createaudiotranscriptionsmultipartfile.mdx: + id: 7a553e03f3a1 + last_write_checksum: sha1:47da0d067b733b676fdd0ed535620d7a5b4b5ee6 + pristine_git_object: 3fa3d99a9db518b810a86f06448b3a2f32b37f0a + docs/operations/createaudiotranscriptionsmultipartglobals.mdx: + id: 6f8d9ab67625 + last_write_checksum: sha1:2de6739adb69660e9b1e85090bcc8fbd73ea822d + pristine_git_object: 40d3f1222273b0f940344f051d1184c551ff3002 + docs/operations/createaudiotranscriptionsmultipartrequest.mdx: + id: 31e7948635e6 + last_write_checksum: sha1:00af643224e329cb890449f62f4ee6d350b30db1 + pristine_git_object: b5031668ec1156a4157609e4812b7a3937b802a2 + docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx: + id: 0550cc56c73a + last_write_checksum: sha1:c377fd998af4c7cb2bae44e1a41c3bce02367a18 + pristine_git_object: 70f754bbc14e7fe9754309837b419705c622dfb6 docs/operations/createaudiotranscriptionsrequest.mdx: id: 68a813383936 last_write_checksum: sha1:a3ad7e4691917927539d6c614788da7f4d6b4892 @@ -5512,10 +5532,6 @@ trackedFiles: id: 64162c7ece40 last_write_checksum: sha1:ab0c02f32ff39de1f3da9604432708878cc932c6 pristine_git_object: 2642f99d77ceb5007b1b863028d73c07e48dac67 - docs/operations/file.mdx: - id: 262d5e5a2457 - last_write_checksum: sha1:bb735203bac5677c946bf404bf1e516635d39efd - pristine_git_object: 0c3c666ca80b93b693bd9b4798d8f511738bf269 docs/operations/filter_.mdx: id: 79b9c7c02d3b last_write_checksum: sha1:210f8d87b466cf10785abbd4cb2f9eb2c3e8576e @@ -6120,6 +6136,10 @@ trackedFiles: id: bff19f8bb679 last_write_checksum: sha1:1a743e8a62051c433127a609e131187a74e2a240 pristine_git_object: 051bb4d1cdb3bdbcd87b29419a4a408f10bb1555 + docs/operations/responseformat.mdx: + id: 363fb8a0ddd6 + last_write_checksum: sha1:69ffb401451c435882706846f68465b58324f02f + pristine_git_object: 83b1634e4f243f00c539d436c9defb32eee0f466 docs/operations/result.mdx: id: b68db2e6b7af last_write_checksum: sha1:3ca42544567f285e78aa012de25ac52b5d082314 @@ -6220,6 +6240,10 @@ trackedFiles: id: f2e782002c04 last_write_checksum: sha1:f04d312af9e3ccc5ce53deb68cb6ade27c300dec pristine_git_object: 086cdf63dfdacf09da11a66301f90245ac7cbb0b + docs/operations/uploadfilefile.mdx: + id: fd906268ce4a + last_write_checksum: sha1:31e686522b460fe22dff0c71c996d34b56947c70 + pristine_git_object: f07c77ddfac359392f50d0b9c2f1919bcb043bc4 docs/operations/uploadfileglobals.mdx: id: ec9ebdf283f8 last_write_checksum: sha1:50f87018f87e3b469cd1f8a0795fc186faa0daa4 @@ -6230,8 +6254,8 @@ trackedFiles: pristine_git_object: 70188129763ff300a0f3faa45134f7299c9bdf39 docs/operations/uploadfilerequestbody.mdx: id: fde4cc558d95 - last_write_checksum: sha1:74a28c6834102e4511000ad118bb2892aa0d11cc - pristine_git_object: 4a9975fed03ab1d97c880283bedde17ce90906f9 + last_write_checksum: sha1:84cd9ecf7c776cba269dbc3c6b970b906bd0030d + pristine_git_object: e91f2d3752b54fa3fe8fd469c1e452aa99f5f6b8 docs/operations/upsertworkspacebudgetglobals.mdx: id: 08d7f90d9b03 last_write_checksum: sha1:3fff3f45d7170916f5c4d12557a97cd9693bbac4 @@ -6310,8 +6334,8 @@ trackedFiles: pristine_git_object: 741c77c1982e1f7fc1c2352ce5199c921f9ee82f docs/sdks/files/README.mdx: id: 1a0c257e330c - last_write_checksum: sha1:475d99ba1b2bb8b2826cb43cc729753fbfc0acf8 - pristine_git_object: 5327882a8d7463846af3285afa1bd38432cec275 + last_write_checksum: sha1:e21cb3c8c0e1c48ca7bc6799e764f45790578d3d + pristine_git_object: 8ed39ab511e8430389a8cb92bed10b088a586006 docs/sdks/generations/README.mdx: id: a754fecc8514 last_write_checksum: sha1:e4276fe2f85be0fbafaf573fe58d17b7236d0652 @@ -6322,8 +6346,8 @@ trackedFiles: pristine_git_object: d164a1da79b0838bd68f0a6560a0317eb86e0226 docs/sdks/images/README.mdx: id: 534a6c102c4f - last_write_checksum: sha1:cdebfe56dd55af4bf9248c8a61366d1a6c6b894b - pristine_git_object: cb61de85f54743e18a3e9ff2a861ffc510af713f + last_write_checksum: sha1:fd7a87a3091a9cc65b1f6785fff8f3b278da1660 + pristine_git_object: 77f3172dabafbaa192b258382074cb34cfd55a5e docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:13cd9e4631b4e19a7db5ad93ce63d66358ffb935 @@ -6358,8 +6382,8 @@ trackedFiles: pristine_git_object: 03281f8cf709ebb9a81700ade4cf9bc0db665eb6 docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 - last_write_checksum: sha1:7647525772ccfd7b3b3653eaca748e0e785941b0 - pristine_git_object: a5097c97cbefb52415e2c830b7869525e994a9da + last_write_checksum: sha1:b07ff598e0d3cf542021bff66790ce97ceef6686 + pristine_git_object: 4ca736501a4c14a79710585ab460ea224f95918d docs/sdks/tts/README.mdx: id: cd1132543884 last_write_checksum: sha1:8930237642313a1db6fdce5f7ea2b0680dc7c5ac @@ -6378,8 +6402,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:77dc4bb23124c68a4514773255a6be898795a345 - pristine_git_object: 0ee40fce00c555f4ae902fe221bccbc7bc2cf960 + last_write_checksum: sha1:e63ee1edc31eba7748772e0f9d9f1239abe84b72 + pristine_git_object: 63126319baf5f2bd6c915b590f02eb5b4b8cb1e1 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6406,8 +6430,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:07a6785b54ea278e7f66f25b16dc131011c8fbd6 - pristine_git_object: c2263273c453c720d864cf483e26066fd7edb1e2 + last_write_checksum: sha1:55bbac3c115b285a81d9826cc0f69c37e1195456 + pristine_git_object: 578264d267742981dc5c7268ff378621572831dd src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6446,8 +6470,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:08af0c2202383ec06d9bc58553df3ceb68272edd - pristine_git_object: 192d30802850b8d05e199dade47c0e86deb3c689 + last_write_checksum: sha1:fd8a64c71c4edc63a92eec32343fef06f743dd1b + pristine_git_object: 6e6304237012f2f5eaa9d96e5fde8ee13bc7096d src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6878,8 +6902,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:795fe5c66c8e44878d3769d1068d5591bd0a7a40 - pristine_git_object: 3ab5ba1d64a4f1cb214ff2428a6cfa31054d8774 + last_write_checksum: sha1:ca664d330b0d2904c1479cb63e7b5b7d4e4f0961 + pristine_git_object: fe89789eca242903d019c9d9dd2e50c1069a452d src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:2ff1963c54e7e79500115c8549c8d395f4e336d1 @@ -7382,8 +7406,8 @@ trackedFiles: pristine_git_object: ca3f68a4504570acfdc9c095ccdecfbb636c30f1 src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 - last_write_checksum: sha1:5332c2cd26dbb93e94c927f20babe1d060388242 - pristine_git_object: 5d2a7e6371e56cfadd302a67a10d00deef0373cc + last_write_checksum: sha1:179a0b7ea9363fa826749e8bb6fb21074433e43e + pristine_git_object: fbb59ab7c3ea49aa774b4fc917eb9ed9d4484d32 src/openrouter/components/imagegenerationresponse.py: id: 53354cd0cbfc last_write_checksum: sha1:8c42a25c58b589aad6031d2c1734eabcf1a1b143 @@ -7606,8 +7630,8 @@ trackedFiles: pristine_git_object: 9b033dd8570e1d71ddb61a63a4b320d3003bd3ef src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:ea318958da35e90201812d01dfb04608212533b3 - pristine_git_object: e87ddbde100b658e3d6378cca6b123c8e162b3a9 + last_write_checksum: sha1:85812e6b546d59d8788ea1a30766a01510ea57a9 + pristine_git_object: e69fe1fc961d93b9cfcfacce426937b34fd53b42 src/openrouter/components/metadatalevel.py: id: 0eede47eef62 last_write_checksum: sha1:b4e7e6fc4e9016b65008e9ebbfcc6f018fe89ced @@ -7942,8 +7966,8 @@ trackedFiles: pristine_git_object: 9aaebc4cb7eefdce97f37e89d6d719e524d148e5 src/openrouter/components/paretorouterplugin.py: id: b239c8e11899 - last_write_checksum: sha1:683d7762d520e3b9d08a3e976bc3bfd3ceca931f - pristine_git_object: f010e7df96d242b4b636a3112416a28b7a5845ac + last_write_checksum: sha1:b40a6f823553cd1602d0ccc3d163c19b2b4dbb8a + pristine_git_object: 68114efa832af6afe4dc86cb3e7daa2a2517620b src/openrouter/components/payloadtoolargeresponseerrordata.py: id: 5209b3a61cc9 last_write_checksum: sha1:41c9cfe04f098a0f8c3971e6dfe490c27e783413 @@ -8178,8 +8202,8 @@ trackedFiles: pristine_git_object: 1c7f8a0ef6bc011cd6196c4a4c77a94b1cbb6b73 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:101e67249f64b2d28693f05935aa964a94109467 - pristine_git_object: 53cacf214278aeecf2d9219374316ebde6c1c726 + last_write_checksum: sha1:a473bffe268a505095e26b83c4eb52cf1ebe3b4b + pristine_git_object: 9a98af5bc71c7be9fd3ec851cebce9b806b384a7 src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -8682,8 +8706,8 @@ trackedFiles: pristine_git_object: d858f3b578b189d20b89d0dfc1a6b829ff5897ff src/openrouter/files.py: id: 7baf7ee1f5b3 - last_write_checksum: sha1:0835637e39ff5f43fd04f2b428c861c87d1963be - pristine_git_object: 0c46d08795e4f68a47d310d5636e004fd9088208 + last_write_checksum: sha1:d06e5c382e420e3ffb5892e08088844e69f7a8d7 + pristine_git_object: 1c20e7d6a4837053dac23f3d7985ef6910217589 src/openrouter/generations.py: id: 70e1c21042bc last_write_checksum: sha1:c513500d0aecefad46e4e791094672dd8a31e6f2 @@ -8698,8 +8722,8 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/openrouter/images.py: id: c4d7adf63ae0 - last_write_checksum: sha1:00ec5394bd5507e972b99d119ce27e8b3a0d47b4 - pristine_git_object: ebdec2dfff7323a1abe95b3143396cc0a91deb6d + last_write_checksum: sha1:17dfa465ebb0408aff811872149f6ecda426a050 + pristine_git_object: 6f5c7bad3913610dbe97f5bd03837deff83faa6b src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -8726,8 +8750,8 @@ trackedFiles: pristine_git_object: a1dea9b45650cc42a6f60447c032fa46b102839a src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:58c06e81675a137ec84b13517f78cf1020874f2d - pristine_git_object: fc51690a99a6041a78762af05e43da30f15875da + last_write_checksum: sha1:86fa5bd8f963caf8257ef28d618202fdb56e0b8f + pristine_git_object: 737838dfcd39c8a590ca5058aeffb8fe85311665 src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -8760,6 +8784,10 @@ trackedFiles: id: 53f76e1550e4 last_write_checksum: sha1:80072ad426adddceec1d13756ba0c239cbad7014 pristine_git_object: 4e8414f223370bff1e4f060919f36f70da6ec40c + src/openrouter/operations/createaudiotranscriptions_multipart.py: + id: da07d463225a + last_write_checksum: sha1:340621e278cff6ac1537e4d7e3b2c116a4193ee8 + pristine_git_object: 2697d1e94c6a76e751575bc6f6f626f3e3149f3d src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 last_write_checksum: sha1:874492b64266fcdc5a7f3cd988d71326b7796a5c @@ -9066,8 +9094,8 @@ trackedFiles: pristine_git_object: 4441056786e1495816e8dc057a29795e86380ab1 src/openrouter/operations/uploadfile.py: id: f9dc565da045 - last_write_checksum: sha1:d73fad089275b4d32a718e63baf48926899f6bca - pristine_git_object: 29a37b944dfd1855409f064503e348ce50d13cf0 + last_write_checksum: sha1:fba1a6cb4299c240b32bae8628b5e583e914182a + pristine_git_object: fa8f9261c002709027180b7db501f3c6face90ea src/openrouter/operations/upsertworkspacebudget.py: id: 67d4a2962257 last_write_checksum: sha1:e251aa9f18cef5e265ef4d65cfbda42af411d2a3 @@ -9106,8 +9134,8 @@ trackedFiles: pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 src/openrouter/stt.py: id: fc0c2f669423 - last_write_checksum: sha1:da4bb584de8f5e54ae6d9b6a5d07c3bc6cf41558 - pristine_git_object: a5f03a72b9dd5ad769366fb71c07c57d7510fc56 + last_write_checksum: sha1:d9821e49378f4ceba290fcfd17f7c9b68311fecc + pristine_git_object: b5895f3b688cde2b19bcef498e4992761bbdd58d src/openrouter/tts.py: id: 5055d4b95f1d last_write_checksum: sha1:727a19a0df768153cbe2d8351394a2e254f680ea @@ -9942,6 +9970,32 @@ examples: application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} "529": application/json: {"error": {"code": 529, "message": "Provider returned error"}} + speakeasy-default-create-audio-transcriptions-multipart: + requestBody: + multipart/form-data: {"file": "x-file: example.file", "model": "Escalade"} + responses: + "200": + application/json: {"text": "Hello, this is a test of OpenAI speech-to-text transcription."} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "402": + application/json: {"error": {"code": 402, "message": "Insufficient credits. Add more using https://openrouter.ai/credits"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "502": + application/json: {"error": {"code": 502, "message": "Provider returned error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + "524": + application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} + "529": + application/json: {"error": {"code": 529, "message": "Provider returned error"}} listBYOKKeys: speakeasy-default-list-BYOK-keys: responses: @@ -10652,4 +10706,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(OutputFilesServerToolItem)` **Added**\n * `response` **Changed**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(OutputFilesServerToolItem)` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.stt.create_transcription_multipart()`: **Added**\n* `open_router.beta.responses.send()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.chat.send()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c997d33..abe3ec9 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.3 + version: 0.11.4 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index dfb21f3..47f2f0b 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9434,7 +9434,7 @@ components: type: integer size: description: >- - Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. example: 2K type: string stream: @@ -17356,6 +17356,7 @@ components: enabled: true id: pareto-router min_coding_score: 0.8 + price_source: prompt properties: enabled: description: Set to false to disable the pareto-router plugin for this request. Defaults to true. @@ -17366,12 +17367,20 @@ components: type: string min_coding_score: description: >- - Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, medium, high). Omit to use the router default tier. + Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66). example: 0.8 format: double maximum: 1 minimum: 0 type: number + price_source: + description: >- + Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt". + enum: + - prompt + - weighted_avg + type: string + x-speakeasy-unknown-values: allow required: - id type: object @@ -23705,7 +23714,8 @@ paths: - $ref: "#/components/parameters/AppCategories" /audio/transcriptions: post: - description: Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text. + description: >- + Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text. operationId: createAudioTranscriptions requestBody: content: @@ -23718,6 +23728,36 @@ paths: model: openai/whisper-large-v3 schema: $ref: '#/components/schemas/STTRequest' + multipart/form-data: + example: + file: audio.wav + language: en + model: openai/whisper-large-v3 + schema: + properties: + file: + description: >- + The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. + format: binary + type: string + language: + description: The language of the input audio (ISO-639-1). + type: string + model: + description: The model to use for transcription. + type: string + response_format: + description: The response format. Only "json" is supported. + enum: + - json + type: string + temperature: + description: The sampling temperature. + type: number + required: + - file + - model + type: object required: true responses: '200': diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2b0692f..38cf9a5 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:5381277309ba2f3a4a3e0719b00425be3f93c3103717316e6625bd5caf15b277 - sourceBlobDigest: sha256:def8d29511aca594e11c3367b7013a64c8733cc8050e23deae98d9cc5df55c93 + sourceRevisionDigest: sha256:d2c2c3e13ad669361c25f68fad9ec7eecb75ce8225fe04163163192c1c7fe1f6 + sourceBlobDigest: sha256:22a034c7168faf862dc49ec1eb11cabe3f7b5405fffae3881c02000a4f0ec55b tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:5381277309ba2f3a4a3e0719b00425be3f93c3103717316e6625bd5caf15b277 - sourceBlobDigest: sha256:def8d29511aca594e11c3367b7013a64c8733cc8050e23deae98d9cc5df55c93 + sourceRevisionDigest: sha256:d2c2c3e13ad669361c25f68fad9ec7eecb75ce8225fe04163163192c1c7fe1f6 + sourceBlobDigest: sha256:22a034c7168faf862dc49ec1eb11cabe3f7b5405fffae3881c02000a4f0ec55b codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:18d6fc594c9338480cbc65842c3f276ad0a58f2ceda311aff3d70ea33dbd6e6d + codeSamplesRevisionDigest: sha256:9b19c83c1b20193106f585b755a4d639540a4884675a9336cdf199776093c4bc workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/README-PYPI.md b/README-PYPI.md index 9fdbe27..6b6e72c 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -221,10 +221,10 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.files.upload(file={ + res = open_router.stt.create_transcription_multipart(file={ "file_name": "example.file", "content": open("example.file", "rb"), - }) + }, model="openai/whisper-large-v3", language="en") # Handle response print(res) diff --git a/README.md b/README.md index 9fdbe27..6b6e72c 100644 --- a/README.md +++ b/README.md @@ -221,10 +221,10 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.files.upload(file={ + res = open_router.stt.create_transcription_multipart(file={ "file_name": "example.file", "content": open("example.file", "rb"), - }) + }, model="openai/whisper-large-v3", language="en") # Handle response print(res) diff --git a/RELEASES.md b/RELEASES.md index cb58658..c2bff2d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -138,4 +138,14 @@ Based on: ### Generated - [python v0.11.3] . ### Releases -- [PyPI v0.11.3] https://pypi.org/project/openrouter/0.11.3 - . \ No newline at end of file +- [PyPI v0.11.3] https://pypi.org/project/openrouter/0.11.3 - . + +## 2026-07-07 14:30:37 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.4] . +### Releases +- [PyPI v0.11.4] https://pypi.org/project/openrouter/0.11.4 - . \ No newline at end of file diff --git a/docs/components/imagegenerationrequest.mdx b/docs/components/imagegenerationrequest.mdx index 1d6369d..f9b74f4 100644 --- a/docs/components/imagegenerationrequest.mdx +++ b/docs/components/imagegenerationrequest.mdx @@ -7,19 +7,19 @@ Image generation request input ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `aspect_ratio` | [Optional[components.ImageGenerationRequestAspectRatio]](../components/imagegenerationrequestaspectratio.mdx) | :heavy_minus_sign: | Normalized aspect ratio of the generated image. Providers clamp to their supported subset. | 16:9 | -| `background` | [Optional[components.ImageGenerationRequestBackground]](../components/imagegenerationrequestbackground.mdx) | :heavy_minus_sign: | Background treatment. `transparent` requires an output_format that supports alpha (png or webp). | auto | -| `input_references` | List[[components.ContentPartImage](../components/contentpartimage.mdx)] | :heavy_minus_sign: | Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs. | | -| `model` | *str* | :heavy_check_mark: | The image generation model to use | bytedance-seed/seedream-4.5 | -| `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 | -| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 | -| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png | -| `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting | -| `provider` | [Optional[components.ImageGenerationRequestProvider]](../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `quality` | [Optional[components.ImageGenerationRequestQuality]](../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high | -| `resolution` | [Optional[components.ImageGenerationRequestResolution]](../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K | -| `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | -| `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. | 2K | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `aspect_ratio` | [Optional[components.ImageGenerationRequestAspectRatio]](../components/imagegenerationrequestaspectratio.mdx) | :heavy_minus_sign: | Normalized aspect ratio of the generated image. Providers clamp to their supported subset. | 16:9 | +| `background` | [Optional[components.ImageGenerationRequestBackground]](../components/imagegenerationrequestbackground.mdx) | :heavy_minus_sign: | Background treatment. `transparent` requires an output_format that supports alpha (png or webp). | auto | +| `input_references` | List[[components.ContentPartImage](../components/contentpartimage.mdx)] | :heavy_minus_sign: | Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs. | | +| `model` | *str* | :heavy_check_mark: | The image generation model to use | bytedance-seed/seedream-4.5 | +| `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 | +| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 | +| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png | +| `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting | +| `provider` | [Optional[components.ImageGenerationRequestProvider]](../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `quality` | [Optional[components.ImageGenerationRequestQuality]](../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high | +| `resolution` | [Optional[components.ImageGenerationRequestResolution]](../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K | +| `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | +| `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. | 2K | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | \ No newline at end of file diff --git a/docs/components/paretorouterplugin.mdx b/docs/components/paretorouterplugin.mdx index c7ff4bd..072b9b7 100644 --- a/docs/components/paretorouterplugin.mdx +++ b/docs/components/paretorouterplugin.mdx @@ -4,8 +4,9 @@ title: "ParetoRouterPlugin" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the pareto-router plugin for this request. Defaults to true. | | -| `id` | [components.ParetoRouterPluginID](../components/paretorouterpluginid.mdx) | :heavy_check_mark: | N/A | | -| `min_coding_score` | *Optional[float]* | :heavy_minus_sign: | Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, medium, high). Omit to use the router default tier. | 0.8 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the pareto-router plugin for this request. Defaults to true. | | +| `id` | [components.ParetoRouterPluginID](../components/paretorouterpluginid.mdx) | :heavy_check_mark: | N/A | | +| `min_coding_score` | *Optional[float]* | :heavy_minus_sign: | Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66). | 0.8 | +| `price_source` | [Optional[components.PriceSource]](../components/pricesource.mdx) | :heavy_minus_sign: | Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt". | | \ No newline at end of file diff --git a/docs/components/pricesource.mdx b/docs/components/pricesource.mdx new file mode 100644 index 0000000..3d34032 --- /dev/null +++ b/docs/components/pricesource.mdx @@ -0,0 +1,22 @@ +--- +title: "PriceSource" +--- + +Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt". + +## Example Usage + +```python +from openrouter.components import PriceSource + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: PriceSource = "prompt" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"prompt"` +- `"weighted_avg"` diff --git a/docs/operations/createaudiotranscriptionsmultipartfile.mdx b/docs/operations/createaudiotranscriptionsmultipartfile.mdx new file mode 100644 index 0000000..3fa3d99 --- /dev/null +++ b/docs/operations/createaudiotranscriptionsmultipartfile.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateAudioTranscriptionsMultipartFile" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `file_name` | *str* | :heavy_check_mark: | N/A | +| `content` | *Union[bytes, IO[bytes], io.IOBase]* | :heavy_check_mark: | N/A | +| `content_type` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/operations/createaudiotranscriptionsmultipartglobals.mdx b/docs/operations/createaudiotranscriptionsmultipartglobals.mdx new file mode 100644 index 0000000..40d3f12 --- /dev/null +++ b/docs/operations/createaudiotranscriptionsmultipartglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "CreateAudioTranscriptionsMultipartGlobals" +--- + +## 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/createaudiotranscriptionsmultipartrequest.mdx b/docs/operations/createaudiotranscriptionsmultipartrequest.mdx new file mode 100644 index 0000000..b503166 --- /dev/null +++ b/docs/operations/createaudiotranscriptionsmultipartrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "CreateAudioTranscriptionsMultipartRequest" +--- + +## 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.
| +| `request_body` | [operations.CreateAudioTranscriptionsMultipartRequestBody](../operations/createaudiotranscriptionsmultipartrequestbody.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx new file mode 100644 index 0000000..70f754b --- /dev/null +++ b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx @@ -0,0 +1,13 @@ +--- +title: "CreateAudioTranscriptionsMultipartRequestBody" +--- + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | +| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | +| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | +| `response_format` | [Optional[operations.ResponseFormat]](../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. Only "json" is supported. | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | \ No newline at end of file diff --git a/docs/operations/responseformat.mdx b/docs/operations/responseformat.mdx new file mode 100644 index 0000000..83b1634 --- /dev/null +++ b/docs/operations/responseformat.mdx @@ -0,0 +1,17 @@ +--- +title: "ResponseFormat" +--- + +The response format. Only "json" is supported. + +## Example Usage + +```python +from openrouter.operations import ResponseFormat +value: ResponseFormat = "json" +``` + + +## Values + +- `"json"` diff --git a/docs/operations/file.mdx b/docs/operations/uploadfilefile.mdx similarity index 97% rename from docs/operations/file.mdx rename to docs/operations/uploadfilefile.mdx index 0c3c666..f07c77d 100644 --- a/docs/operations/file.mdx +++ b/docs/operations/uploadfilefile.mdx @@ -1,5 +1,5 @@ --- -title: "File" +title: "UploadFileFile" --- ## Fields diff --git a/docs/operations/uploadfilerequestbody.mdx b/docs/operations/uploadfilerequestbody.mdx index 4a9975f..e91f2d3 100644 --- a/docs/operations/uploadfilerequestbody.mdx +++ b/docs/operations/uploadfilerequestbody.mdx @@ -4,6 +4,6 @@ title: "UploadFileRequestBody" ## Fields -| Field | Type | Required | Description | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `file` | [operations.File](../operations/file.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `file` | [operations.UploadFileFile](../operations/uploadfilefile.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/files/README.mdx b/docs/sdks/files/README.mdx index 5327882..8ed39ab 100644 --- a/docs/sdks/files/README.mdx +++ b/docs/sdks/files/README.mdx @@ -100,7 +100,7 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `file` | [operations.File](../../operations/file.mdx) | :heavy_check_mark: | N/A | | +| `file` | [operations.UploadFileFile](../../operations/uploadfilefile.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.
| | diff --git a/docs/sdks/images/README.mdx b/docs/sdks/images/README.mdx index cb61de8..77f3172 100644 --- a/docs/sdks/images/README.mdx +++ b/docs/sdks/images/README.mdx @@ -42,26 +42,26 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `model` | *str* | :heavy_check_mark: | The image generation model to use | bytedance-seed/seedream-4.5 | -| `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting | -| `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.
| | -| `aspect_ratio` | [Optional[components.ImageGenerationRequestAspectRatio]](../../components/imagegenerationrequestaspectratio.mdx) | :heavy_minus_sign: | Normalized aspect ratio of the generated image. Providers clamp to their supported subset. | 16:9 | -| `background` | [Optional[components.ImageGenerationRequestBackground]](../../components/imagegenerationrequestbackground.mdx) | :heavy_minus_sign: | Background treatment. `transparent` requires an output_format that supports alpha (png or webp). | auto | -| `input_references` | List[[components.ContentPartImage](../../components/contentpartimage.mdx)] | :heavy_minus_sign: | Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs. | | -| `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 | -| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 | -| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png | -| `provider` | [Optional[components.ImageGenerationRequestProvider]](../../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `quality` | [Optional[components.ImageGenerationRequestQuality]](../../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high | -| `resolution` | [Optional[components.ImageGenerationRequestResolution]](../../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K | -| `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | -| `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. | 2K | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `model` | *str* | :heavy_check_mark: | The image generation model to use | bytedance-seed/seedream-4.5 | +| `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting | +| `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.
| | +| `aspect_ratio` | [Optional[components.ImageGenerationRequestAspectRatio]](../../components/imagegenerationrequestaspectratio.mdx) | :heavy_minus_sign: | Normalized aspect ratio of the generated image. Providers clamp to their supported subset. | 16:9 | +| `background` | [Optional[components.ImageGenerationRequestBackground]](../../components/imagegenerationrequestbackground.mdx) | :heavy_minus_sign: | Background treatment. `transparent` requires an output_format that supports alpha (png or webp). | auto | +| `input_references` | List[[components.ContentPartImage](../../components/contentpartimage.mdx)] | :heavy_minus_sign: | Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs. | | +| `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 | +| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 | +| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png | +| `provider` | [Optional[components.ImageGenerationRequestProvider]](../../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `quality` | [Optional[components.ImageGenerationRequestQuality]](../../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high | +| `resolution` | [Optional[components.ImageGenerationRequestResolution]](../../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K | +| `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | +| `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. | 2K | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/stt/README.mdx b/docs/sdks/stt/README.mdx index a5097c9..4ca7365 100644 --- a/docs/sdks/stt/README.mdx +++ b/docs/sdks/stt/README.mdx @@ -10,10 +10,11 @@ Speech-to-text endpoints ### Available Operations * [create_transcription](#create_transcription) - Create transcription +* [create_transcription_multipart](#create_transcription_multipart) - Create transcription ## create_transcription -Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text. +Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text. ### Example Usage @@ -59,6 +60,68 @@ with OpenRouter( ### Errors +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.PaymentRequiredResponseError | 402 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.BadGatewayResponseError | 502 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | +| errors.EdgeNetworkTimeoutResponseError | 524 | application/json | +| errors.ProviderOverloadedResponseError | 529 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## create_transcription_multipart + +Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.stt.create_transcription_multipart(file={ + "file_name": "example.file", + "content": open("example.file", "rb"), + }, model="openai/whisper-large-v3", language="en") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | +| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | +| `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.
| +| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | +| `response_format` | [Optional[operations.ResponseFormat]](../../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. Only "json" is supported. | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.STTResponse](../../components/sttresponse.mdx)** + +### Errors + | Error Type | Status Code | Content Type | | -------------------------------------- | -------------------------------------- | -------------------------------------- | | errors.BadRequestResponseError | 400 | application/json | diff --git a/pyproject.toml b/pyproject.toml index 0ee40fc..6312631 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.3" +version = "0.11.4" 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 c226327..578264d 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.3" +__version__: str = "0.11.4" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.3 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.4 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 192d308..6e63042 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2074,6 +2074,7 @@ if TYPE_CHECKING: ParetoRouterPlugin, ParetoRouterPluginID, ParetoRouterPluginTypedDict, + PriceSource, ) from .payloadtoolargeresponseerrordata import ( PayloadTooLargeResponseErrorData, @@ -4192,6 +4193,7 @@ __all__ = [ "PreviewWebSearchUserLocation", "PreviewWebSearchUserLocationType", "PreviewWebSearchUserLocationTypedDict", + "PriceSource", "Pricing", "PricingTypedDict", "PromptInjectionScanScope", @@ -6262,6 +6264,7 @@ _dynamic_imports: dict[str, str] = { "ParetoRouterPlugin": ".paretorouterplugin", "ParetoRouterPluginID": ".paretorouterplugin", "ParetoRouterPluginTypedDict": ".paretorouterplugin", + "PriceSource": ".paretorouterplugin", "PayloadTooLargeResponseErrorData": ".payloadtoolargeresponseerrordata", "PayloadTooLargeResponseErrorDataTypedDict": ".payloadtoolargeresponseerrordata", "PaymentRequiredResponseErrorData": ".paymentrequiredresponseerrordata", diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index 3ab5ba1..fe89789 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -78,8 +78,8 @@ ChatRequestPluginTypedDict = TypeAliasType( ResponseHealingPluginTypedDict, FileParserPluginTypedDict, ContextCompressionPluginTypedDict, - ParetoRouterPluginTypedDict, AutoRouterPluginTypedDict, + ParetoRouterPluginTypedDict, WebFetchPluginTypedDict, FusionPluginTypedDict, WebSearchPluginTypedDict, diff --git a/src/openrouter/components/imagegenerationrequest.py b/src/openrouter/components/imagegenerationrequest.py index 5d2a7e6..fbb59ab 100644 --- a/src/openrouter/components/imagegenerationrequest.py +++ b/src/openrouter/components/imagegenerationrequest.py @@ -698,7 +698,7 @@ class ImageGenerationRequestTypedDict(TypedDict): seed: NotRequired[int] r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers.""" size: NotRequired[str] - r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected.""" + r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400.""" stream: NotRequired[bool] r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.""" @@ -743,7 +743,7 @@ class ImageGenerationRequest(BaseModel): r"""If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers.""" size: Optional[str] = None - r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected.""" + r"""Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400.""" stream: Optional[bool] = None r"""If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.""" diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index e87ddbd..e69fe1f 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -355,8 +355,8 @@ MessagesRequestPluginTypedDict = TypeAliasType( ResponseHealingPluginTypedDict, FileParserPluginTypedDict, ContextCompressionPluginTypedDict, - ParetoRouterPluginTypedDict, AutoRouterPluginTypedDict, + ParetoRouterPluginTypedDict, WebFetchPluginTypedDict, FusionPluginTypedDict, WebSearchPluginTypedDict, diff --git a/src/openrouter/components/paretorouterplugin.py b/src/openrouter/components/paretorouterplugin.py index f010e7d..68114ef 100644 --- a/src/openrouter/components/paretorouterplugin.py +++ b/src/openrouter/components/paretorouterplugin.py @@ -1,21 +1,33 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer -from typing import Literal, Optional +from typing import Literal, Optional, Union from typing_extensions import NotRequired, TypedDict ParetoRouterPluginID = Literal["pareto-router",] +PriceSource = Union[ + Literal[ + "prompt", + "weighted_avg", + ], + UnrecognizedStr, +] +r"""Price source for the Pareto frontier cost axis. \"prompt\" uses catalog list price (endpoint.pricing.prompt). \"weighted_avg\" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to \"prompt\".""" + + class ParetoRouterPluginTypedDict(TypedDict): id: ParetoRouterPluginID enabled: NotRequired[bool] r"""Set to false to disable the pareto-router plugin for this request. Defaults to true.""" min_coding_score: NotRequired[float] - r"""Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, medium, high). Omit to use the router default tier.""" + r"""Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66).""" + price_source: NotRequired[PriceSource] + r"""Price source for the Pareto frontier cost axis. \"prompt\" uses catalog list price (endpoint.pricing.prompt). \"weighted_avg\" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to \"prompt\".""" class ParetoRouterPlugin(BaseModel): @@ -25,11 +37,14 @@ class ParetoRouterPlugin(BaseModel): r"""Set to false to disable the pareto-router plugin for this request. Defaults to true.""" min_coding_score: Optional[float] = None - r"""Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, medium, high). Omit to use the router default tier.""" + r"""Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66).""" + + price_source: Optional[PriceSource] = None + r"""Price source for the Pareto frontier cost axis. \"prompt\" uses catalog list price (endpoint.pricing.prompt). \"weighted_avg\" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to \"prompt\".""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["enabled", "min_coding_score"]) + optional_fields = set(["enabled", "min_coding_score", "price_source"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 53cacf2..9a98af5 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -123,8 +123,8 @@ ResponsesRequestPluginTypedDict = TypeAliasType( ResponseHealingPluginTypedDict, FileParserPluginTypedDict, ContextCompressionPluginTypedDict, - ParetoRouterPluginTypedDict, AutoRouterPluginTypedDict, + ParetoRouterPluginTypedDict, WebFetchPluginTypedDict, FusionPluginTypedDict, WebSearchPluginTypedDict, diff --git a/src/openrouter/files.py b/src/openrouter/files.py index 0c46d08..1c20e7d 100644 --- a/src/openrouter/files.py +++ b/src/openrouter/files.py @@ -360,7 +360,7 @@ class Files(BaseSDK): def upload( self, *, - file: Union[operations.File, operations.FileTypedDict], + file: Union[operations.UploadFileFile, operations.UploadFileFileTypedDict], http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, @@ -404,7 +404,7 @@ class Files(BaseSDK): x_open_router_categories=x_open_router_categories, workspace_id=workspace_id, request_body=operations.UploadFileRequestBody( - file=utils.get_pydantic_model(file, operations.File), + file=utils.get_pydantic_model(file, operations.UploadFileFile), ), ) @@ -515,7 +515,7 @@ class Files(BaseSDK): async def upload_async( self, *, - file: Union[operations.File, operations.FileTypedDict], + file: Union[operations.UploadFileFile, operations.UploadFileFileTypedDict], http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, @@ -559,7 +559,7 @@ class Files(BaseSDK): x_open_router_categories=x_open_router_categories, workspace_id=workspace_id, request_body=operations.UploadFileRequestBody( - file=utils.get_pydantic_model(file, operations.File), + file=utils.get_pydantic_model(file, operations.UploadFileFile), ), ) diff --git a/src/openrouter/images.py b/src/openrouter/images.py index ebdec2d..6f5c7ba 100644 --- a/src/openrouter/images.py +++ b/src/openrouter/images.py @@ -71,7 +71,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -138,7 +138,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -208,7 +208,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -277,7 +277,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -543,7 +543,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -610,7 +610,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -680,7 +680,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -749,7 +749,7 @@ class Images(BaseSDK): :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. - :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. + :param size: Optional. A convenience shorthand for output dimensions — pass a tier (\"2K\", \"4K\") or explicit pixels (\"2048x2048\") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. :param stream: If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index fc51690..737838d 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -53,6 +53,17 @@ if TYPE_CHECKING: CreateAudioTranscriptionsRequest, CreateAudioTranscriptionsRequestTypedDict, ) + from .createaudiotranscriptions_multipart import ( + CreateAudioTranscriptionsMultipartFile, + CreateAudioTranscriptionsMultipartFileTypedDict, + CreateAudioTranscriptionsMultipartGlobals, + CreateAudioTranscriptionsMultipartGlobalsTypedDict, + CreateAudioTranscriptionsMultipartRequest, + CreateAudioTranscriptionsMultipartRequestBody, + CreateAudioTranscriptionsMultipartRequestBodyTypedDict, + CreateAudioTranscriptionsMultipartRequestTypedDict, + ResponseFormat, + ) from .createauthkeyscode import ( CreateAuthKeysCodeCodeChallengeMethod, CreateAuthKeysCodeData, @@ -707,8 +718,8 @@ if TYPE_CHECKING: UpdateWorkspaceRequestTypedDict, ) from .uploadfile import ( - File, - FileTypedDict, + UploadFileFile, + UploadFileFileTypedDict, UploadFileGlobals, UploadFileGlobalsTypedDict, UploadFileRequest, @@ -763,6 +774,14 @@ __all__ = [ "CreateAudioSpeechRequestTypedDict", "CreateAudioTranscriptionsGlobals", "CreateAudioTranscriptionsGlobalsTypedDict", + "CreateAudioTranscriptionsMultipartFile", + "CreateAudioTranscriptionsMultipartFileTypedDict", + "CreateAudioTranscriptionsMultipartGlobals", + "CreateAudioTranscriptionsMultipartGlobalsTypedDict", + "CreateAudioTranscriptionsMultipartRequest", + "CreateAudioTranscriptionsMultipartRequestBody", + "CreateAudioTranscriptionsMultipartRequestBodyTypedDict", + "CreateAudioTranscriptionsMultipartRequestTypedDict", "CreateAudioTranscriptionsRequest", "CreateAudioTranscriptionsRequestTypedDict", "CreateAuthKeysCodeCodeChallengeMethod", @@ -915,8 +934,6 @@ __all__ = [ "ExchangeAuthCodeForAPIKeyRequestTypedDict", "ExchangeAuthCodeForAPIKeyResponse", "ExchangeAuthCodeForAPIKeyResponseTypedDict", - "File", - "FileTypedDict", "Filter", "FilterTypedDict", "GetAnalyticsMetaData", @@ -1208,6 +1225,7 @@ __all__ = [ "RateLimit", "RateLimitTypedDict", "Region", + "ResponseFormat", "Result", "ResultTypedDict", "Role", @@ -1251,6 +1269,8 @@ __all__ = [ "UpdateWorkspaceGlobalsTypedDict", "UpdateWorkspaceRequest", "UpdateWorkspaceRequestTypedDict", + "UploadFileFile", + "UploadFileFileTypedDict", "UploadFileGlobals", "UploadFileGlobalsTypedDict", "UploadFileRequest", @@ -1304,6 +1324,15 @@ _dynamic_imports: dict[str, str] = { "CreateAudioTranscriptionsGlobalsTypedDict": ".createaudiotranscriptions", "CreateAudioTranscriptionsRequest": ".createaudiotranscriptions", "CreateAudioTranscriptionsRequestTypedDict": ".createaudiotranscriptions", + "CreateAudioTranscriptionsMultipartFile": ".createaudiotranscriptions_multipart", + "CreateAudioTranscriptionsMultipartFileTypedDict": ".createaudiotranscriptions_multipart", + "CreateAudioTranscriptionsMultipartGlobals": ".createaudiotranscriptions_multipart", + "CreateAudioTranscriptionsMultipartGlobalsTypedDict": ".createaudiotranscriptions_multipart", + "CreateAudioTranscriptionsMultipartRequest": ".createaudiotranscriptions_multipart", + "CreateAudioTranscriptionsMultipartRequestBody": ".createaudiotranscriptions_multipart", + "CreateAudioTranscriptionsMultipartRequestBodyTypedDict": ".createaudiotranscriptions_multipart", + "CreateAudioTranscriptionsMultipartRequestTypedDict": ".createaudiotranscriptions_multipart", + "ResponseFormat": ".createaudiotranscriptions_multipart", "CreateAuthKeysCodeCodeChallengeMethod": ".createauthkeyscode", "CreateAuthKeysCodeData": ".createauthkeyscode", "CreateAuthKeysCodeDataTypedDict": ".createauthkeyscode", @@ -1805,8 +1834,8 @@ _dynamic_imports: dict[str, str] = { "UpdateWorkspaceGlobalsTypedDict": ".updateworkspace", "UpdateWorkspaceRequest": ".updateworkspace", "UpdateWorkspaceRequestTypedDict": ".updateworkspace", - "File": ".uploadfile", - "FileTypedDict": ".uploadfile", + "UploadFileFile": ".uploadfile", + "UploadFileFileTypedDict": ".uploadfile", "UploadFileGlobals": ".uploadfile", "UploadFileGlobalsTypedDict": ".uploadfile", "UploadFileRequest": ".uploadfile", diff --git a/src/openrouter/operations/createaudiotranscriptions_multipart.py b/src/openrouter/operations/createaudiotranscriptions_multipart.py new file mode 100644 index 0000000..2697d1e --- /dev/null +++ b/src/openrouter/operations/createaudiotranscriptions_multipart.py @@ -0,0 +1,244 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +import io +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + MultipartFormMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import IO, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateAudioTranscriptionsMultipartGlobalsTypedDict(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 CreateAudioTranscriptionsMultipartGlobals(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 CreateAudioTranscriptionsMultipartFileTypedDict(TypedDict): + file_name: str + content: Union[bytes, IO[bytes], io.IOBase] + content_type: NotRequired[str] + + +class CreateAudioTranscriptionsMultipartFile(BaseModel): + file_name: Annotated[ + str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True) + ] + + content: Annotated[ + Union[bytes, IO[bytes], io.IOBase], + pydantic.Field(alias=""), + FieldMetadata(multipart=MultipartFormMetadata(content=True)), + ] + + content_type: Annotated[ + Optional[str], + pydantic.Field(alias="Content-Type"), + FieldMetadata(multipart=True), + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["contentType"]) + 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 + + +ResponseFormat = Literal["json",] +r"""The response format. Only \"json\" is supported.""" + + +class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict): + file: CreateAudioTranscriptionsMultipartFileTypedDict + r"""The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio.""" + model: str + r"""The model to use for transcription.""" + language: NotRequired[str] + r"""The language of the input audio (ISO-639-1).""" + response_format: NotRequired[ResponseFormat] + r"""The response format. Only \"json\" is supported.""" + temperature: NotRequired[float] + r"""The sampling temperature.""" + + +class CreateAudioTranscriptionsMultipartRequestBody(BaseModel): + file: Annotated[ + CreateAudioTranscriptionsMultipartFile, + FieldMetadata(multipart=MultipartFormMetadata(file=True)), + ] + r"""The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio.""" + + model: Annotated[str, FieldMetadata(multipart=True)] + r"""The model to use for transcription.""" + + language: Annotated[Optional[str], FieldMetadata(multipart=True)] = None + r"""The language of the input audio (ISO-639-1).""" + + response_format: Annotated[ + Optional[ResponseFormat], FieldMetadata(multipart=True) + ] = None + r"""The response format. Only \"json\" is supported.""" + + temperature: Annotated[Optional[float], FieldMetadata(multipart=True)] = None + r"""The sampling temperature.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["language", "response_format", "temperature"]) + 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 CreateAudioTranscriptionsMultipartRequestTypedDict(TypedDict): + request_body: CreateAudioTranscriptionsMultipartRequestBodyTypedDict + 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 CreateAudioTranscriptionsMultipartRequest(BaseModel): + request_body: Annotated[ + CreateAudioTranscriptionsMultipartRequestBody, + FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")), + ] + + 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 diff --git a/src/openrouter/operations/uploadfile.py b/src/openrouter/operations/uploadfile.py index 29a37b9..fa8f926 100644 --- a/src/openrouter/operations/uploadfile.py +++ b/src/openrouter/operations/uploadfile.py @@ -80,13 +80,13 @@ class UploadFileGlobals(BaseModel): return m -class FileTypedDict(TypedDict): +class UploadFileFileTypedDict(TypedDict): file_name: str content: Union[bytes, IO[bytes], io.IOBase] content_type: NotRequired[str] -class File(BaseModel): +class UploadFileFile(BaseModel): file_name: Annotated[ str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True) ] @@ -121,11 +121,13 @@ class File(BaseModel): class UploadFileRequestBodyTypedDict(TypedDict): - file: FileTypedDict + file: UploadFileFileTypedDict class UploadFileRequestBody(BaseModel): - file: Annotated[File, FieldMetadata(multipart=MultipartFormMetadata(file=True))] + file: Annotated[ + UploadFileFile, FieldMetadata(multipart=MultipartFormMetadata(file=True)) + ] class UploadFileRequestTypedDict(TypedDict): diff --git a/src/openrouter/stt.py b/src/openrouter/stt.py index a5f03a7..b5895f3 100644 --- a/src/openrouter/stt.py +++ b/src/openrouter/stt.py @@ -32,7 +32,7 @@ class Stt(BaseSDK): ) -> components.STTResponse: r"""Create transcription - Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text. + Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text. :param input_audio: Base64-encoded audio to transcribe :param model: STT model identifier @@ -218,7 +218,7 @@ class Stt(BaseSDK): ) -> components.STTResponse: r"""Create transcription - Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text. + Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text. :param input_audio: Base64-encoded audio to transcribe :param model: STT model identifier @@ -383,3 +383,381 @@ class Stt(BaseSDK): ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def create_transcription_multipart( + self, + *, + file: Union[ + operations.CreateAudioTranscriptionsMultipartFile, + operations.CreateAudioTranscriptionsMultipartFileTypedDict, + ], + model: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + language: Optional[str] = None, + response_format: Optional[operations.ResponseFormat] = None, + temperature: Optional[float] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.STTResponse: + r"""Create transcription + + Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text. + + :param file: The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. + :param model: The model to use for transcription. + :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 language: The language of the input audio (ISO-639-1). + :param response_format: The response format. Only \"json\" is supported. + :param temperature: The sampling temperature. + :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.CreateAudioTranscriptionsMultipartRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + request_body=operations.CreateAudioTranscriptionsMultipartRequestBody( + file=utils.get_pydantic_model( + file, operations.CreateAudioTranscriptionsMultipartFile + ), + language=language, + model=model, + response_format=response_format, + temperature=temperature, + ), + ) + + req = self._build_request( + method="POST", + path="/audio/transcriptions", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + 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.CreateAudioTranscriptionsMultipartGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + False, + "multipart", + operations.CreateAudioTranscriptionsMultipartRequestBody, + ), + 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="createAudioTranscriptions_multipart", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["STT"], + 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.STTResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "402", "application/json"): + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res + ) + raise errors.PaymentRequiredResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "524", "application/json"): + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res + ) + raise errors.EdgeNetworkTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "529", "application/json"): + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res + ) + raise errors.ProviderOverloadedResponseError(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 create_transcription_multipart_async( + self, + *, + file: Union[ + operations.CreateAudioTranscriptionsMultipartFile, + operations.CreateAudioTranscriptionsMultipartFileTypedDict, + ], + model: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + language: Optional[str] = None, + response_format: Optional[operations.ResponseFormat] = None, + temperature: Optional[float] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.STTResponse: + r"""Create transcription + + Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text. + + :param file: The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. + :param model: The model to use for transcription. + :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 language: The language of the input audio (ISO-639-1). + :param response_format: The response format. Only \"json\" is supported. + :param temperature: The sampling temperature. + :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.CreateAudioTranscriptionsMultipartRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + request_body=operations.CreateAudioTranscriptionsMultipartRequestBody( + file=utils.get_pydantic_model( + file, operations.CreateAudioTranscriptionsMultipartFile + ), + language=language, + model=model, + response_format=response_format, + temperature=temperature, + ), + ) + + req = self._build_request_async( + method="POST", + path="/audio/transcriptions", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + 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.CreateAudioTranscriptionsMultipartGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + False, + "multipart", + operations.CreateAudioTranscriptionsMultipartRequestBody, + ), + 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="createAudioTranscriptions_multipart", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["STT"], + 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.STTResponse, http_res) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "402", "application/json"): + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res + ) + raise errors.PaymentRequiredResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "502", "application/json"): + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res + ) + raise errors.BadGatewayResponseError(response_data, http_res) + if utils.match_response(http_res, "503", "application/json"): + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res + ) + raise errors.ServiceUnavailableResponseError(response_data, http_res) + if utils.match_response(http_res, "524", "application/json"): + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res + ) + raise errors.EdgeNetworkTimeoutResponseError(response_data, http_res) + if utils.match_response(http_res, "529", "application/json"): + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res + ) + raise errors.ProviderOverloadedResponseError(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 9f421ae..cae74d0 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.3" +version = "0.11.4" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 6f0aa8516e610ff1840799ee05caed22eac90a09 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 17:23:15 +0000 Subject: [PATCH 05/62] chore: update OpenAPI spec from monorepo (#397) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 144 ++++++++++++++++++++++++++++++++++--- 1 file changed, 136 insertions(+), 8 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index ffe40d4..2f20817 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -30231,10 +30231,10 @@ paths: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, - top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial - Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models - without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is - preserved. + top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, + coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best + Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When + omitted, the existing default ordering is preserved. in: query name: sort required: false @@ -30243,10 +30243,10 @@ paths: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, - top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low - (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across - arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing - default ordering is preserved. + top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, + coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best + Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When + omitted, the existing default ordering is preserved. enum: - most-popular - newest @@ -30257,6 +30257,8 @@ paths: - throughput-high-to-low - latency-low-to-high - intelligence-high-to-low + - coding-high-to-low + - agentic-high-to-low - design-arena-elo-high-to-low example: newest type: string @@ -30377,6 +30379,132 @@ paths: - eu example: eu type: string + - description: Minimum completion (output) price in $/M tokens. + in: query + name: min_output_price + required: false + schema: + description: Minimum completion (output) price in $/M tokens. + example: 0 + minimum: 0 + nullable: true + type: number + - description: Maximum completion (output) price in $/M tokens. + in: query + name: max_output_price + required: false + schema: + description: Maximum completion (output) price in $/M tokens. + example: 10 + minimum: 0 + nullable: true + type: number + - description: Minimum model age in days since its creation date. + in: query + name: min_age_days + required: false + schema: + description: Minimum model age in days since its creation date. + example: 0 + minimum: 0 + nullable: true + type: integer + - description: Maximum model age in days since its creation date. + in: query + name: max_age_days + required: false + schema: + description: Maximum model age in days since its creation date. + example: 90 + minimum: 0 + nullable: true + type: integer + - description: Minimum Artificial Analysis intelligence index. + in: query + name: min_intelligence_index + required: false + schema: + description: Minimum Artificial Analysis intelligence index. + example: 50 + minimum: 0 + nullable: true + type: number + - description: Maximum Artificial Analysis intelligence index. + in: query + name: max_intelligence_index + required: false + schema: + description: Maximum Artificial Analysis intelligence index. + example: 100 + minimum: 0 + nullable: true + type: number + - description: Minimum Artificial Analysis coding index. + in: query + name: min_coding_index + required: false + schema: + description: Minimum Artificial Analysis coding index. + example: 50 + minimum: 0 + nullable: true + type: number + - description: Maximum Artificial Analysis coding index. + in: query + name: max_coding_index + required: false + schema: + description: Maximum Artificial Analysis coding index. + example: 100 + minimum: 0 + nullable: true + type: number + - description: Minimum Artificial Analysis agentic index. + in: query + name: min_agentic_index + required: false + schema: + description: Minimum Artificial Analysis agentic index. + example: 50 + minimum: 0 + nullable: true + type: number + - description: Maximum Artificial Analysis agentic index. + in: query + name: max_agentic_index + required: false + schema: + description: Maximum Artificial Analysis agentic index. + example: 100 + minimum: 0 + nullable: true + type: number + - description: >- + Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a + tool_calls finish reason). + in: query + name: min_tool_success_rate + required: false + schema: + description: >- + Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a + tool_calls finish reason). + example: 0.9 + maximum: 1 + minimum: 0 + nullable: true + type: number + - description: Maximum tool-calling success rate, as a fraction in [0, 1]. + in: query + name: max_tool_success_rate + required: false + schema: + description: Maximum tool-calling success rate, as a fraction in [0, 1]. + example: 1 + maximum: 1 + minimum: 0 + nullable: true + type: number responses: '200': content: From 738aed60add6fa1fa0b2c9168beb0e9b09b6e6ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 17:29:09 +0000 Subject: [PATCH 06/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.5=20(#398)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 44 ++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 130 +++++++++++++++++++++++- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 ++- docs/operations/getmodelsrequest.mdx | 52 ++++++---- docs/operations/getmodelssort.mdx | 4 +- docs/sdks/models/README.mdx | 54 ++++++---- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/models_.py | 76 +++++++++++++- src/openrouter/operations/getmodels.py | 135 ++++++++++++++++++++++++- uv.lock | 2 +- 13 files changed, 445 insertions(+), 82 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 47b869c..dd69158 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: 9ce928049e3e28d0a94005ba9f3feae0 + docChecksum: 02b620e2b0d8bdd8549db51aca567f5f docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.4 - configChecksum: 4bdce4423724fbc3e27157c1593f7b74 + releaseVersion: 0.11.5 + configChecksum: f28e8188849380aa0a7f85e8f7a7b56b repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 050680d0-830b-4b43-af34-44a6c0807b04 - pristine_commit_hash: 7115aa4a60edab70391136ff35b553ee7d958e42 - pristine_tree_hash: 361cb3b699fe64a78518445b7184f4a488605777 + generation_id: e2e043b1-62f4-438f-b245-7cab5d751e0c + pristine_commit_hash: 8dd3e23eae951172cfc444a51ce8d2d4a6f58c1d + pristine_tree_hash: cf3fe64dfa8a4412bd45a69bd3fe391c3b4f9b3e features: python: acceptHeaders: 3.0.0 @@ -5678,12 +5678,12 @@ trackedFiles: pristine_git_object: e6beafcf11154033e2951ae58103041a2af946b9 docs/operations/getmodelsrequest.mdx: id: b2627beb1959 - last_write_checksum: sha1:d945628c6bc1fdad3b7732e0fbcefc241bd373c6 - pristine_git_object: 272e1449f6b0895e9311ba2f03c05edbf17dc225 + last_write_checksum: sha1:f632f852d2575a081418c25c4ae1c5f8f4785ff2 + pristine_git_object: 3cf889e3b06877fa5948f307c334468ed1832d3c docs/operations/getmodelssort.mdx: id: 3cfd33e60661 - last_write_checksum: sha1:0cc94491120ca9b9a92ac5d6181a51131d78b94c - pristine_git_object: 9a5681eb1112bdb27c7c6677b74a17ff2fb0a574 + last_write_checksum: sha1:6d75758523f8665ff617fe5d4e54385ad785c7ef + pristine_git_object: 537a70d3eb590cda229847689553607b46a3a5f7 docs/operations/getobservabilitydestinationglobals.mdx: id: d7ba84a5b9dc last_write_checksum: sha1:281603c38cce8aea9f289fc0d49a455b56196e2e @@ -6350,8 +6350,8 @@ trackedFiles: pristine_git_object: 77f3172dabafbaa192b258382074cb34cfd55a5e docs/sdks/models/README.mdx: id: 58f1ca464e0b - last_write_checksum: sha1:13cd9e4631b4e19a7db5ad93ce63d66358ffb935 - pristine_git_object: cc84c8d7382e6cee53ceb625344dadeefbb48b5d + last_write_checksum: sha1:2a8e7baeb6586e3b46d4da14c1e4701e4625ee7d + pristine_git_object: 888dcaa7005c439f2c0e5e0736ba8f78fc42a8db docs/sdks/oauth/README.mdx: id: 42b5079343d2 last_write_checksum: sha1:60ecae1338bc4487fbb050b6044ddc08dd7d1685 @@ -6402,8 +6402,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:e63ee1edc31eba7748772e0f9d9f1239abe84b72 - pristine_git_object: 63126319baf5f2bd6c915b590f02eb5b4b8cb1e1 + last_write_checksum: sha1:357cd9edeb39cbbbf958df143408cf75b672cb77 + pristine_git_object: 042b3b370f33071d6b8b72919698f4c426d532d6 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6430,8 +6430,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:55bbac3c115b285a81d9826cc0f69c37e1195456 - pristine_git_object: 578264d267742981dc5c7268ff378621572831dd + last_write_checksum: sha1:23b5383ef6d4c88095f0bd2ffce66cdd0dad13e4 + pristine_git_object: a9687477f7ab9961c862a708ec091f94182db944 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -8738,8 +8738,8 @@ trackedFiles: pristine_git_object: 5b741456655ff48919d17ffd552a6410f0587966 src/openrouter/models_.py: id: 4e1ae1fe5b98 - last_write_checksum: sha1:3c9aa7ec25ebd7cf7eb43a4d31cab845658fd484 - pristine_git_object: 02dd1c2072829766214cfdbcb9a3eb098f282e33 + last_write_checksum: sha1:7b5b5454677f47a3a0fbfeff8c084ecd569a95b9 + pristine_git_object: 0379827532be6069ef8a592771c01c1e44219636 src/openrouter/oauth.py: id: 1948ce27255b last_write_checksum: sha1:8d6ba30594d5674164f045d6655914b801268f72 @@ -8926,8 +8926,8 @@ trackedFiles: pristine_git_object: d5a47b01285b12f05d46240e253a934be63f0a00 src/openrouter/operations/getmodels.py: id: 5bd5dfcb0125 - last_write_checksum: sha1:6d13fdf573bd5a4ff65484e3358d36d5f5e17a7d - pristine_git_object: af887b941b69db369b1623fd2a19abeef6ef967d + last_write_checksum: sha1:3501eb6dccdf4bf3dc52d2228b5906be95481470 + pristine_git_object: dc16709a2472ddaf838eaa21ffda7be17f7dd0f2 src/openrouter/operations/getobservabilitydestination.py: id: 15b49f22aca9 last_write_checksum: sha1:351b050b646c9e2dbffaf27633cbd38b30047169 @@ -10706,4 +10706,6 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.stt.create_transcription_multipart()`: **Added**\n* `open_router.beta.responses.send()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.chat.send()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.plugins[].union(pareto-router).price_source` **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.models.list()`: `request` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index abe3ec9..0ffe5f7 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.4 + version: 0.11.5 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 47f2f0b..a7062da 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -30112,13 +30112,13 @@ paths: example: text type: string - description: >- - Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. + Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. in: query name: sort required: false schema: description: >- - Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. + Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. enum: - most-popular - newest @@ -30129,6 +30129,8 @@ paths: - throughput-high-to-low - latency-low-to-high - intelligence-high-to-low + - coding-high-to-low + - agentic-high-to-low - design-arena-elo-high-to-low example: newest type: string @@ -30235,6 +30237,130 @@ paths: - eu example: eu type: string + - description: Minimum completion (output) price in $/M tokens. + in: query + name: min_output_price + required: false + schema: + description: Minimum completion (output) price in $/M tokens. + example: 0 + minimum: 0 + nullable: true + type: number + - description: Maximum completion (output) price in $/M tokens. + in: query + name: max_output_price + required: false + schema: + description: Maximum completion (output) price in $/M tokens. + example: 10 + minimum: 0 + nullable: true + type: number + - description: Minimum model age in days since its creation date. + in: query + name: min_age_days + required: false + schema: + description: Minimum model age in days since its creation date. + example: 0 + minimum: 0 + nullable: true + type: integer + - description: Maximum model age in days since its creation date. + in: query + name: max_age_days + required: false + schema: + description: Maximum model age in days since its creation date. + example: 90 + minimum: 0 + nullable: true + type: integer + - description: Minimum Artificial Analysis intelligence index. + in: query + name: min_intelligence_index + required: false + schema: + description: Minimum Artificial Analysis intelligence index. + example: 50 + minimum: 0 + nullable: true + type: number + - description: Maximum Artificial Analysis intelligence index. + in: query + name: max_intelligence_index + required: false + schema: + description: Maximum Artificial Analysis intelligence index. + example: 100 + minimum: 0 + nullable: true + type: number + - description: Minimum Artificial Analysis coding index. + in: query + name: min_coding_index + required: false + schema: + description: Minimum Artificial Analysis coding index. + example: 50 + minimum: 0 + nullable: true + type: number + - description: Maximum Artificial Analysis coding index. + in: query + name: max_coding_index + required: false + schema: + description: Maximum Artificial Analysis coding index. + example: 100 + minimum: 0 + nullable: true + type: number + - description: Minimum Artificial Analysis agentic index. + in: query + name: min_agentic_index + required: false + schema: + description: Minimum Artificial Analysis agentic index. + example: 50 + minimum: 0 + nullable: true + type: number + - description: Maximum Artificial Analysis agentic index. + in: query + name: max_agentic_index + required: false + schema: + description: Maximum Artificial Analysis agentic index. + example: 100 + minimum: 0 + nullable: true + type: number + - description: >- + Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason). + in: query + name: min_tool_success_rate + required: false + schema: + description: >- + Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason). + example: 0.9 + maximum: 1 + minimum: 0 + nullable: true + type: number + - description: Maximum tool-calling success rate, as a fraction in [0, 1]. + in: query + name: max_tool_success_rate + required: false + schema: + description: Maximum tool-calling success rate, as a fraction in [0, 1]. + example: 1 + maximum: 1 + minimum: 0 + nullable: true + type: number responses: '200': content: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 38cf9a5..f85efa0 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:d2c2c3e13ad669361c25f68fad9ec7eecb75ce8225fe04163163192c1c7fe1f6 - sourceBlobDigest: sha256:22a034c7168faf862dc49ec1eb11cabe3f7b5405fffae3881c02000a4f0ec55b + sourceRevisionDigest: sha256:aba0fa7083fc84520a6b33a28d83672fe37eaa65e185f219182d1c9a6d399fbf + sourceBlobDigest: sha256:00a46b5dabf8ed3c27462f8c598ec592f277efd014c855e45e76c3bde1910cf0 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:d2c2c3e13ad669361c25f68fad9ec7eecb75ce8225fe04163163192c1c7fe1f6 - sourceBlobDigest: sha256:22a034c7168faf862dc49ec1eb11cabe3f7b5405fffae3881c02000a4f0ec55b + sourceRevisionDigest: sha256:aba0fa7083fc84520a6b33a28d83672fe37eaa65e185f219182d1c9a6d399fbf + sourceBlobDigest: sha256:00a46b5dabf8ed3c27462f8c598ec592f277efd014c855e45e76c3bde1910cf0 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:9b19c83c1b20193106f585b755a4d639540a4884675a9336cdf199776093c4bc + codeSamplesRevisionDigest: sha256:abe985d8f0f446be27118dc7f14238c90bdbd3d5e5810729a114378554d481b5 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index c2bff2d..d3d9d46 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -148,4 +148,14 @@ Based on: ### Generated - [python v0.11.4] . ### Releases -- [PyPI v0.11.4] https://pypi.org/project/openrouter/0.11.4 - . \ No newline at end of file +- [PyPI v0.11.4] https://pypi.org/project/openrouter/0.11.4 - . + +## 2026-07-07 17:24:44 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.5] . +### Releases +- [PyPI v0.11.5] https://pypi.org/project/openrouter/0.11.5 - . \ No newline at end of file diff --git a/docs/operations/getmodelsrequest.mdx b/docs/operations/getmodelsrequest.mdx index 272e144..3cf889e 100644 --- a/docs/operations/getmodelsrequest.mdx +++ b/docs/operations/getmodelsrequest.mdx @@ -4,23 +4,35 @@ title: "GetModelsRequest" ## 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.
| | -| `category` | [Optional[operations.GetModelsCategory]](../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | -| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | -| `sort` | [Optional[operations.GetModelsSort]](../operations/getmodelssort.mdx) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | -| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | -| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | -| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 | -| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 | -| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 | -| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT | -| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic | -| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic | -| `distillable` | [Optional[operations.Distillable]](../operations/distillable.mdx) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true | -| `zdr` | [Optional[operations.Zdr]](../operations/zdr.mdx) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true | -| `region` | [Optional[operations.Region]](../operations/region.mdx) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu | \ No newline at end of file +| 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.
| | +| `category` | [Optional[operations.GetModelsCategory]](../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | +| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | +| `sort` | [Optional[operations.GetModelsSort]](../operations/getmodelssort.mdx) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | +| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | +| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | +| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 | +| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 | +| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 | +| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT | +| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic | +| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic | +| `distillable` | [Optional[operations.Distillable]](../operations/distillable.mdx) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true | +| `zdr` | [Optional[operations.Zdr]](../operations/zdr.mdx) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true | +| `region` | [Optional[operations.Region]](../operations/region.mdx) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu | +| `min_output_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum completion (output) price in $/M tokens. | 0 | +| `max_output_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum completion (output) price in $/M tokens. | 10 | +| `min_age_days` | *OptionalNullable[int]* | :heavy_minus_sign: | Minimum model age in days since its creation date. | 0 | +| `max_age_days` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum model age in days since its creation date. | 90 | +| `min_intelligence_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum Artificial Analysis intelligence index. | 50 | +| `max_intelligence_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum Artificial Analysis intelligence index. | 100 | +| `min_coding_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum Artificial Analysis coding index. | 50 | +| `max_coding_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum Artificial Analysis coding index. | 100 | +| `min_agentic_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum Artificial Analysis agentic index. | 50 | +| `max_agentic_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum Artificial Analysis agentic index. | 100 | +| `min_tool_success_rate` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason). | 0.9 | +| `max_tool_success_rate` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tool-calling success rate, as a fraction in [0, 1]. | 1 | \ No newline at end of file diff --git a/docs/operations/getmodelssort.mdx b/docs/operations/getmodelssort.mdx index 9a5681e..537a70d 100644 --- a/docs/operations/getmodelssort.mdx +++ b/docs/operations/getmodelssort.mdx @@ -2,7 +2,7 @@ title: "GetModelsSort" --- -Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. +Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. ## Example Usage @@ -27,4 +27,6 @@ This is an open enum. Unrecognized values will not fail type checks. - `"throughput-high-to-low"` - `"latency-low-to-high"` - `"intelligence-high-to-low"` +- `"coding-high-to-low"` +- `"agentic-high-to-low"` - `"design-arena-elo-high-to-low"` diff --git a/docs/sdks/models/README.mdx b/docs/sdks/models/README.mdx index cc84c8d..888dcaa 100644 --- a/docs/sdks/models/README.mdx +++ b/docs/sdks/models/README.mdx @@ -89,27 +89,39 @@ with OpenRouter( ### Parameters -| Parameter | 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.
| | -| `category` | [Optional[operations.GetModelsCategory]](../../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | -| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | -| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | -| `sort` | [Optional[operations.GetModelsSort]](../../operations/getmodelssort.mdx) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | -| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | -| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | -| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 | -| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 | -| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 | -| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT | -| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic | -| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic | -| `distillable` | [Optional[operations.Distillable]](../../operations/distillable.mdx) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true | -| `zdr` | [Optional[operations.Zdr]](../../operations/zdr.mdx) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true | -| `region` | [Optional[operations.Region]](../../operations/region.mdx) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | 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.
| | +| `category` | [Optional[operations.GetModelsCategory]](../../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | +| `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | +| `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | +| `sort` | [Optional[operations.GetModelsSort]](../../operations/getmodelssort.mdx) | :heavy_minus_sign: | Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. | newest | +| `q` | *Optional[str]* | :heavy_minus_sign: | Free-text search by model name or slug. | gpt-4 | +| `input_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by input modality. Comma-separated list of: text, image, audio, file. | text,image | +| `context` | *Optional[int]* | :heavy_minus_sign: | Minimum context length (tokens). Models with smaller context are excluded. | 128000 | +| `min_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum prompt price in $/M tokens. | 0 | +| `max_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum prompt price in $/M tokens. | 10 | +| `arch` | *Optional[str]* | :heavy_minus_sign: | Filter models by architecture/model family (e.g. GPT, Claude, Gemini, Llama). | GPT | +| `model_authors` | *Optional[str]* | :heavy_minus_sign: | Filter models by the organization that created the model. Comma-separated list of author slugs. | openai,anthropic | +| `providers` | *Optional[str]* | :heavy_minus_sign: | Filter models by hosting provider. Comma-separated list of provider names. | OpenAI,Anthropic | +| `distillable` | [Optional[operations.Distillable]](../../operations/distillable.mdx) | :heavy_minus_sign: | Filter by distillation capability. "true" returns only distillable models, "false" excludes them. | true | +| `zdr` | [Optional[operations.Zdr]](../../operations/zdr.mdx) | :heavy_minus_sign: | When set to "true", return only models with zero data retention endpoints. | true | +| `region` | [Optional[operations.Region]](../../operations/region.mdx) | :heavy_minus_sign: | Filter to models with endpoints in the given data region. Currently only "eu" is supported. | eu | +| `min_output_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum completion (output) price in $/M tokens. | 0 | +| `max_output_price` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum completion (output) price in $/M tokens. | 10 | +| `min_age_days` | *OptionalNullable[int]* | :heavy_minus_sign: | Minimum model age in days since its creation date. | 0 | +| `max_age_days` | *OptionalNullable[int]* | :heavy_minus_sign: | Maximum model age in days since its creation date. | 90 | +| `min_intelligence_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum Artificial Analysis intelligence index. | 50 | +| `max_intelligence_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum Artificial Analysis intelligence index. | 100 | +| `min_coding_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum Artificial Analysis coding index. | 50 | +| `max_coding_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum Artificial Analysis coding index. | 100 | +| `min_agentic_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum Artificial Analysis agentic index. | 50 | +| `max_agentic_index` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum Artificial Analysis agentic index. | 100 | +| `min_tool_success_rate` | *OptionalNullable[float]* | :heavy_minus_sign: | Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason). | 0.9 | +| `max_tool_success_rate` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tool-calling success rate, as a fraction in [0, 1]. | 1 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index 6312631..042b3b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.4" +version = "0.11.5" 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 578264d..a968747 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.4" +__version__: str = "0.11.5" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.4 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.5 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index 02dd1c2..0379827 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -285,6 +285,18 @@ class Models(BaseSDK): distillable: Optional[operations.Distillable] = None, zdr: Optional[operations.Zdr] = None, region: Optional[operations.Region] = None, + min_output_price: OptionalNullable[float] = UNSET, + max_output_price: OptionalNullable[float] = UNSET, + min_age_days: OptionalNullable[int] = UNSET, + max_age_days: OptionalNullable[int] = UNSET, + min_intelligence_index: OptionalNullable[float] = UNSET, + max_intelligence_index: OptionalNullable[float] = UNSET, + min_coding_index: OptionalNullable[float] = UNSET, + max_coding_index: OptionalNullable[float] = UNSET, + min_agentic_index: OptionalNullable[float] = UNSET, + max_agentic_index: OptionalNullable[float] = UNSET, + min_tool_success_rate: OptionalNullable[float] = UNSET, + max_tool_success_rate: OptionalNullable[float] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -302,7 +314,7 @@ class Models(BaseSDK): :param category: Filter models by use case category :param supported_parameters: Filter models by supported parameter (comma-separated) :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". - :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. + :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. :param q: Free-text search by model name or slug. :param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file. :param context: Minimum context length (tokens). Models with smaller context are excluded. @@ -314,6 +326,18 @@ class Models(BaseSDK): :param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them. :param zdr: When set to \"true\", return only models with zero data retention endpoints. :param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported. + :param min_output_price: Minimum completion (output) price in $/M tokens. + :param max_output_price: Maximum completion (output) price in $/M tokens. + :param min_age_days: Minimum model age in days since its creation date. + :param max_age_days: Maximum model age in days since its creation date. + :param min_intelligence_index: Minimum Artificial Analysis intelligence index. + :param max_intelligence_index: Maximum Artificial Analysis intelligence index. + :param min_coding_index: Minimum Artificial Analysis coding index. + :param max_coding_index: Maximum Artificial Analysis coding index. + :param min_agentic_index: Minimum Artificial Analysis agentic index. + :param max_agentic_index: Maximum Artificial Analysis agentic index. + :param min_tool_success_rate: Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason). + :param max_tool_success_rate: Maximum tool-calling success rate, as a fraction in [0, 1]. :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 @@ -348,6 +372,18 @@ class Models(BaseSDK): distillable=distillable, zdr=zdr, region=region, + min_output_price=min_output_price, + max_output_price=max_output_price, + min_age_days=min_age_days, + max_age_days=max_age_days, + min_intelligence_index=min_intelligence_index, + max_intelligence_index=max_intelligence_index, + min_coding_index=min_coding_index, + max_coding_index=max_coding_index, + min_agentic_index=min_agentic_index, + max_agentic_index=max_agentic_index, + min_tool_success_rate=min_tool_success_rate, + max_tool_success_rate=max_tool_success_rate, ) req = self._build_request( @@ -448,6 +484,18 @@ class Models(BaseSDK): distillable: Optional[operations.Distillable] = None, zdr: Optional[operations.Zdr] = None, region: Optional[operations.Region] = None, + min_output_price: OptionalNullable[float] = UNSET, + max_output_price: OptionalNullable[float] = UNSET, + min_age_days: OptionalNullable[int] = UNSET, + max_age_days: OptionalNullable[int] = UNSET, + min_intelligence_index: OptionalNullable[float] = UNSET, + max_intelligence_index: OptionalNullable[float] = UNSET, + min_coding_index: OptionalNullable[float] = UNSET, + max_coding_index: OptionalNullable[float] = UNSET, + min_agentic_index: OptionalNullable[float] = UNSET, + max_agentic_index: OptionalNullable[float] = UNSET, + min_tool_success_rate: OptionalNullable[float] = UNSET, + max_tool_success_rate: OptionalNullable[float] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -465,7 +513,7 @@ class Models(BaseSDK): :param category: Filter models by use case category :param supported_parameters: Filter models by supported parameter (comma-separated) :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". - :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. + :param sort: Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved. :param q: Free-text search by model name or slug. :param input_modalities: Filter models by input modality. Comma-separated list of: text, image, audio, file. :param context: Minimum context length (tokens). Models with smaller context are excluded. @@ -477,6 +525,18 @@ class Models(BaseSDK): :param distillable: Filter by distillation capability. \"true\" returns only distillable models, \"false\" excludes them. :param zdr: When set to \"true\", return only models with zero data retention endpoints. :param region: Filter to models with endpoints in the given data region. Currently only \"eu\" is supported. + :param min_output_price: Minimum completion (output) price in $/M tokens. + :param max_output_price: Maximum completion (output) price in $/M tokens. + :param min_age_days: Minimum model age in days since its creation date. + :param max_age_days: Maximum model age in days since its creation date. + :param min_intelligence_index: Minimum Artificial Analysis intelligence index. + :param max_intelligence_index: Maximum Artificial Analysis intelligence index. + :param min_coding_index: Minimum Artificial Analysis coding index. + :param max_coding_index: Maximum Artificial Analysis coding index. + :param min_agentic_index: Minimum Artificial Analysis agentic index. + :param max_agentic_index: Maximum Artificial Analysis agentic index. + :param min_tool_success_rate: Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason). + :param max_tool_success_rate: Maximum tool-calling success rate, as a fraction in [0, 1]. :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 @@ -511,6 +571,18 @@ class Models(BaseSDK): distillable=distillable, zdr=zdr, region=region, + min_output_price=min_output_price, + max_output_price=max_output_price, + min_age_days=min_age_days, + max_age_days=max_age_days, + min_intelligence_index=min_intelligence_index, + max_intelligence_index=max_intelligence_index, + min_coding_index=min_coding_index, + max_coding_index=max_coding_index, + min_agentic_index=min_agentic_index, + max_agentic_index=max_agentic_index, + min_tool_success_rate=min_tool_success_rate, + max_tool_success_rate=max_tool_success_rate, ) req = self._build_request_async( diff --git a/src/openrouter/operations/getmodels.py b/src/openrouter/operations/getmodels.py index af887b9..dc16709 100644 --- a/src/openrouter/operations/getmodels.py +++ b/src/openrouter/operations/getmodels.py @@ -111,11 +111,13 @@ GetModelsSort = Union[ "throughput-high-to-low", "latency-low-to-high", "intelligence-high-to-low", + "coding-high-to-low", + "agentic-high-to-low", "design-arena-elo-high-to-low", ], UnrecognizedStr, ] -r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" +r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" Distillable = Union[ @@ -157,7 +159,7 @@ class GetModelsRequestTypedDict(TypedDict): output_modalities: NotRequired[str] r"""Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".""" sort: NotRequired[GetModelsSort] - r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" + r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" q: NotRequired[str] r"""Free-text search by model name or slug.""" input_modalities: NotRequired[str] @@ -180,6 +182,30 @@ class GetModelsRequestTypedDict(TypedDict): r"""When set to \"true\", return only models with zero data retention endpoints.""" region: NotRequired[Region] r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.""" + min_output_price: NotRequired[Nullable[float]] + r"""Minimum completion (output) price in $/M tokens.""" + max_output_price: NotRequired[Nullable[float]] + r"""Maximum completion (output) price in $/M tokens.""" + min_age_days: NotRequired[Nullable[int]] + r"""Minimum model age in days since its creation date.""" + max_age_days: NotRequired[Nullable[int]] + r"""Maximum model age in days since its creation date.""" + min_intelligence_index: NotRequired[Nullable[float]] + r"""Minimum Artificial Analysis intelligence index.""" + max_intelligence_index: NotRequired[Nullable[float]] + r"""Maximum Artificial Analysis intelligence index.""" + min_coding_index: NotRequired[Nullable[float]] + r"""Minimum Artificial Analysis coding index.""" + max_coding_index: NotRequired[Nullable[float]] + r"""Maximum Artificial Analysis coding index.""" + min_agentic_index: NotRequired[Nullable[float]] + r"""Minimum Artificial Analysis agentic index.""" + max_agentic_index: NotRequired[Nullable[float]] + r"""Maximum Artificial Analysis agentic index.""" + min_tool_success_rate: NotRequired[Nullable[float]] + r"""Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason).""" + max_tool_success_rate: NotRequired[Nullable[float]] + r"""Maximum tool-calling success rate, as a fraction in [0, 1].""" class GetModelsRequest(BaseModel): @@ -233,7 +259,7 @@ class GetModelsRequest(BaseModel): Optional[GetModelsSort], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None - r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low (Artificial Analysis intelligence index), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" + r"""Sort the returned models server-side. Prefer this over fetching the full list and sorting client-side. Options: pricing-low-to-high, pricing-high-to-low (average prompt/completion price), context-high-to-low (context length), throughput-high-to-low, latency-low-to-high (recent median performance), most-popular, top-weekly (tokens processed in the last week), newest (creation date), intelligence-high-to-low, coding-high-to-low, agentic-high-to-low (Artificial Analysis indices), design-arena-elo-high-to-low (best Design Arena ELO across arenas). Models without a score for the chosen benchmark are placed last. When omitted, the existing default ordering is preserved.""" q: Annotated[ Optional[str], @@ -301,6 +327,78 @@ class GetModelsRequest(BaseModel): ] = None r"""Filter to models with endpoints in the given data region. Currently only \"eu\" is supported.""" + min_output_price: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Minimum completion (output) price in $/M tokens.""" + + max_output_price: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Maximum completion (output) price in $/M tokens.""" + + min_age_days: Annotated[ + OptionalNullable[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Minimum model age in days since its creation date.""" + + max_age_days: Annotated[ + OptionalNullable[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Maximum model age in days since its creation date.""" + + min_intelligence_index: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Minimum Artificial Analysis intelligence index.""" + + max_intelligence_index: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Maximum Artificial Analysis intelligence index.""" + + min_coding_index: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Minimum Artificial Analysis coding index.""" + + max_coding_index: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Maximum Artificial Analysis coding index.""" + + min_agentic_index: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Minimum Artificial Analysis agentic index.""" + + max_agentic_index: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Maximum Artificial Analysis agentic index.""" + + min_tool_success_rate: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Minimum tool-calling success rate, as a fraction in [0, 1] (e.g. 0.9 = 90% of requests finishing with a tool_calls finish reason).""" + + max_tool_success_rate: Annotated[ + OptionalNullable[float], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Maximum tool-calling success rate, as a fraction in [0, 1].""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -323,9 +421,38 @@ class GetModelsRequest(BaseModel): "distillable", "zdr", "region", + "min_output_price", + "max_output_price", + "min_age_days", + "max_age_days", + "min_intelligence_index", + "max_intelligence_index", + "min_coding_index", + "max_coding_index", + "min_agentic_index", + "max_agentic_index", + "min_tool_success_rate", + "max_tool_success_rate", + ] + ) + nullable_fields = set( + [ + "min_price", + "max_price", + "min_output_price", + "max_output_price", + "min_age_days", + "max_age_days", + "min_intelligence_index", + "max_intelligence_index", + "min_coding_index", + "max_coding_index", + "min_agentic_index", + "max_agentic_index", + "min_tool_success_rate", + "max_tool_success_rate", ] ) - nullable_fields = set(["min_price", "max_price"]) serialized = handler(self) m = {} diff --git a/uv.lock b/uv.lock index cae74d0..7bb25ab 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.4" +version = "0.11.5" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 9ac997d8b8b424a173cd5ef856f1027f2c6d087c Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 19:07:39 +0000 Subject: [PATCH 07/62] chore: update OpenAPI spec from monorepo (#399) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 2f20817..824c5af 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -8357,7 +8357,8 @@ components: description: >- Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their - token allowance before producing visible text. When omitted, the provider's default applies. + token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to + 50000. example: 16384 type: integer max_tool_calls: From d18d840c52c689a23b3a1f4d850a7aeac0b39a32 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 19:13:32 +0000 Subject: [PATCH 08/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.6=20(#400)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 31 +++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 2 +- .speakeasy/workflow.lock | 10 +++--- RELEASES.md | 12 ++++++- docs/components/fusionservertoolconfig.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +-- .../components/fusionservertoolconfig.py | 4 +-- uv.lock | 2 +- 10 files changed, 39 insertions(+), 32 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index dd69158..b56149c 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: 02b620e2b0d8bdd8549db51aca567f5f + docChecksum: b2ef6dae450677f07521afea7e283080 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.5 - configChecksum: f28e8188849380aa0a7f85e8f7a7b56b + releaseVersion: 0.11.6 + configChecksum: cee05e5b61926388f1b13343d3324556 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: e2e043b1-62f4-438f-b245-7cab5d751e0c - pristine_commit_hash: 8dd3e23eae951172cfc444a51ce8d2d4a6f58c1d - pristine_tree_hash: cf3fe64dfa8a4412bd45a69bd3fe391c3b4f9b3e + generation_id: 1b9e2976-5e47-49bf-808c-135c466df479 + pristine_commit_hash: 893fb9bbf7f62d287ba9846d1bb62c5d9b977ab2 + pristine_tree_hash: 1541b6273a8dd9ad55e99f64a898845c555a84b6 features: python: acceptHeaders: 3.0.0 @@ -1934,8 +1934,8 @@ trackedFiles: pristine_git_object: 3c29bc4bd3bdf7037b9c3aa894180b8e4cae6098 docs/components/fusionservertoolconfig.mdx: id: 87976811b0c3 - last_write_checksum: sha1:dc0f4c3cd6409193662d17304c0dfc2eb28f6efb - pristine_git_object: 68527081664f78ec050036db30091158a08bd5b6 + last_write_checksum: sha1:99198fd63b66a6f465c444856fcfb35110f269fb + pristine_git_object: ec3ad69133064ba5a6911474a16a974a26963255 docs/components/fusionservertoolconfigeffort.mdx: id: f5ce0fbc94aa last_write_checksum: sha1:4ce09a069b4eeae41ac1531027cf97dc4139927f @@ -6402,8 +6402,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:357cd9edeb39cbbbf958df143408cf75b672cb77 - pristine_git_object: 042b3b370f33071d6b8b72919698f4c426d532d6 + last_write_checksum: sha1:3e14cbf5ff3840151bd6c7af58d44d62d4595384 + pristine_git_object: 501f0c59631a591f0359664dd63643e9f2f27553 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6430,8 +6430,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:23b5383ef6d4c88095f0bd2ffce66cdd0dad13e4 - pristine_git_object: a9687477f7ab9961c862a708ec091f94182db944 + last_write_checksum: sha1:227debe496eb6e581977ca65e0029cc6c638b46d + pristine_git_object: e8f04f546a8475289bce1c52654f0a09402a2dec src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -7326,8 +7326,8 @@ trackedFiles: pristine_git_object: 0015e263bbb2d817af89780610cc8f25ff852e73 src/openrouter/components/fusionservertoolconfig.py: id: 0d1d229c531f - last_write_checksum: sha1:c5575780c1be8d9c66c13298d00a93ff004d386a - pristine_git_object: 5803dc6d2b2c74d2b7270233aef9d90524dd8d53 + last_write_checksum: sha1:df3f862acbedb4f4b3ed8b3e35f04fdf804b943f + pristine_git_object: e89fc6db28423e964f76e352ec20aa78763a8649 src/openrouter/components/fusionsource.py: id: ce20a4a9f32f last_write_checksum: sha1:2141dd1dd9396035bf8070878c9ec945331514c8 @@ -10706,6 +10706,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.models.list()`: `request` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0ffe5f7..0cfd9cb 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.5 + version: 0.11.6 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index a7062da..58e804a 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -8313,7 +8313,7 @@ components: $ref: '#/components/schemas/AnthropicCacheControlDirective' max_completion_tokens: description: >- - Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies. + Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000. example: 16384 type: integer max_tool_calls: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index f85efa0..8b36336 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:aba0fa7083fc84520a6b33a28d83672fe37eaa65e185f219182d1c9a6d399fbf - sourceBlobDigest: sha256:00a46b5dabf8ed3c27462f8c598ec592f277efd014c855e45e76c3bde1910cf0 + sourceRevisionDigest: sha256:ae3b03ac140c2789ef39eddcb297b78e78540441ed22c9f4854e3fa75a6f391b + sourceBlobDigest: sha256:b6b2fd9a8e068d5e601bb5cae1e24b882a449f5f5147e5970e9dcbb0e47527cf tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:aba0fa7083fc84520a6b33a28d83672fe37eaa65e185f219182d1c9a6d399fbf - sourceBlobDigest: sha256:00a46b5dabf8ed3c27462f8c598ec592f277efd014c855e45e76c3bde1910cf0 + sourceRevisionDigest: sha256:ae3b03ac140c2789ef39eddcb297b78e78540441ed22c9f4854e3fa75a6f391b + sourceBlobDigest: sha256:b6b2fd9a8e068d5e601bb5cae1e24b882a449f5f5147e5970e9dcbb0e47527cf codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:abe985d8f0f446be27118dc7f14238c90bdbd3d5e5810729a114378554d481b5 + codeSamplesRevisionDigest: sha256:f296de4382641a2b6396f017c634185759e79bf0de91ab45e1b843bd5c609353 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index d3d9d46..60ce0fe 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -158,4 +158,14 @@ Based on: ### Generated - [python v0.11.5] . ### Releases -- [PyPI v0.11.5] https://pypi.org/project/openrouter/0.11.5 - . \ No newline at end of file +- [PyPI v0.11.5] https://pypi.org/project/openrouter/0.11.5 - . + +## 2026-07-07 19:09:09 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.6] . +### Releases +- [PyPI v0.11.6] https://pypi.org/project/openrouter/0.11.6 - . \ No newline at end of file diff --git a/docs/components/fusionservertoolconfig.mdx b/docs/components/fusionservertoolconfig.mdx index 6852708..ec3ad69 100644 --- a/docs/components/fusionservertoolconfig.mdx +++ b/docs/components/fusionservertoolconfig.mdx @@ -11,7 +11,7 @@ Configuration for the openrouter:fusion server tool. | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `analysis_models` | List[*str*] | :heavy_minus_sign: | Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion. | [
"~anthropic/claude-opus-latest",
"~openai/gpt-latest",
"~google/gemini-pro-latest"
] | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies. | 16384 | +| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000. | 16384 | | `max_tool_calls` | *Optional[int]* | :heavy_minus_sign: | Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16. | 12 | | `model` | *Optional[str]* | :heavy_minus_sign: | Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request. | ~anthropic/claude-opus-latest | | `reasoning` | [Optional[components.FusionServerToolConfigReasoning]](../components/fusionservertoolconfigreasoning.mdx) | :heavy_minus_sign: | Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking. | | diff --git a/pyproject.toml b/pyproject.toml index 042b3b3..501f0c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.5" +version = "0.11.6" 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 a968747..e8f04f5 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.5" +__version__: str = "0.11.6" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.5 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.6 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/fusionservertoolconfig.py b/src/openrouter/components/fusionservertoolconfig.py index 5803dc6..e89fc6d 100644 --- a/src/openrouter/components/fusionservertoolconfig.py +++ b/src/openrouter/components/fusionservertoolconfig.py @@ -100,7 +100,7 @@ class FusionServerToolConfigTypedDict(TypedDict): cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" max_completion_tokens: NotRequired[int] - r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies.""" + r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000.""" max_tool_calls: NotRequired[int] r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16.""" model: NotRequired[str] @@ -123,7 +123,7 @@ class FusionServerToolConfig(BaseModel): r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" max_completion_tokens: Optional[int] = None - r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies.""" + r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000.""" max_tool_calls: Optional[int] = None r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16.""" diff --git a/uv.lock b/uv.lock index 7bb25ab..2e847f0 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.5" +version = "0.11.6" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 2c673c0ca36b3c99a4f5aee52997444838a2f377 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 21:45:13 +0000 Subject: [PATCH 09/62] chore: update OpenAPI spec from monorepo (#401) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 267 ++++++++++++++++++++++++++++++++++++- 1 file changed, 266 insertions(+), 1 deletion(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 824c5af..e46daeb 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -20815,11 +20815,30 @@ components: options: $ref: '#/components/schemas/ProviderOptions' type: object + response_format: + description: >- + Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, + duration, and segment-level timestamps; only supported by OpenAI-compatible providers. + enum: + - json + - verbose_json + example: json + type: string temperature: description: Sampling temperature for transcription example: 0 format: double type: number + timestamp_granularities: + description: >- + Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level + timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless + response_format is "verbose_json". + example: + - segment + items: + $ref: '#/components/schemas/STTTimestampGranularity' + type: array required: - model - input_audio @@ -20835,6 +20854,24 @@ components: seconds: 9.2 total_tokens: 113 properties: + duration: + description: Duration of the input audio in seconds, present when response_format is verbose_json + example: 9.2 + format: double + type: number + language: + description: Detected or forced language, present when response_format is verbose_json + example: english + type: string + segments: + description: Timestamped transcript segments, present when response_format is verbose_json + items: + $ref: '#/components/schemas/STTSegment' + type: array + task: + description: The task performed, present when response_format is verbose_json + example: transcribe + type: string text: description: The transcribed text example: >- @@ -20843,9 +20880,87 @@ components: type: string usage: $ref: '#/components/schemas/STTUsage' + words: + description: Timestamped words, present when the provider returns word-level timestamps + items: + $ref: '#/components/schemas/STTWord' + type: array required: - text type: object + STTSegment: + description: A timestamped transcript segment, returned when response_format is verbose_json + example: + avg_logprob: -0.28 + compression_ratio: 1.13 + end: 3.2 + id: 0 + no_speech_prob: 0.01 + seek: 0 + start: 0 + temperature: 0 + text: Hello there. + tokens: + - 50364 + - 2425 + - 456 + properties: + avg_logprob: + description: Average log probability of the segment + format: double + type: number + compression_ratio: + description: Compression ratio of the segment + format: double + type: number + end: + description: Segment end time in seconds + example: 3.2 + format: double + type: number + id: + description: Segment index within the transcript + example: 0 + type: integer + no_speech_prob: + description: Probability the segment contains no speech + format: double + type: number + seek: + description: Seek offset of the segment + example: 0 + type: integer + start: + description: Segment start time in seconds + example: 0 + format: double + type: number + temperature: + description: Temperature used for the segment + format: double + type: number + text: + description: Transcribed text of the segment + example: Hello there. + type: string + tokens: + description: Token IDs of the segment + items: + type: integer + type: array + required: + - id + - start + - end + - text + type: object + STTTimestampGranularity: + description: A timestamp detail level for verbose_json transcription responses. + enum: + - word + - segment + example: word + type: string STTUsage: description: Aggregated usage statistics for the request example: @@ -20878,6 +20993,32 @@ components: example: 113 type: integer type: object + STTWord: + description: A timestamped word, returned when the provider includes word-level timestamps + example: + end: 0.4 + start: 0 + word: Hello + properties: + end: + description: Word end time in seconds + example: 0.4 + format: double + type: number + start: + description: Word start time in seconds + example: 0 + format: double + type: number + word: + description: The transcribed word + example: Hello + type: string + required: + - word + - start + - end + type: object SubagentNestedTool: additionalProperties: nullable: true @@ -23932,13 +24073,26 @@ paths: description: The model to use for transcription. type: string response_format: - description: The response format. Only "json" is supported. + description: >- + The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns + task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). enum: - json + - verbose_json type: string temperature: description: The sampling temperature. type: number + timestamp_granularities[]: + description: >- + Timestamp detail levels to include when response_format is "verbose_json". "word" additionally + returns word-level timestamps in the words array. + items: + enum: + - word + - segment + type: string + type: array required: - file - model @@ -25685,6 +25839,13 @@ paths: reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. + Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time + grain. `modality` and `context_bucket` narrow the exact dataset by output/input + modality (or tool-calling activity) and request context length. `category` and + `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are + weekly-grain estimates — they cannot be combined with each other or with the exact + filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -25725,6 +25886,110 @@ paths: example: '2026-05-11' pattern: ^\d{4}-\d{2}-\d{2}$ type: string + - description: >- + Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; + `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are + available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled + datasets `period=month` buckets each week by its week-start month, so totals are approximate at month + boundaries. + in: query + name: period + required: false + schema: + description: >- + Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; + `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are + available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled + datasets `period=month` buckets each week by its week-start month, so totals are approximate at month + boundaries. + enum: + - day + - week + - month + example: day + type: string + - description: >- + Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` + match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset + — cannot be combined with `category` or `language_type`. + in: query + name: modality + required: false + schema: + description: >- + Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / + `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. + Exact dataset — cannot be combined with `category` or `language_type`. + enum: + - text + - image + - image_output + - audio + - tool_calling + example: text + type: string + - description: >- + Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact + dataset — cannot be combined with `category` or `language_type`. + in: query + name: context_bucket + required: false + schema: + description: >- + Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). + Exact dataset — cannot be combined with `category` or `language_type`. + enum: + - 1K + - 10K + - 100K + - 1M + - 10M + example: 100K + type: string + - description: >- + Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, + so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic + past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + in: query + name: category + required: false + schema: + description: >- + Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled + dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include + traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + enum: + - programming + - roleplay + - marketing + - marketing/seo + - technology + - science + - translation + - legal + - finance + - health + - trivia + - academia + example: programming + type: string + - description: >- + Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled + dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include + traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + in: query + name: language_type + required: false + schema: + description: >- + Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled + dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include + traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + enum: + - natural + - programming + example: natural + type: string responses: '200': content: From d81cd563dbead47e3b1580c823cbbe709714220b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 21:50:31 +0000 Subject: [PATCH 10/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.7=20(#402)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 157 +++++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 249 +++++++++++++++++- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/speechrequest.mdx | 2 +- ...um.mdx => speechrequestresponseformat.mdx} | 6 +- docs/components/sttrequest.mdx | 16 +- docs/components/sttrequestresponseformat.mdx | 22 ++ docs/components/sttresponse.mdx | 7 +- docs/components/sttsegment.mdx | 21 ++ docs/components/stttimestampgranularity.mdx | 22 ++ docs/components/sttword.mdx | 14 + docs/operations/contextbucket.mdx | 25 ++ ...udiotranscriptionsmultipartrequestbody.mdx | 15 +- docs/operations/getrankingsdailycategory.mdx | 32 +++ docs/operations/getrankingsdailyrequest.mdx | 19 +- docs/operations/languagetype.mdx | 22 ++ docs/operations/modality.mdx | 25 ++ docs/operations/period.mdx | 23 ++ docs/operations/responseformat.mdx | 7 +- docs/operations/timestampgranularities.mdx | 20 ++ docs/sdks/datasets/README.mdx | 28 +- docs/sdks/stt/README.mdx | 47 ++-- docs/sdks/tts/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 22 +- src/openrouter/components/speechrequest.py | 6 +- src/openrouter/components/sttrequest.py | 35 ++- src/openrouter/components/sttresponse.py | 33 ++- src/openrouter/components/sttsegment.py | 91 +++++++ .../components/stttimestampgranularity.py | 15 ++ src/openrouter/components/sttword.py | 29 ++ src/openrouter/datasets.py | 44 ++++ src/openrouter/operations/__init__.py | 18 ++ .../createaudiotranscriptions_multipart.py | 40 ++- src/openrouter/operations/getrankingsdaily.py | 116 +++++++- src/openrouter/stt.py | 44 +++- src/openrouter/tts.py | 4 +- uv.lock | 2 +- 41 files changed, 1163 insertions(+), 147 deletions(-) rename docs/components/{responseformatenum.mdx => speechrequestresponseformat.mdx} (61%) create mode 100644 docs/components/sttrequestresponseformat.mdx create mode 100644 docs/components/sttsegment.mdx create mode 100644 docs/components/stttimestampgranularity.mdx create mode 100644 docs/components/sttword.mdx create mode 100644 docs/operations/contextbucket.mdx create mode 100644 docs/operations/getrankingsdailycategory.mdx create mode 100644 docs/operations/languagetype.mdx create mode 100644 docs/operations/modality.mdx create mode 100644 docs/operations/period.mdx create mode 100644 docs/operations/timestampgranularities.mdx create mode 100644 src/openrouter/components/sttsegment.py create mode 100644 src/openrouter/components/stttimestampgranularity.py create mode 100644 src/openrouter/components/sttword.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b56149c..cd1e4a2 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: b2ef6dae450677f07521afea7e283080 + docChecksum: 22a237d7f82bd54b7962d414a7957cab docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.6 - configChecksum: cee05e5b61926388f1b13343d3324556 + releaseVersion: 0.11.7 + configChecksum: c93a3c0cf8d2ef872726ed600df77d93 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 1b9e2976-5e47-49bf-808c-135c466df479 - pristine_commit_hash: 893fb9bbf7f62d287ba9846d1bb62c5d9b977ab2 - pristine_tree_hash: 1541b6273a8dd9ad55e99f64a898845c555a84b6 + generation_id: 83866999-be04-4ad2-861f-5cffd5108efe + pristine_commit_hash: db0868c88c2da5c28ffb08cad3a18c4693828be5 + pristine_tree_hash: 68d039d8cfa62fa2c70a096a924d2cd1823467f2 features: python: acceptHeaders: 3.0.0 @@ -4056,10 +4056,6 @@ trackedFiles: id: 9b8deacad550 last_write_checksum: sha1:2ca93510828412e375f9903be2c92bcefbacd177 pristine_git_object: 29709effcd49176f32b4b99f9a37ed1309231549 - docs/components/responseformatenum.mdx: - id: 60f6138df415 - last_write_checksum: sha1:b3d58b45db884f8b051be834701ee3166bfb13cc - pristine_git_object: 0b7c4b07a2162050d564e6947d060d1b22241817 docs/components/responsehealingplugin.mdx: id: 5bf9b8008e95 last_write_checksum: sha1:1aa7dc7146a93a215d275571233ee63902a6e155 @@ -4242,12 +4238,16 @@ trackedFiles: pristine_git_object: 5d617cac37f7b364f4dd0640246e97c34351d824 docs/components/speechrequest.mdx: id: 06e81b0433f6 - last_write_checksum: sha1:0c8b9aae49356145aa960740cd88e620b511ec6c - pristine_git_object: e984d1fcbbc242679fbd51f142bd9de711833a50 + last_write_checksum: sha1:f56d694567b45d6656c3bf4e84a19283d526014c + pristine_git_object: b16289c3fc9ba1db2880a5e3e6de9b747e2acdb8 docs/components/speechrequestprovider.mdx: id: 4f78ed0394c4 last_write_checksum: sha1:99d94c6b01dbd3e875c213584f97c7dca545a6a9 pristine_git_object: 3a95d19f4a88dbd0c96cec7cf53d9264927a3c0d + docs/components/speechrequestresponseformat.mdx: + id: bd09f77a4a90 + last_write_checksum: sha1:1b87242f33c6d22a08dd085d0ef41335ec2e9b0c + pristine_git_object: 9af8a5aa6a7c26f353f552d369b87debb045b7cd docs/components/speed.mdx: id: 4fd1f2823924 last_write_checksum: sha1:c6815d115b55b9409052f9d1d1d16bb1d7197763 @@ -4366,20 +4366,36 @@ trackedFiles: pristine_git_object: 70a2660b7c0bc35aed96124e1faa3852b3117054 docs/components/sttrequest.mdx: id: 6a5e33cf6dbe - last_write_checksum: sha1:6fefcb5b5dd513388709f62acee929cde6bfb8ee - pristine_git_object: 198ca47de64cf983930c58cc618d3ef8c15d74a8 + last_write_checksum: sha1:63f215311d23a63a59b65d2bc8d642005379730e + pristine_git_object: e81d9df15323bda23bdc67ac0703ca24e5a84175 docs/components/sttrequestprovider.mdx: id: d8b1bac8e745 last_write_checksum: sha1:e15551eddbe4c1f7c4515fa556d4873075512eea pristine_git_object: 5eebff082dc885ed94ec0e6ceed8446c2ca104ae + docs/components/sttrequestresponseformat.mdx: + id: ab58b1666609 + last_write_checksum: sha1:f0cbf9b5b35d8ef8c049a3b84c47f6c43778a00a + pristine_git_object: d016021a79783dfa11b1110edc231f49f45df4d0 docs/components/sttresponse.mdx: id: a421f69065a0 - last_write_checksum: sha1:3bf5f6d14c6e2586808ee5a0db3cd911af03ff7c - pristine_git_object: 9a61014568868a1f08581e5b7580feddaf379f8c + last_write_checksum: sha1:438935b5dcb2fb9cf44c74fff733133937286bff + pristine_git_object: 5868e50f86df62aae9952c94f98ebb33570efff1 + docs/components/sttsegment.mdx: + id: 7264ea9cdd57 + last_write_checksum: sha1:8a4996d6a483fdeee0899f6656ed6e5d69a4e159 + pristine_git_object: d0bcd9afe39262dd4297adb6fc618e984e1c209f + docs/components/stttimestampgranularity.mdx: + id: 2a365c57c3a1 + last_write_checksum: sha1:5932b36c214d97201f0cce0d0787203fed2baf4e + pristine_git_object: 3505a518e362a11e06a3c098eb31de2718ee1c04 docs/components/sttusage.mdx: id: 11bce3b257f6 last_write_checksum: sha1:a777bc390f180c1163612213633f2150a9566313 pristine_git_object: f0b56839c067ce29024888f689d379ed83f86ff4 + docs/components/sttword.mdx: + id: 665227ec6052 + last_write_checksum: sha1:e39fb80f3b8d02747142ab15631e4788810c366f + pristine_git_object: 994522a52060add3b501680d2be27546ded1dfe2 docs/components/subagentnestedtool.mdx: id: 12547a9efd5f last_write_checksum: sha1:9141ce608f42d2c53e89f0e8e108252227a7366f @@ -5180,6 +5196,10 @@ trackedFiles: id: 537b5f749941 last_write_checksum: sha1:49c12ecbb5dfd1da81be814c3e70baa9c249d432 pristine_git_object: 08e418f7bcf3cf8142171de78bedd0243bda6854 + docs/operations/contextbucket.mdx: + id: 2ab0b419379e + last_write_checksum: sha1:f3bcb4a33fc0d7d868762b459a838d1fdca99d28 + pristine_git_object: d24616128ffb2e8a3f1fc639235d8210dbeea107 docs/operations/costdetails.mdx: id: a5015273e58c last_write_checksum: sha1:90a330bfa37e208bcee6615af2ee7535c4416a26 @@ -5210,8 +5230,8 @@ trackedFiles: pristine_git_object: b5031668ec1156a4157609e4812b7a3937b802a2 docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx: id: 0550cc56c73a - last_write_checksum: sha1:c377fd998af4c7cb2bae44e1a41c3bce02367a18 - pristine_git_object: 70f754bbc14e7fe9754309837b419705c622dfb6 + last_write_checksum: sha1:c15b1a62c475511e194d9a5b7b2ed240e369a4d1 + pristine_git_object: 3054ebe9dc2b1c40dbac7a5b387a57a89c468bdc docs/operations/createaudiotranscriptionsrequest.mdx: id: 68a813383936 last_write_checksum: sha1:a3ad7e4691917927539d6c614788da7f4d6b4892 @@ -5708,14 +5728,18 @@ trackedFiles: id: 970105a3a642 last_write_checksum: sha1:001bb931da274741dca567c87c4149c11c5e67d1 pristine_git_object: c7cf40110dc4a82e2d4abdd06e98d9a28637a016 + docs/operations/getrankingsdailycategory.mdx: + id: 37dbd531ea7d + last_write_checksum: sha1:3c4ffc04da2558c3357a8759ba9984ea15b58db4 + pristine_git_object: a81ff4b55f28b6a1456eee9665809305a68e7ee1 docs/operations/getrankingsdailyglobals.mdx: id: 0f9fa155d24e last_write_checksum: sha1:b3f58d600e4791419b37f4a8ec65869d59424f41 pristine_git_object: 4bc1a2bf9e75dc1eaca4e1531a49dfbbea0dfb72 docs/operations/getrankingsdailyrequest.mdx: id: a83322d91eea - last_write_checksum: sha1:ee987639475df96010b6a2732ecf9c7b4cfd2472 - pristine_git_object: 1788b942b41cb5afa8bebb28c0387c2cc0381d50 + last_write_checksum: sha1:fd05c4e755a6ba4f6b41bb37856169ad1b14d927 + pristine_git_object: 04784a9f4a05fa7d473b532d4e881a6d45a64a10 docs/operations/gettaskclassificationsglobals.mdx: id: 14d0010b40f8 last_write_checksum: sha1:6c967e8855540035a6f70fa895ceea0c9caf1cdd @@ -5772,6 +5796,10 @@ trackedFiles: id: fa09ca81a05c last_write_checksum: sha1:6126fc355e98574f157b9b485ac850a0ec6f2a5e pristine_git_object: 2394952123e253a775bb81426d6ee2d49911e97b + docs/operations/languagetype.mdx: + id: fe52912b0ea7 + last_write_checksum: sha1:85897c7620d5c3725f610a496f4ceb485b9f5063 + pristine_git_object: 0d94d66d51eee4f9fc8d18fb42a32c91fb9c89ec docs/operations/listbyokkeysglobals.mdx: id: b77dfe46caab last_write_checksum: sha1:203cef2704a0493a98ae74994baf54dd7789b998 @@ -6076,6 +6104,10 @@ trackedFiles: id: 43ac1599200a last_write_checksum: sha1:cfb8efa24bc87017aff709963270c9b414bc3483 pristine_git_object: a1b3a3e10a8fc5042c341319692cb2a643cdd9fe + docs/operations/modality.mdx: + id: b6e20b489278 + last_write_checksum: sha1:7914d5e12a4b5a623f277722ae09e1e27d7d6a08 + pristine_git_object: 63f8e9856e57d9736628dcd45b24b6c5646f4a35 docs/operations/object.mdx: id: 6fa1fcf5620b last_write_checksum: sha1:3727111f1223b76f5a9f21c89fba6c59ea31d428 @@ -6096,6 +6128,10 @@ trackedFiles: id: 5465d93e546d last_write_checksum: sha1:5f10a8fd8a9a7b55fc023e33bc9250f4d801af35 pristine_git_object: 91c6769e0026aa486c3fb4a6672c3691b2a997aa + docs/operations/period.mdx: + id: 038d66aa4fc1 + last_write_checksum: sha1:f65e16f5901c128767ab047aaeb811430c2bce3e + pristine_git_object: a1fdee3160b2294a66e05f59cfd17382364c129c docs/operations/prompttokensdetails.mdx: id: 346b38e82e1c last_write_checksum: sha1:ece0f5c30ccaef159981265b3ac57381289e86b3 @@ -6138,8 +6174,8 @@ trackedFiles: pristine_git_object: 051bb4d1cdb3bdbcd87b29419a4a408f10bb1555 docs/operations/responseformat.mdx: id: 363fb8a0ddd6 - last_write_checksum: sha1:69ffb401451c435882706846f68465b58324f02f - pristine_git_object: 83b1634e4f243f00c539d436c9defb32eee0f466 + last_write_checksum: sha1:ce7d9ba61f903de7446102d09d412e5813d77f1b + pristine_git_object: b7f772318bb3da788acb989aba6067371db53634 docs/operations/result.mdx: id: b68db2e6b7af last_write_checksum: sha1:3ca42544567f285e78aa012de25ac52b5d082314 @@ -6176,6 +6212,10 @@ trackedFiles: id: 03a218211f06 last_write_checksum: sha1:3cdcfbfcdb71dcc17a0c3b4cd5704eac3718fa0f pristine_git_object: dc194bad92caf2afd0759830559be89a8bafe5a4 + docs/operations/timestampgranularities.mdx: + id: 6694d3af2ace + last_write_checksum: sha1:bc7319f009e4133e65cf476c1763b11fb6622ff9 + pristine_git_object: c783ad06042f710374b4702b3b63030a32e52180 docs/operations/typeimageurl.mdx: id: 66578c3ea6a5 last_write_checksum: sha1:e3275995c5351075e0c4082a161891cf710b8fdc @@ -6322,8 +6362,8 @@ trackedFiles: pristine_git_object: 414ae2830c58add7ad904cc9ffc5b46ed65058df docs/sdks/datasets/README.mdx: id: 15e5ab0183de - last_write_checksum: sha1:91e92cf17fa0a3a1729a8777bad701e69aeed404 - pristine_git_object: 9cdcae1f6c83a4b1918d00c221f619978967f490 + last_write_checksum: sha1:f716eecbda6e252e092fd559e4c68778b551d5c8 + pristine_git_object: ef43241cee60a329848e01772031d3f97e0f0d30 docs/sdks/embeddings/README.mdx: id: cd71581df291 last_write_checksum: sha1:627e1efaacb2a29cb97e9d184ead987d95008bed @@ -6382,12 +6422,12 @@ trackedFiles: pristine_git_object: 03281f8cf709ebb9a81700ade4cf9bc0db665eb6 docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 - last_write_checksum: sha1:b07ff598e0d3cf542021bff66790ce97ceef6686 - pristine_git_object: 4ca736501a4c14a79710585ab460ea224f95918d + last_write_checksum: sha1:a8e68ac2b0bb8640e01d962177b42ab47b24898b + pristine_git_object: 003f85994a515547fe80dcc316ccc19d81c5322d docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:8930237642313a1db6fdce5f7ea2b0680dc7c5ac - pristine_git_object: ece7fa92f85b1d8f702ecf2855f7267120d4efac + last_write_checksum: sha1:d28728db90dbab11f336d772b27544bb41ecceee + pristine_git_object: dca713aa3629e162924844de964be74e9b4ed081 docs/sdks/videogeneration/README.mdx: id: 9a8fa04c3872 last_write_checksum: sha1:7d3c54cf2daa98e25df18bc27cc4ca30b2b1f03f @@ -6402,8 +6442,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:3e14cbf5ff3840151bd6c7af58d44d62d4595384 - pristine_git_object: 501f0c59631a591f0359664dd63643e9f2f27553 + last_write_checksum: sha1:2ebe96d8a4d112652eb43405442cdd305b5527f2 + pristine_git_object: 0ab0806b589bf64862fa7b0d06cbf2febee38379 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6430,8 +6470,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:227debe496eb6e581977ca65e0029cc6c638b46d - pristine_git_object: e8f04f546a8475289bce1c52654f0a09402a2dec + last_write_checksum: sha1:7811cd9984f7915aab91893aa048ae2fed9e51ec + pristine_git_object: 56b8833781310b3e7c300631cc0e0a66f97efc4f src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6470,8 +6510,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:fd8a64c71c4edc63a92eec32343fef06f743dd1b - pristine_git_object: 6e6304237012f2f5eaa9d96e5fde8ee13bc7096d + last_write_checksum: sha1:67dca4a903421d2bf39474047c5953b2c4432d70 + pristine_git_object: 6fd499892576c4bff0ee51dc59e77b99ff239f7f src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8274,8 +8314,8 @@ trackedFiles: pristine_git_object: 418953ba7366a6015934bf8795178d79adb03b89 src/openrouter/components/speechrequest.py: id: 2a9400167112 - last_write_checksum: sha1:110111aca3452c99b2c8ae365956737d935ae5ba - pristine_git_object: cb7e1b2a4626b9424b4c4c564a084d1ad2f15b3d + last_write_checksum: sha1:c91c94e2cf165ea7fd12b8001094c537c8858c9c + pristine_git_object: f903339eaa5c31fa00f7aad4150d61dea0737dad src/openrouter/components/stopservertoolswhencondition.py: id: 2deeda4209ac last_write_checksum: sha1:581e0ee62776d42bf598b9f68b998faabfecd3ce @@ -8342,16 +8382,28 @@ trackedFiles: pristine_git_object: 76c4b466e22e57b34098b587e95cb358089dd87c src/openrouter/components/sttrequest.py: id: 5fb1d469e16e - last_write_checksum: sha1:04621e286373ed7b188a3c171f83c93cb89c67f1 - pristine_git_object: d5497b98e6de245a4839b80079bf673be05d70ae + last_write_checksum: sha1:2944becda4acc11da95aff5cfb967544b8b15d0a + pristine_git_object: ce7ba259743cba658a3e23c2ea212d0fcaf34ebf src/openrouter/components/sttresponse.py: id: 2dc8eb8daaca - last_write_checksum: sha1:31cb20245662006e6459e662152c80e97778d77f - pristine_git_object: 19ff065a62373dfe9e0c97842d4ee173a175f5b6 + last_write_checksum: sha1:36aff8c075a27f036d34f3970031a26aad99f804 + pristine_git_object: 61daeb24ef51df79db5fa62329f8d15d81d729d9 + src/openrouter/components/sttsegment.py: + id: f3439539736c + last_write_checksum: sha1:be08482dc37814ed812250622b4ecb346b31787a + pristine_git_object: 471a0806203bea27421e0681e4b48cda9ce23220 + src/openrouter/components/stttimestampgranularity.py: + id: d6f8b068026d + last_write_checksum: sha1:9d1aff48024b9ab1446a05784f9aeb33aebdcee4 + pristine_git_object: 30edd2ffd22cad78e4950c8751b8de3314909250 src/openrouter/components/sttusage.py: id: abe8329af787 last_write_checksum: sha1:4b7b79be71c2d1e392aef738a37d2d75f0bb29c4 pristine_git_object: 1feb5db4da1422d55744c5a4bb10eabda6c50c4f + src/openrouter/components/sttword.py: + id: b46ff7c5fa20 + last_write_checksum: sha1:69fc17c2b943ace9486b782f7250579ba8d454b0 + pristine_git_object: 020dd01249eb982b0e94f0c19748badf5287a31a src/openrouter/components/subagentnestedtool.py: id: 911a465973a0 last_write_checksum: sha1:beb2209144b032e109c4afe33f440728423d7594 @@ -8614,8 +8666,8 @@ trackedFiles: pristine_git_object: 791cdeba11d6c5e9e9381760fd8cd8ca86233b22 src/openrouter/datasets.py: id: 2378f80d1d6a - last_write_checksum: sha1:a2941625198705ff1585bb7e8ae7ba5c110d43e9 - pristine_git_object: 04200589b12afe8bf67a158b99c7b9c11e4dab5c + last_write_checksum: sha1:bcbf0eef58b4f26fc01ddd28c568fc361ccf8919 + pristine_git_object: 3d9437c8ce1bdc83d3703c4374cf10b1bcae5d71 src/openrouter/embeddings.py: id: 0374ace39067 last_write_checksum: sha1:bdfaf3f9ffa1e337c0cc62b5a956a53c7863f24d @@ -8750,8 +8802,8 @@ trackedFiles: pristine_git_object: a1dea9b45650cc42a6f60447c032fa46b102839a src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:86fa5bd8f963caf8257ef28d618202fdb56e0b8f - pristine_git_object: 737838dfcd39c8a590ca5058aeffb8fe85311665 + last_write_checksum: sha1:46a3dfac25ac1c3d774e37ec8df54f9ba9851e46 + pristine_git_object: ab9fa9e4793e73671cc752005123a482b51b506f src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -8786,8 +8838,8 @@ trackedFiles: pristine_git_object: 4e8414f223370bff1e4f060919f36f70da6ec40c src/openrouter/operations/createaudiotranscriptions_multipart.py: id: da07d463225a - last_write_checksum: sha1:340621e278cff6ac1537e4d7e3b2c116a4193ee8 - pristine_git_object: 2697d1e94c6a76e751575bc6f6f626f3e3149f3d + last_write_checksum: sha1:a267131b5e9d8803f51431bbbc96a29484e97f0b + pristine_git_object: ff5459ee49af5fabed9c5e9a68979b923a7c4e9b src/openrouter/operations/createauthkeyscode.py: id: 4253a437de22 last_write_checksum: sha1:874492b64266fcdc5a7f3cd988d71326b7796a5c @@ -8942,8 +8994,8 @@ trackedFiles: pristine_git_object: cbcc9abe2ab38d7e7bd3cbc79acfda4da6b630e0 src/openrouter/operations/getrankingsdaily.py: id: 61dd0325de08 - last_write_checksum: sha1:a5953f86dfb31e77024412d02cc56b7a485fdb76 - pristine_git_object: efa494faf3208ec621c97b156196a27b1c61b018 + last_write_checksum: sha1:352d2aeaebf68140c78343f31cc8ba344dc3d9ae + pristine_git_object: fb9267c75f1e40b75ad22f313c3c1028f026f657 src/openrouter/operations/gettaskclassifications.py: id: ba6156d68acf last_write_checksum: sha1:c569572d21aa766ac542d5c535208e8b1caae503 @@ -9134,12 +9186,12 @@ trackedFiles: pristine_git_object: 26433165a0b1c25d7bd3115b9b129b18f2dc9387 src/openrouter/stt.py: id: fc0c2f669423 - last_write_checksum: sha1:d9821e49378f4ceba290fcfd17f7c9b68311fecc - pristine_git_object: b5895f3b688cde2b19bcef498e4992761bbdd58d + last_write_checksum: sha1:22247925e3c44234947eadbd409603292d4f9efe + pristine_git_object: 4bcc6d0314a17f48bc9735e2720e5b0b5f4bca22 src/openrouter/tts.py: id: 5055d4b95f1d - last_write_checksum: sha1:727a19a0df768153cbe2d8351394a2e254f680ea - pristine_git_object: 68ae54d07c464e69738c16bebf77d06d0d7f2141 + last_write_checksum: sha1:1561bf5c436e6912dfde6bfec7516aa85e24db9c + pristine_git_object: 5ccc4b9bad1c3db1c901d7df2d7f8d7e2d12df57 src/openrouter/types/__init__.py: id: 5eab536205b7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -10706,3 +10758,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.stt.create_transcription()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.stt.create_transcription_multipart()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.datasets.get_rankings_daily()`: `request` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0cfd9cb..9d74094 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.6 + version: 0.11.7 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 58e804a..3fb0f9e 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -20687,11 +20687,28 @@ components: options: $ref: '#/components/schemas/ProviderOptions' type: object + response_format: + description: >- + Output format. "json" (default) returns { text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. + enum: + - json + - verbose_json + example: json + type: string + x-speakeasy-unknown-values: allow temperature: description: Sampling temperature for transcription example: 0 format: double type: number + timestamp_granularities: + description: >- + Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". + example: + - segment + items: + $ref: '#/components/schemas/STTTimestampGranularity' + type: array required: - model - input_audio @@ -20707,6 +20724,24 @@ components: seconds: 9.2 total_tokens: 113 properties: + duration: + description: Duration of the input audio in seconds, present when response_format is verbose_json + example: 9.2 + format: double + type: number + language: + description: Detected or forced language, present when response_format is verbose_json + example: english + type: string + segments: + description: Timestamped transcript segments, present when response_format is verbose_json + items: + $ref: '#/components/schemas/STTSegment' + type: array + task: + description: The task performed, present when response_format is verbose_json + example: transcribe + type: string text: description: The transcribed text example: >- @@ -20714,9 +20749,88 @@ components: type: string usage: $ref: '#/components/schemas/STTUsage' + words: + description: Timestamped words, present when the provider returns word-level timestamps + items: + $ref: '#/components/schemas/STTWord' + type: array required: - text type: object + STTSegment: + description: A timestamped transcript segment, returned when response_format is verbose_json + example: + avg_logprob: -0.28 + compression_ratio: 1.13 + end: 3.2 + id: 0 + no_speech_prob: 0.01 + seek: 0 + start: 0 + temperature: 0 + text: Hello there. + tokens: + - 50364 + - 2425 + - 456 + properties: + avg_logprob: + description: Average log probability of the segment + format: double + type: number + compression_ratio: + description: Compression ratio of the segment + format: double + type: number + end: + description: Segment end time in seconds + example: 3.2 + format: double + type: number + id: + description: Segment index within the transcript + example: 0 + type: integer + no_speech_prob: + description: Probability the segment contains no speech + format: double + type: number + seek: + description: Seek offset of the segment + example: 0 + type: integer + start: + description: Segment start time in seconds + example: 0 + format: double + type: number + temperature: + description: Temperature used for the segment + format: double + type: number + text: + description: Transcribed text of the segment + example: Hello there. + type: string + tokens: + description: Token IDs of the segment + items: + type: integer + type: array + required: + - id + - start + - end + - text + type: object + STTTimestampGranularity: + description: A timestamp detail level for verbose_json transcription responses. + enum: + - word + - segment + example: word + type: string + x-speakeasy-unknown-values: allow STTUsage: description: Aggregated usage statistics for the request example: @@ -20749,6 +20863,32 @@ components: example: 113 type: integer type: object + STTWord: + description: A timestamped word, returned when the provider includes word-level timestamps + example: + end: 0.4 + start: 0 + word: Hello + properties: + end: + description: Word end time in seconds + example: 0.4 + format: double + type: number + start: + description: Word start time in seconds + example: 0 + format: double + type: number + word: + description: The transcribed word + example: Hello + type: string + required: + - word + - start + - end + type: object SubagentNestedTool: additionalProperties: nullable: true @@ -23747,13 +23887,26 @@ paths: description: The model to use for transcription. type: string response_format: - description: The response format. Only "json" is supported. + description: >- + The response format. "json" (default) returns { text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). enum: - json + - verbose_json type: string + x-speakeasy-unknown-values: allow temperature: description: The sampling temperature. type: number + timestamp_granularities[]: + description: >- + Timestamp detail levels to include when response_format is "verbose_json". "word" additionally returns word-level timestamps in the words array. + items: + enum: + - word + - segment + type: string + x-speakeasy-unknown-values: allow + type: array required: - file - model @@ -25507,6 +25660,13 @@ paths: reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. + Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time + grain. `modality` and `context_bucket` narrow the exact dataset by output/input + modality (or tool-calling activity) and request context length. `category` and + `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are + weekly-grain estimates — they cannot be combined with each other or with the exact + filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -25541,6 +25701,93 @@ paths: example: '2026-05-11' pattern: ^\d{4}-\d{2}-\d{2}$ type: string + - description: >- + Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + in: query + name: period + required: false + schema: + description: >- + Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + enum: + - day + - week + - month + example: day + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + in: query + name: modality + required: false + schema: + description: >- + Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + enum: + - text + - image + - image_output + - audio + - tool_calling + example: text + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + in: query + name: context_bucket + required: false + schema: + description: >- + Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + enum: + - 1K + - 10K + - 100K + - 1M + - 10M + example: 100K + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + in: query + name: category + required: false + schema: + description: >- + Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + enum: + - programming + - roleplay + - marketing + - marketing/seo + - technology + - science + - translation + - legal + - finance + - health + - trivia + - academia + example: programming + type: string + x-speakeasy-unknown-values: allow + - description: >- + Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + in: query + name: language_type + required: false + schema: + description: >- + Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + enum: + - natural + - programming + example: natural + type: string + x-speakeasy-unknown-values: allow responses: '200': content: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8b36336..3c63cc8 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:ae3b03ac140c2789ef39eddcb297b78e78540441ed22c9f4854e3fa75a6f391b - sourceBlobDigest: sha256:b6b2fd9a8e068d5e601bb5cae1e24b882a449f5f5147e5970e9dcbb0e47527cf + sourceRevisionDigest: sha256:c76873ed773f59ce59af18cd48af7b5e704346cfea03fa8d2fa7fef96fdfb465 + sourceBlobDigest: sha256:e21ec1784f2b7eb1fe3fab59deb0148cc48ecd0f4835ef56502b7e808aab231c tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:ae3b03ac140c2789ef39eddcb297b78e78540441ed22c9f4854e3fa75a6f391b - sourceBlobDigest: sha256:b6b2fd9a8e068d5e601bb5cae1e24b882a449f5f5147e5970e9dcbb0e47527cf + sourceRevisionDigest: sha256:c76873ed773f59ce59af18cd48af7b5e704346cfea03fa8d2fa7fef96fdfb465 + sourceBlobDigest: sha256:e21ec1784f2b7eb1fe3fab59deb0148cc48ecd0f4835ef56502b7e808aab231c codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f296de4382641a2b6396f017c634185759e79bf0de91ab45e1b843bd5c609353 + codeSamplesRevisionDigest: sha256:ca16452a0a4478ea5a47dc4f2c60de4b9be28eab5156d58c8bf691ceabb6d742 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 60ce0fe..5764233 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -168,4 +168,14 @@ Based on: ### Generated - [python v0.11.6] . ### Releases -- [PyPI v0.11.6] https://pypi.org/project/openrouter/0.11.6 - . \ No newline at end of file +- [PyPI v0.11.6] https://pypi.org/project/openrouter/0.11.6 - . + +## 2026-07-07 21:46:35 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.7] . +### Releases +- [PyPI v0.11.7] https://pypi.org/project/openrouter/0.11.7 - . \ No newline at end of file diff --git a/docs/components/speechrequest.mdx b/docs/components/speechrequest.mdx index e984d1f..b16289c 100644 --- a/docs/components/speechrequest.mdx +++ b/docs/components/speechrequest.mdx @@ -12,6 +12,6 @@ Text-to-speech request input | `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | | `model` | *str* | :heavy_check_mark: | TTS model identifier | elevenlabs/eleven-turbo-v2 | | `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `response_format` | [Optional[components.ResponseFormatEnum]](../components/responseformatenum.mdx) | :heavy_minus_sign: | Audio output format | pcm | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | | `voice` | *str* | :heavy_check_mark: | Voice identifier (provider-specific). | alloy | \ No newline at end of file diff --git a/docs/components/responseformatenum.mdx b/docs/components/speechrequestresponseformat.mdx similarity index 61% rename from docs/components/responseformatenum.mdx rename to docs/components/speechrequestresponseformat.mdx index 0b7c4b0..9af8a5a 100644 --- a/docs/components/responseformatenum.mdx +++ b/docs/components/speechrequestresponseformat.mdx @@ -1,5 +1,5 @@ --- -title: "ResponseFormatEnum" +title: "SpeechRequestResponseFormat" --- Audio output format @@ -7,10 +7,10 @@ Audio output format ## Example Usage ```python -from openrouter.components import ResponseFormatEnum +from openrouter.components import SpeechRequestResponseFormat # Open enum: unrecognized values are captured as UnrecognizedStr -value: ResponseFormatEnum = "mp3" +value: SpeechRequestResponseFormat = "mp3" ``` diff --git a/docs/components/sttrequest.mdx b/docs/components/sttrequest.mdx index 198ca47..e81d9df 100644 --- a/docs/components/sttrequest.mdx +++ b/docs/components/sttrequest.mdx @@ -7,10 +7,12 @@ Speech-to-text request input. Accepts a JSON body with input_audio containing ba ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `input_audio` | [components.STTInputAudio](../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | -| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | -| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | -| `provider` | [Optional[components.STTRequestProvider]](../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input_audio` | [components.STTInputAudio](../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | +| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | +| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | +| `provider` | [Optional[components.STTRequestProvider]](../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `response_format` | [Optional[components.STTRequestResponseFormat]](../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | +| `timestamp_granularities` | List[[components.STTTimestampGranularity](../components/stttimestampgranularity.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". | [
"segment"
] | \ No newline at end of file diff --git a/docs/components/sttrequestresponseformat.mdx b/docs/components/sttrequestresponseformat.mdx new file mode 100644 index 0000000..d016021 --- /dev/null +++ b/docs/components/sttrequestresponseformat.mdx @@ -0,0 +1,22 @@ +--- +title: "STTRequestResponseFormat" +--- + +Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. + +## Example Usage + +```python +from openrouter.components import STTRequestResponseFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: STTRequestResponseFormat = "json" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"json"` +- `"verbose_json"` diff --git a/docs/components/sttresponse.mdx b/docs/components/sttresponse.mdx index 9a61014..5868e50 100644 --- a/docs/components/sttresponse.mdx +++ b/docs/components/sttresponse.mdx @@ -9,5 +9,10 @@ STT response containing transcribed text and optional usage statistics | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `duration` | *Optional[float]* | :heavy_minus_sign: | Duration of the input audio in seconds, present when response_format is verbose_json | 9.2 | +| `language` | *Optional[str]* | :heavy_minus_sign: | Detected or forced language, present when response_format is verbose_json | english | +| `segments` | List[[components.STTSegment](../components/sttsegment.mdx)] | :heavy_minus_sign: | Timestamped transcript segments, present when response_format is verbose_json | | +| `task` | *Optional[str]* | :heavy_minus_sign: | The task performed, present when response_format is verbose_json | transcribe | | `text` | *str* | :heavy_check_mark: | The transcribed text | Hello, this is a test of OpenAI speech-to-text transcription. The weather is sunny today and the temperature is around 72 degrees. | -| `usage` | [Optional[components.STTUsage]](../components/sttusage.mdx) | :heavy_minus_sign: | Aggregated usage statistics for the request | \{
"cost": 0.000508,
"input_tokens": 83,
"output_tokens": 30,
"seconds": 9.2,
"total_tokens": 113
} | \ No newline at end of file +| `usage` | [Optional[components.STTUsage]](../components/sttusage.mdx) | :heavy_minus_sign: | Aggregated usage statistics for the request | \{
"cost": 0.000508,
"input_tokens": 83,
"output_tokens": 30,
"seconds": 9.2,
"total_tokens": 113
} | +| `words` | List[[components.STTWord](../components/sttword.mdx)] | :heavy_minus_sign: | Timestamped words, present when the provider returns word-level timestamps | | \ No newline at end of file diff --git a/docs/components/sttsegment.mdx b/docs/components/sttsegment.mdx new file mode 100644 index 0000000..d0bcd9a --- /dev/null +++ b/docs/components/sttsegment.mdx @@ -0,0 +1,21 @@ +--- +title: "STTSegment" +--- + +A timestamped transcript segment, returned when response_format is verbose_json + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `avg_logprob` | *Optional[float]* | :heavy_minus_sign: | Average log probability of the segment | | +| `compression_ratio` | *Optional[float]* | :heavy_minus_sign: | Compression ratio of the segment | | +| `end` | *float* | :heavy_check_mark: | Segment end time in seconds | 3.2 | +| `id` | *int* | :heavy_check_mark: | Segment index within the transcript | 0 | +| `no_speech_prob` | *Optional[float]* | :heavy_minus_sign: | Probability the segment contains no speech | | +| `seek` | *Optional[int]* | :heavy_minus_sign: | Seek offset of the segment | 0 | +| `start` | *float* | :heavy_check_mark: | Segment start time in seconds | 0 | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature used for the segment | | +| `text` | *str* | :heavy_check_mark: | Transcribed text of the segment | Hello there. | +| `tokens` | List[*int*] | :heavy_minus_sign: | Token IDs of the segment | | \ No newline at end of file diff --git a/docs/components/stttimestampgranularity.mdx b/docs/components/stttimestampgranularity.mdx new file mode 100644 index 0000000..3505a51 --- /dev/null +++ b/docs/components/stttimestampgranularity.mdx @@ -0,0 +1,22 @@ +--- +title: "STTTimestampGranularity" +--- + +A timestamp detail level for verbose_json transcription responses. + +## Example Usage + +```python +from openrouter.components import STTTimestampGranularity + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: STTTimestampGranularity = "word" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"word"` +- `"segment"` diff --git a/docs/components/sttword.mdx b/docs/components/sttword.mdx new file mode 100644 index 0000000..994522a --- /dev/null +++ b/docs/components/sttword.mdx @@ -0,0 +1,14 @@ +--- +title: "STTWord" +--- + +A timestamped word, returned when the provider includes word-level timestamps + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `end` | *float* | :heavy_check_mark: | Word end time in seconds | 0.4 | +| `start` | *float* | :heavy_check_mark: | Word start time in seconds | 0 | +| `word` | *str* | :heavy_check_mark: | The transcribed word | Hello | \ No newline at end of file diff --git a/docs/operations/contextbucket.mdx b/docs/operations/contextbucket.mdx new file mode 100644 index 0000000..d246161 --- /dev/null +++ b/docs/operations/contextbucket.mdx @@ -0,0 +1,25 @@ +--- +title: "ContextBucket" +--- + +Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + +## Example Usage + +```python +from openrouter.operations import ContextBucket + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ContextBucket = "1K" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"1K"` +- `"10K"` +- `"100K"` +- `"1M"` +- `"10M"` diff --git a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx index 70f754b..3054ebe 100644 --- a/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx +++ b/docs/operations/createaudiotranscriptionsmultipartrequestbody.mdx @@ -4,10 +4,11 @@ title: "CreateAudioTranscriptionsMultipartRequestBody" ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | -| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | -| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | -| `response_format` | [Optional[operations.ResponseFormat]](../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. Only "json" is supported. | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | +| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | +| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | +| `response_format` | [Optional[operations.ResponseFormat]](../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | +| `timestamp_granularities` | List[[operations.TimestampGranularities](../operations/timestampgranularities.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "word" additionally returns word-level timestamps in the words array. | \ No newline at end of file diff --git a/docs/operations/getrankingsdailycategory.mdx b/docs/operations/getrankingsdailycategory.mdx new file mode 100644 index 0000000..a81ff4b --- /dev/null +++ b/docs/operations/getrankingsdailycategory.mdx @@ -0,0 +1,32 @@ +--- +title: "GetRankingsDailyCategory" +--- + +Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + +## Example Usage + +```python +from openrouter.operations import GetRankingsDailyCategory + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: GetRankingsDailyCategory = "programming" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"programming"` +- `"roleplay"` +- `"marketing"` +- `"marketing/seo"` +- `"technology"` +- `"science"` +- `"translation"` +- `"legal"` +- `"finance"` +- `"health"` +- `"trivia"` +- `"academia"` diff --git a/docs/operations/getrankingsdailyrequest.mdx b/docs/operations/getrankingsdailyrequest.mdx index 1788b94..04784a9 100644 --- a/docs/operations/getrankingsdailyrequest.mdx +++ b/docs/operations/getrankingsdailyrequest.mdx @@ -4,10 +4,15 @@ title: "GetRankingsDailyRequest" ## 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.
| | -| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | -| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | \ No newline at end of file +| 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.
| | +| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | +| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | +| `period` | [Optional[operations.Period]](../operations/period.mdx) | :heavy_minus_sign: | Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. | day | +| `modality` | [Optional[operations.Modality]](../operations/modality.mdx) | :heavy_minus_sign: | Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. | text | +| `context_bucket` | [Optional[operations.ContextBucket]](../operations/contextbucket.mdx) | :heavy_minus_sign: | Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. | 100K | +| `category` | [Optional[operations.GetRankingsDailyCategory]](../operations/getrankingsdailycategory.mdx) | :heavy_minus_sign: | Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. | programming | +| `language_type` | [Optional[operations.LanguageType]](../operations/languagetype.mdx) | :heavy_minus_sign: | Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. | natural | \ No newline at end of file diff --git a/docs/operations/languagetype.mdx b/docs/operations/languagetype.mdx new file mode 100644 index 0000000..0d94d66 --- /dev/null +++ b/docs/operations/languagetype.mdx @@ -0,0 +1,22 @@ +--- +title: "LanguageType" +--- + +Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. + +## Example Usage + +```python +from openrouter.operations import LanguageType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: LanguageType = "natural" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"natural"` +- `"programming"` diff --git a/docs/operations/modality.mdx b/docs/operations/modality.mdx new file mode 100644 index 0000000..63f8e98 --- /dev/null +++ b/docs/operations/modality.mdx @@ -0,0 +1,25 @@ +--- +title: "Modality" +--- + +Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + +## Example Usage + +```python +from openrouter.operations import Modality + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Modality = "text" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"text"` +- `"image"` +- `"image_output"` +- `"audio"` +- `"tool_calling"` diff --git a/docs/operations/period.mdx b/docs/operations/period.mdx new file mode 100644 index 0000000..a1fdee3 --- /dev/null +++ b/docs/operations/period.mdx @@ -0,0 +1,23 @@ +--- +title: "Period" +--- + +Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + +## Example Usage + +```python +from openrouter.operations import Period + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Period = "day" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"day"` +- `"week"` +- `"month"` diff --git a/docs/operations/responseformat.mdx b/docs/operations/responseformat.mdx index 83b1634..b7f7723 100644 --- a/docs/operations/responseformat.mdx +++ b/docs/operations/responseformat.mdx @@ -2,16 +2,21 @@ title: "ResponseFormat" --- -The response format. Only "json" is supported. +The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). ## Example Usage ```python from openrouter.operations import ResponseFormat + +# Open enum: unrecognized values are captured as UnrecognizedStr value: ResponseFormat = "json" ``` ## Values +This is an open enum. Unrecognized values will not fail type checks. + - `"json"` +- `"verbose_json"` diff --git a/docs/operations/timestampgranularities.mdx b/docs/operations/timestampgranularities.mdx new file mode 100644 index 0000000..c783ad0 --- /dev/null +++ b/docs/operations/timestampgranularities.mdx @@ -0,0 +1,20 @@ +--- +title: "TimestampGranularities" +--- + +## Example Usage + +```python +from openrouter.operations import TimestampGranularities + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: TimestampGranularities = "word" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"word"` +- `"segment"` diff --git a/docs/sdks/datasets/README.mdx b/docs/sdks/datasets/README.mdx index 9cdcae1..ef43241 100644 --- a/docs/sdks/datasets/README.mdx +++ b/docs/sdks/datasets/README.mdx @@ -102,6 +102,13 @@ Each row is a distinct `(date, model_permaslug)` pair. The `other` row uses the reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. +Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time +grain. `modality` and `context_bucket` narrow the exact dataset by output/input +modality (or tool-calling activity) and request context length. `category` and +`language_type` instead read a sampled, upsampled dataset whose `total_tokens` are +weekly-grain estimates — they cannot be combined with each other or with the exact +filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -136,14 +143,19 @@ with OpenRouter( ### Parameters -| Parameter | 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.
| | -| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | -| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | 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.
| | +| `start_date` | *Optional[str]* | :heavy_minus_sign: | Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. | 2026-04-12 | +| `end_date` | *Optional[str]* | :heavy_minus_sign: | End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. | 2026-05-11 | +| `period` | [Optional[operations.Period]](../../operations/period.mdx) | :heavy_minus_sign: | Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. | day | +| `modality` | [Optional[operations.Modality]](../../operations/modality.mdx) | :heavy_minus_sign: | Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. | text | +| `context_bucket` | [Optional[operations.ContextBucket]](../../operations/contextbucket.mdx) | :heavy_minus_sign: | Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. | 100K | +| `category` | [Optional[operations.GetRankingsDailyCategory]](../../operations/getrankingsdailycategory.mdx) | :heavy_minus_sign: | Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. | programming | +| `language_type` | [Optional[operations.LanguageType]](../../operations/languagetype.mdx) | :heavy_minus_sign: | Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. | natural | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/stt/README.mdx b/docs/sdks/stt/README.mdx index 4ca7365..003f859 100644 --- a/docs/sdks/stt/README.mdx +++ b/docs/sdks/stt/README.mdx @@ -42,17 +42,19 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `input_audio` | [components.STTInputAudio](../../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | -| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | -| `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.
| | -| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | -| `provider` | [Optional[components.STTRequestProvider]](../../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input_audio` | [components.STTInputAudio](../../components/sttinputaudio.mdx) | :heavy_check_mark: | Base64-encoded audio to transcribe | \{
"data": "UklGRiQA...",
"format": "wav"
} | +| `model` | *str* | :heavy_check_mark: | STT model identifier | openai/whisper-large-v3 | +| `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.
| | +| `language` | *Optional[str]* | :heavy_minus_sign: | ISO-639-1 language code (e.g., "en", "ja"). Auto-detected if omitted. | en | +| `provider` | [Optional[components.STTRequestProvider]](../../components/sttrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `response_format` | [Optional[components.STTRequestResponseFormat]](../../components/sttrequestresponseformat.mdx) | :heavy_minus_sign: | Output format. "json" (default) returns \{ text, usage }. "verbose_json" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. | json | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Sampling temperature for transcription | 0 | +| `timestamp_granularities` | List[[components.STTTimestampGranularity](../../components/stttimestampgranularity.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "segment" returns segment-level timestamps; "word" additionally returns word-level timestamps in the words array. Ignored unless response_format is "verbose_json". | [
"segment"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -104,17 +106,18 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | -| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | -| `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.
| -| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | -| `response_format` | [Optional[operations.ResponseFormat]](../../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. Only "json" is supported. | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `file` | [operations.CreateAudioTranscriptionsMultipartFile](../../operations/createaudiotranscriptionsmultipartfile.mdx) | :heavy_check_mark: | The audio file to transcribe. The format is derived from the filename extension or the file part content type. Max 25 MB; send larger files as base64 JSON via input_audio. | +| `model` | *str* | :heavy_check_mark: | The model to use for transcription. | +| `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.
| +| `language` | *Optional[str]* | :heavy_minus_sign: | The language of the input audio (ISO-639-1). | +| `response_format` | [Optional[operations.ResponseFormat]](../../operations/responseformat.mdx) | :heavy_minus_sign: | The response format. "json" (default) returns \{ text, usage }; "verbose_json" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | The sampling temperature. | +| `timestamp_granularities` | List[[operations.TimestampGranularities](../../operations/timestampgranularities.mdx)] | :heavy_minus_sign: | Timestamp detail levels to include when response_format is "verbose_json". "word" additionally returns word-level timestamps in the words array. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index ece7fa9..dca713a 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -47,7 +47,7 @@ with OpenRouter( | `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.
| | | `provider` | [Optional[components.SpeechRequestProvider]](../../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | -| `response_format` | [Optional[components.ResponseFormatEnum]](../../components/responseformatenum.mdx) | :heavy_minus_sign: | Audio output format | pcm | +| `response_format` | [Optional[components.SpeechRequestResponseFormat]](../../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/pyproject.toml b/pyproject.toml index 501f0c5..0ab0806 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.6" +version = "0.11.7" 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 e8f04f5..56b8833 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.6" +__version__: str = "0.11.7" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.6 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.7 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 6e63042..6fd4998 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2366,10 +2366,10 @@ if TYPE_CHECKING: ShellServerToolEnvironmentTypedDict, ) from .speechrequest import ( - ResponseFormatEnum, SpeechRequest, SpeechRequestProvider, SpeechRequestProviderTypedDict, + SpeechRequestResponseFormat, SpeechRequestTypedDict, ) from .stopservertoolswhencondition import ( @@ -2443,10 +2443,14 @@ if TYPE_CHECKING: STTRequest, STTRequestProvider, STTRequestProviderTypedDict, + STTRequestResponseFormat, STTRequestTypedDict, ) from .sttresponse import STTResponse, STTResponseTypedDict + from .sttsegment import STTSegment, STTSegmentTypedDict + from .stttimestampgranularity import STTTimestampGranularity from .sttusage import STTUsage, STTUsageTypedDict + from .sttword import STTWord, STTWordTypedDict from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict from .subagentreasoning import ( SubagentReasoning, @@ -4296,7 +4300,6 @@ __all__ = [ "ResetInterval", "Response", "ResponseFormat", - "ResponseFormatEnum", "ResponseFormatTypedDict", "ResponseHealingPlugin", "ResponseHealingPluginID", @@ -4334,11 +4337,17 @@ __all__ = [ "STTRequest", "STTRequestProvider", "STTRequestProviderTypedDict", + "STTRequestResponseFormat", "STTRequestTypedDict", "STTResponse", "STTResponseTypedDict", + "STTSegment", + "STTSegmentTypedDict", + "STTTimestampGranularity", "STTUsage", "STTUsageTypedDict", + "STTWord", + "STTWordTypedDict", "SearchContextSizeEnum", "SearchModelsServerToolConfig", "SearchModelsServerToolConfigTypedDict", @@ -4384,6 +4393,7 @@ __all__ = [ "SpeechRequest", "SpeechRequestProvider", "SpeechRequestProviderTypedDict", + "SpeechRequestResponseFormat", "SpeechRequestTypedDict", "Speed", "Stance", @@ -6471,10 +6481,10 @@ _dynamic_imports: dict[str, str] = { "ShellServerToolEngine": ".shellservertoolengine", "ShellServerToolEnvironment": ".shellservertoolenvironment", "ShellServerToolEnvironmentTypedDict": ".shellservertoolenvironment", - "ResponseFormatEnum": ".speechrequest", "SpeechRequest": ".speechrequest", "SpeechRequestProvider": ".speechrequest", "SpeechRequestProviderTypedDict": ".speechrequest", + "SpeechRequestResponseFormat": ".speechrequest", "SpeechRequestTypedDict": ".speechrequest", "StopServerToolsWhenCondition": ".stopservertoolswhencondition", "StopServerToolsWhenConditionTypedDict": ".stopservertoolswhencondition", @@ -6524,11 +6534,17 @@ _dynamic_imports: dict[str, str] = { "STTRequest": ".sttrequest", "STTRequestProvider": ".sttrequest", "STTRequestProviderTypedDict": ".sttrequest", + "STTRequestResponseFormat": ".sttrequest", "STTRequestTypedDict": ".sttrequest", "STTResponse": ".sttresponse", "STTResponseTypedDict": ".sttresponse", + "STTSegment": ".sttsegment", + "STTSegmentTypedDict": ".sttsegment", + "STTTimestampGranularity": ".stttimestampgranularity", "STTUsage": ".sttusage", "STTUsageTypedDict": ".sttusage", + "STTWord": ".sttword", + "STTWordTypedDict": ".sttword", "SubagentNestedTool": ".subagentnestedtool", "SubagentNestedToolTypedDict": ".subagentnestedtool", "SubagentReasoning": ".subagentreasoning", diff --git a/src/openrouter/components/speechrequest.py b/src/openrouter/components/speechrequest.py index cb7e1b2..f903339 100644 --- a/src/openrouter/components/speechrequest.py +++ b/src/openrouter/components/speechrequest.py @@ -38,7 +38,7 @@ class SpeechRequestProvider(BaseModel): return m -ResponseFormatEnum = Union[ +SpeechRequestResponseFormat = Union[ Literal[ "mp3", "pcm", @@ -59,7 +59,7 @@ class SpeechRequestTypedDict(TypedDict): r"""Voice identifier (provider-specific).""" provider: NotRequired[SpeechRequestProviderTypedDict] r"""Provider-specific passthrough configuration""" - response_format: NotRequired[ResponseFormatEnum] + response_format: NotRequired[SpeechRequestResponseFormat] r"""Audio output format""" speed: NotRequired[float] r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.""" @@ -80,7 +80,7 @@ class SpeechRequest(BaseModel): provider: Optional[SpeechRequestProvider] = None r"""Provider-specific passthrough configuration""" - response_format: Optional[ResponseFormatEnum] = "pcm" + response_format: Optional[SpeechRequestResponseFormat] = "pcm" r"""Audio output format""" speed: Optional[float] = None diff --git a/src/openrouter/components/sttrequest.py b/src/openrouter/components/sttrequest.py index d5497b9..ce7ba25 100644 --- a/src/openrouter/components/sttrequest.py +++ b/src/openrouter/components/sttrequest.py @@ -3,9 +3,10 @@ from __future__ import annotations from .provideroptions import ProviderOptions, ProviderOptionsTypedDict from .sttinputaudio import STTInputAudio, STTInputAudioTypedDict -from openrouter.types import BaseModel, UNSET_SENTINEL +from .stttimestampgranularity import STTTimestampGranularity +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer -from typing import Optional +from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypedDict @@ -39,6 +40,16 @@ class STTRequestProvider(BaseModel): return m +STTRequestResponseFormat = Union[ + Literal[ + "json", + "verbose_json", + ], + UnrecognizedStr, +] +r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" + + class STTRequestTypedDict(TypedDict): r"""Speech-to-text request input. Accepts a JSON body with input_audio containing base64-encoded audio.""" @@ -50,8 +61,12 @@ class STTRequestTypedDict(TypedDict): r"""ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.""" provider: NotRequired[STTRequestProviderTypedDict] r"""Provider-specific passthrough configuration""" + response_format: NotRequired[STTRequestResponseFormat] + r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" temperature: NotRequired[float] r"""Sampling temperature for transcription""" + timestamp_granularities: NotRequired[List[STTTimestampGranularity]] + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".""" class STTRequest(BaseModel): @@ -69,12 +84,26 @@ class STTRequest(BaseModel): provider: Optional[STTRequestProvider] = None r"""Provider-specific passthrough configuration""" + response_format: Optional[STTRequestResponseFormat] = None + r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.""" + temperature: Optional[float] = None r"""Sampling temperature for transcription""" + timestamp_granularities: Optional[List[STTTimestampGranularity]] = None + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["language", "provider", "temperature"]) + optional_fields = set( + [ + "language", + "provider", + "response_format", + "temperature", + "timestamp_granularities", + ] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/sttresponse.py b/src/openrouter/components/sttresponse.py index 19ff065..61daeb2 100644 --- a/src/openrouter/components/sttresponse.py +++ b/src/openrouter/components/sttresponse.py @@ -1,10 +1,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .sttsegment import STTSegment, STTSegmentTypedDict from .sttusage import STTUsage, STTUsageTypedDict +from .sttword import STTWord, STTWordTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer -from typing import Optional +from typing import List, Optional from typing_extensions import NotRequired, TypedDict @@ -13,8 +15,18 @@ class STTResponseTypedDict(TypedDict): text: str r"""The transcribed text""" + duration: NotRequired[float] + r"""Duration of the input audio in seconds, present when response_format is verbose_json""" + language: NotRequired[str] + r"""Detected or forced language, present when response_format is verbose_json""" + segments: NotRequired[List[STTSegmentTypedDict]] + r"""Timestamped transcript segments, present when response_format is verbose_json""" + task: NotRequired[str] + r"""The task performed, present when response_format is verbose_json""" usage: NotRequired[STTUsageTypedDict] r"""Aggregated usage statistics for the request""" + words: NotRequired[List[STTWordTypedDict]] + r"""Timestamped words, present when the provider returns word-level timestamps""" class STTResponse(BaseModel): @@ -23,12 +35,29 @@ class STTResponse(BaseModel): text: str r"""The transcribed text""" + duration: Optional[float] = None + r"""Duration of the input audio in seconds, present when response_format is verbose_json""" + + language: Optional[str] = None + r"""Detected or forced language, present when response_format is verbose_json""" + + segments: Optional[List[STTSegment]] = None + r"""Timestamped transcript segments, present when response_format is verbose_json""" + + task: Optional[str] = None + r"""The task performed, present when response_format is verbose_json""" + usage: Optional[STTUsage] = None r"""Aggregated usage statistics for the request""" + words: Optional[List[STTWord]] = None + r"""Timestamped words, present when the provider returns word-level timestamps""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["usage"]) + optional_fields = set( + ["duration", "language", "segments", "task", "usage", "words"] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/sttsegment.py b/src/openrouter/components/sttsegment.py new file mode 100644 index 0000000..471a080 --- /dev/null +++ b/src/openrouter/components/sttsegment.py @@ -0,0 +1,91 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class STTSegmentTypedDict(TypedDict): + r"""A timestamped transcript segment, returned when response_format is verbose_json""" + + end: float + r"""Segment end time in seconds""" + id: int + r"""Segment index within the transcript""" + start: float + r"""Segment start time in seconds""" + text: str + r"""Transcribed text of the segment""" + avg_logprob: NotRequired[float] + r"""Average log probability of the segment""" + compression_ratio: NotRequired[float] + r"""Compression ratio of the segment""" + no_speech_prob: NotRequired[float] + r"""Probability the segment contains no speech""" + seek: NotRequired[int] + r"""Seek offset of the segment""" + temperature: NotRequired[float] + r"""Temperature used for the segment""" + tokens: NotRequired[List[int]] + r"""Token IDs of the segment""" + + +class STTSegment(BaseModel): + r"""A timestamped transcript segment, returned when response_format is verbose_json""" + + end: float + r"""Segment end time in seconds""" + + id: int + r"""Segment index within the transcript""" + + start: float + r"""Segment start time in seconds""" + + text: str + r"""Transcribed text of the segment""" + + avg_logprob: Optional[float] = None + r"""Average log probability of the segment""" + + compression_ratio: Optional[float] = None + r"""Compression ratio of the segment""" + + no_speech_prob: Optional[float] = None + r"""Probability the segment contains no speech""" + + seek: Optional[int] = None + r"""Seek offset of the segment""" + + temperature: Optional[float] = None + r"""Temperature used for the segment""" + + tokens: Optional[List[int]] = None + r"""Token IDs of the segment""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "avg_logprob", + "compression_ratio", + "no_speech_prob", + "seek", + "temperature", + "tokens", + ] + ) + 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/stttimestampgranularity.py b/src/openrouter/components/stttimestampgranularity.py new file mode 100644 index 0000000..30edd2f --- /dev/null +++ b/src/openrouter/components/stttimestampgranularity.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +STTTimestampGranularity = Union[ + Literal[ + "word", + "segment", + ], + UnrecognizedStr, +] +r"""A timestamp detail level for verbose_json transcription responses.""" diff --git a/src/openrouter/components/sttword.py b/src/openrouter/components/sttword.py new file mode 100644 index 0000000..020dd01 --- /dev/null +++ b/src/openrouter/components/sttword.py @@ -0,0 +1,29 @@ +"""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 STTWordTypedDict(TypedDict): + r"""A timestamped word, returned when the provider includes word-level timestamps""" + + end: float + r"""Word end time in seconds""" + start: float + r"""Word start time in seconds""" + word: str + r"""The transcribed word""" + + +class STTWord(BaseModel): + r"""A timestamped word, returned when the provider includes word-level timestamps""" + + end: float + r"""Word end time in seconds""" + + start: float + r"""Word start time in seconds""" + + word: str + r"""The transcribed word""" diff --git a/src/openrouter/datasets.py b/src/openrouter/datasets.py index 0420058..3d9437c 100644 --- a/src/openrouter/datasets.py +++ b/src/openrouter/datasets.py @@ -444,6 +444,11 @@ class Datasets(BaseSDK): x_open_router_categories: Optional[str] = None, start_date: Optional[str] = None, end_date: Optional[str] = None, + period: Optional[operations.Period] = None, + modality: Optional[operations.Modality] = None, + context_bucket: Optional[operations.ContextBucket] = None, + category: Optional[operations.GetRankingsDailyCategory] = None, + language_type: Optional[operations.LanguageType] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -460,6 +465,13 @@ class Datasets(BaseSDK): reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. + Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time + grain. `modality` and `context_bucket` narrow the exact dataset by output/input + modality (or tool-calling activity) and request context length. `category` and + `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are + weekly-grain estimates — they cannot be combined with each other or with the exact + filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -480,6 +492,11 @@ class Datasets(BaseSDK): :param start_date: Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. :param end_date: End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. + :param period: Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + :param modality: Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + :param context_bucket: Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + :param category: Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + :param language_type: Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. :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 @@ -501,6 +518,11 @@ class Datasets(BaseSDK): x_open_router_categories=x_open_router_categories, start_date=start_date, end_date=end_date, + period=period, + modality=modality, + context_bucket=context_bucket, + category=category, + language_type=language_type, ) req = self._build_request( @@ -598,6 +620,11 @@ class Datasets(BaseSDK): x_open_router_categories: Optional[str] = None, start_date: Optional[str] = None, end_date: Optional[str] = None, + period: Optional[operations.Period] = None, + modality: Optional[operations.Modality] = None, + context_bucket: Optional[operations.ContextBucket] = None, + category: Optional[operations.GetRankingsDailyCategory] = None, + language_type: Optional[operations.LanguageType] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -614,6 +641,13 @@ class Datasets(BaseSDK): reserved permaslug `other` and is always returned last within its date, so callers can compute `top-50 traffic / total daily traffic` without a second request. + Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time + grain. `modality` and `context_bucket` narrow the exact dataset by output/input + modality (or tool-calling activity) and request context length. `category` and + `language_type` instead read a sampled, upsampled dataset whose `total_tokens` are + weekly-grain estimates — they cannot be combined with each other or with the exact + filters, and reject `period=day` with a 400. + Authenticate with any valid OpenRouter API key (same key used for inference). Rate-limited to 30 requests/minute per key and 500 requests/day per account. @@ -634,6 +668,11 @@ class Datasets(BaseSDK): :param start_date: Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`. :param end_date: End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400. + :param period: Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries. + :param modality: Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`. + :param context_bucket: Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`. + :param category: Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`. + :param language_type: Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`. :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 @@ -655,6 +694,11 @@ class Datasets(BaseSDK): x_open_router_categories=x_open_router_categories, start_date=start_date, end_date=end_date, + period=period, + modality=modality, + context_bucket=context_bucket, + category=category, + language_type=language_type, ) req = self._build_request_async( diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 737838d..ab9fa9e 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -63,6 +63,7 @@ if TYPE_CHECKING: CreateAudioTranscriptionsMultipartRequestBodyTypedDict, CreateAudioTranscriptionsMultipartRequestTypedDict, ResponseFormat, + TimestampGranularities, ) from .createauthkeyscode import ( CreateAuthKeysCodeCodeChallengeMethod, @@ -411,10 +412,15 @@ if TYPE_CHECKING: GetPresetVersionRequestTypedDict, ) from .getrankingsdaily import ( + ContextBucket, + GetRankingsDailyCategory, GetRankingsDailyGlobals, GetRankingsDailyGlobalsTypedDict, GetRankingsDailyRequest, GetRankingsDailyRequestTypedDict, + LanguageType, + Modality, + Period, ) from .gettaskclassifications import ( GetTaskClassificationsGlobals, @@ -766,6 +772,7 @@ __all__ = [ "ContentText", "ContentTextTypedDict", "ContentTypedDict", + "ContextBucket", "CostDetails", "CostDetailsTypedDict", "CreateAudioSpeechGlobals", @@ -1018,6 +1025,7 @@ __all__ = [ "GetPresetVersionGlobalsTypedDict", "GetPresetVersionRequest", "GetPresetVersionRequestTypedDict", + "GetRankingsDailyCategory", "GetRankingsDailyGlobals", "GetRankingsDailyGlobalsTypedDict", "GetRankingsDailyRequest", @@ -1048,6 +1056,7 @@ __all__ = [ "InputTypedDict", "InputUnion", "InputUnionTypedDict", + "LanguageType", "ListBYOKKeysGlobals", "ListBYOKKeysGlobalsTypedDict", "ListBYOKKeysRequest", @@ -1200,6 +1209,7 @@ __all__ = [ "MetadataTypedDict", "Metric", "MetricTypedDict", + "Modality", "Object", "ObjectEmbedding", "Operator", @@ -1207,6 +1217,7 @@ __all__ = [ "OperatorTypedDict", "OrderBy", "OrderByTypedDict", + "Period", "PromptTokensDetails", "PromptTokensDetailsTypedDict", "Provider", @@ -1240,6 +1251,7 @@ __all__ = [ "TaskType", "TimeRange", "TimeRangeTypedDict", + "TimestampGranularities", "TypeImageURL", "TypeText", "UpdateBYOKKeyGlobals", @@ -1333,6 +1345,7 @@ _dynamic_imports: dict[str, str] = { "CreateAudioTranscriptionsMultipartRequestBodyTypedDict": ".createaudiotranscriptions_multipart", "CreateAudioTranscriptionsMultipartRequestTypedDict": ".createaudiotranscriptions_multipart", "ResponseFormat": ".createaudiotranscriptions_multipart", + "TimestampGranularities": ".createaudiotranscriptions_multipart", "CreateAuthKeysCodeCodeChallengeMethod": ".createauthkeyscode", "CreateAuthKeysCodeData": ".createauthkeyscode", "CreateAuthKeysCodeDataTypedDict": ".createauthkeyscode", @@ -1603,10 +1616,15 @@ _dynamic_imports: dict[str, str] = { "GetPresetVersionGlobalsTypedDict": ".getpresetversion", "GetPresetVersionRequest": ".getpresetversion", "GetPresetVersionRequestTypedDict": ".getpresetversion", + "ContextBucket": ".getrankingsdaily", + "GetRankingsDailyCategory": ".getrankingsdaily", "GetRankingsDailyGlobals": ".getrankingsdaily", "GetRankingsDailyGlobalsTypedDict": ".getrankingsdaily", "GetRankingsDailyRequest": ".getrankingsdaily", "GetRankingsDailyRequestTypedDict": ".getrankingsdaily", + "LanguageType": ".getrankingsdaily", + "Modality": ".getrankingsdaily", + "Period": ".getrankingsdaily", "GetTaskClassificationsGlobals": ".gettaskclassifications", "GetTaskClassificationsGlobalsTypedDict": ".gettaskclassifications", "GetTaskClassificationsRequest": ".gettaskclassifications", diff --git a/src/openrouter/operations/createaudiotranscriptions_multipart.py b/src/openrouter/operations/createaudiotranscriptions_multipart.py index 2697d1e..ff5459e 100644 --- a/src/openrouter/operations/createaudiotranscriptions_multipart.py +++ b/src/openrouter/operations/createaudiotranscriptions_multipart.py @@ -2,7 +2,7 @@ from __future__ import annotations import io -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from openrouter.utils import ( FieldMetadata, HeaderMetadata, @@ -11,7 +11,7 @@ from openrouter.utils import ( ) import pydantic from pydantic import model_serializer -from typing import IO, Literal, Optional, Union +from typing import IO, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -119,8 +119,23 @@ class CreateAudioTranscriptionsMultipartFile(BaseModel): return m -ResponseFormat = Literal["json",] -r"""The response format. Only \"json\" is supported.""" +ResponseFormat = Union[ + Literal[ + "json", + "verbose_json", + ], + UnrecognizedStr, +] +r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).""" + + +TimestampGranularities = Union[ + Literal[ + "word", + "segment", + ], + UnrecognizedStr, +] class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict): @@ -131,9 +146,11 @@ class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict): language: NotRequired[str] r"""The language of the input audio (ISO-639-1).""" response_format: NotRequired[ResponseFormat] - r"""The response format. Only \"json\" is supported.""" + r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).""" temperature: NotRequired[float] r"""The sampling temperature.""" + timestamp_granularities: NotRequired[List[TimestampGranularities]] + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array.""" class CreateAudioTranscriptionsMultipartRequestBody(BaseModel): @@ -152,14 +169,23 @@ class CreateAudioTranscriptionsMultipartRequestBody(BaseModel): response_format: Annotated[ Optional[ResponseFormat], FieldMetadata(multipart=True) ] = None - r"""The response format. Only \"json\" is supported.""" + r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).""" temperature: Annotated[Optional[float], FieldMetadata(multipart=True)] = None r"""The sampling temperature.""" + timestamp_granularities: Annotated[ + Optional[List[TimestampGranularities]], + pydantic.Field(alias="timestamp_granularities[]"), + FieldMetadata(multipart=True), + ] = None + r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["language", "response_format", "temperature"]) + optional_fields = set( + ["language", "response_format", "temperature", "timestamp_granularities[]"] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/operations/getrankingsdaily.py b/src/openrouter/operations/getrankingsdaily.py index efa494f..fb9267c 100644 --- a/src/openrouter/operations/getrankingsdaily.py +++ b/src/openrouter/operations/getrankingsdaily.py @@ -1,11 +1,11 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata import pydantic from pydantic import model_serializer -from typing import Optional +from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -73,6 +73,73 @@ class GetRankingsDailyGlobals(BaseModel): return m +Period = Union[ + Literal[ + "day", + "week", + "month", + ], + UnrecognizedStr, +] +r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.""" + + +Modality = Union[ + Literal[ + "text", + "image", + "image_output", + "audio", + "tool_calling", + ], + UnrecognizedStr, +] +r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.""" + + +ContextBucket = Union[ + Literal[ + "1K", + "10K", + "100K", + "1M", + "10M", + ], + UnrecognizedStr, +] +r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.""" + + +GetRankingsDailyCategory = Union[ + Literal[ + "programming", + "roleplay", + "marketing", + "marketing/seo", + "technology", + "science", + "translation", + "legal", + "finance", + "health", + "trivia", + "academia", + ], + UnrecognizedStr, +] +r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.""" + + +LanguageType = Union[ + Literal[ + "natural", + "programming", + ], + UnrecognizedStr, +] +r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.""" + + class GetRankingsDailyRequestTypedDict(TypedDict): http_referer: NotRequired[str] r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -91,6 +158,16 @@ class GetRankingsDailyRequestTypedDict(TypedDict): r"""Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`.""" end_date: NotRequired[str] r"""End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400.""" + period: NotRequired[Period] + r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.""" + modality: NotRequired[Modality] + r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.""" + context_bucket: NotRequired[ContextBucket] + r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.""" + category: NotRequired[GetRankingsDailyCategory] + r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.""" + language_type: NotRequired[LanguageType] + r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.""" class GetRankingsDailyRequest(BaseModel): @@ -134,6 +211,36 @@ class GetRankingsDailyRequest(BaseModel): ] = None r"""End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400.""" + period: Annotated[ + Optional[Period], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.""" + + modality: Annotated[ + Optional[Modality], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.""" + + context_bucket: Annotated[ + Optional[ContextBucket], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.""" + + category: Annotated[ + Optional[GetRankingsDailyCategory], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.""" + + language_type: Annotated[ + Optional[LanguageType], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -143,6 +250,11 @@ class GetRankingsDailyRequest(BaseModel): "X-OpenRouter-Categories", "start_date", "end_date", + "period", + "modality", + "context_bucket", + "category", + "language_type", ] ) serialized = handler(self) diff --git a/src/openrouter/stt.py b/src/openrouter/stt.py index b5895f3..4bcc6d0 100644 --- a/src/openrouter/stt.py +++ b/src/openrouter/stt.py @@ -6,7 +6,7 @@ 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 +from typing import Any, Iterable, List, Mapping, Optional, Union class Stt(BaseSDK): @@ -24,7 +24,11 @@ class Stt(BaseSDK): provider: Optional[ Union[components.STTRequestProvider, components.STTRequestProviderTypedDict] ] = None, + response_format: Optional[components.STTRequestResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[components.STTTimestampGranularity] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -45,7 +49,9 @@ class Stt(BaseSDK): :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. :param provider: Provider-specific passthrough configuration + :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param temperature: Sampling temperature for transcription + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\". :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 @@ -74,7 +80,12 @@ class Stt(BaseSDK): provider=utils.get_pydantic_model( provider, Optional[components.STTRequestProvider] ), + response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[components.STTTimestampGranularity]], + ), ), ) @@ -210,7 +221,11 @@ class Stt(BaseSDK): provider: Optional[ Union[components.STTRequestProvider, components.STTRequestProviderTypedDict] ] = None, + response_format: Optional[components.STTRequestResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[components.STTTimestampGranularity] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -231,7 +246,9 @@ class Stt(BaseSDK): :param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted. :param provider: Provider-specific passthrough configuration + :param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers. :param temperature: Sampling temperature for transcription + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\". :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 @@ -260,7 +277,12 @@ class Stt(BaseSDK): provider=utils.get_pydantic_model( provider, Optional[components.STTRequestProvider] ), + response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[components.STTTimestampGranularity]], + ), ), ) @@ -398,6 +420,9 @@ class Stt(BaseSDK): language: Optional[str] = None, response_format: Optional[operations.ResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[operations.TimestampGranularities] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -417,8 +442,9 @@ class Stt(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param language: The language of the input audio (ISO-639-1). - :param response_format: The response format. Only \"json\" is supported. + :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param temperature: The sampling temperature. + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array. :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 @@ -446,6 +472,10 @@ class Stt(BaseSDK): model=model, response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[operations.TimestampGranularities]], + ), ), ) @@ -587,6 +617,9 @@ class Stt(BaseSDK): language: Optional[str] = None, response_format: Optional[operations.ResponseFormat] = None, temperature: Optional[float] = None, + timestamp_granularities: Optional[ + Iterable[operations.TimestampGranularities] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -606,8 +639,9 @@ class Stt(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param language: The language of the input audio (ISO-639-1). - :param response_format: The response format. Only \"json\" is supported. + :param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only). :param temperature: The sampling temperature. + :param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array. :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 @@ -635,6 +669,10 @@ class Stt(BaseSDK): model=model, response_format=response_format, temperature=temperature, + timestamp_granularities=utils.unmarshal( + timestamp_granularities, + Optional[List[operations.TimestampGranularities]], + ), ), ) diff --git a/src/openrouter/tts.py b/src/openrouter/tts.py index 68ae54d..5ccc4b9 100644 --- a/src/openrouter/tts.py +++ b/src/openrouter/tts.py @@ -28,7 +28,7 @@ class Tts(BaseSDK): components.SpeechRequestProviderTypedDict, ] ] = None, - response_format: Optional[components.ResponseFormatEnum] = "pcm", + response_format: Optional[components.SpeechRequestResponseFormat] = "pcm", speed: Optional[float] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -246,7 +246,7 @@ class Tts(BaseSDK): components.SpeechRequestProviderTypedDict, ] ] = None, - response_format: Optional[components.ResponseFormatEnum] = "pcm", + response_format: Optional[components.SpeechRequestResponseFormat] = "pcm", speed: Optional[float] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, diff --git a/uv.lock b/uv.lock index 2e847f0..7d3ca0a 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.6" +version = "0.11.7" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 21d6a478308e35492cf2666d28c8fd18dc6a195e Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 03:27:39 +0000 Subject: [PATCH 11/62] chore: update OpenAPI spec from monorepo (#403) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index e46daeb..e8969c9 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -4537,6 +4537,7 @@ components: - $ref: '#/components/schemas/BashServerTool' - $ref: '#/components/schemas/DatetimeServerTool' - $ref: '#/components/schemas/FilesServerTool' + - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - $ref: '#/components/schemas/ChatSearchModelsServerTool' - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' From 0caf5600ff80c2a6b21f0fb0d9aff1ae5009dc7d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 03:33:32 +0000 Subject: [PATCH 12/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.8=20(#404)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 30 +++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 1 + .speakeasy/workflow.lock | 10 +++---- RELEASES.md | 12 +++++++- docs/components/chatfunctiontool.mdx | 6 ++++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +-- src/openrouter/components/chatfunctiontool.py | 6 ++++ uv.lock | 2 +- 10 files changed, 49 insertions(+), 26 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index cd1e4a2..3029b66 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: 22a237d7f82bd54b7962d414a7957cab + docChecksum: 650dff337a98bf070a3d52ab3a7ab1c3 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.7 - configChecksum: c93a3c0cf8d2ef872726ed600df77d93 + releaseVersion: 0.11.8 + configChecksum: a51ccbb5afd956309fcd066b2592f06a repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 83866999-be04-4ad2-861f-5cffd5108efe - pristine_commit_hash: db0868c88c2da5c28ffb08cad3a18c4693828be5 - pristine_tree_hash: 68d039d8cfa62fa2c70a096a924d2cd1823467f2 + generation_id: 5184830b-3a82-41c6-bf4b-e4b5d536132f + pristine_commit_hash: 6261057d5344c7013ae79689331b8322cf7cc91f + pristine_tree_hash: 5c34f8ea38ccc5bd114c8bf2a16d8045c5c53e52 features: python: acceptHeaders: 3.0.0 @@ -862,8 +862,8 @@ trackedFiles: pristine_git_object: f5cbc93e1277fe0ed97bb520e331a58837e91ab4 docs/components/chatfunctiontool.mdx: id: 13433a4eb5b0 - last_write_checksum: sha1:d3b6abd613e7866de1fb7074e9e794543c8a940f - pristine_git_object: 41b4523f970c7a81f2512587ef8dd3a8db150f89 + last_write_checksum: sha1:7d68426d966a73f8b924fac73976317a47826f8c + pristine_git_object: bc9f2fa0780e97e0d13a2c10af27a5f3e666c0f5 docs/components/chatfunctiontoolfunction.mdx: id: b9f813a5b0c9 last_write_checksum: sha1:1daf25e4f31b7013fcbcd43f86678ce1548c8423 @@ -6442,8 +6442,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:2ebe96d8a4d112652eb43405442cdd305b5527f2 - pristine_git_object: 0ab0806b589bf64862fa7b0d06cbf2febee38379 + last_write_checksum: sha1:3e14d3b854b2587843adcc288c3fb7a72eb4702a + pristine_git_object: bc961c19b4d009a656fba6ca0650d989217cbe22 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6470,8 +6470,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:7811cd9984f7915aab91893aa048ae2fed9e51ec - pristine_git_object: 56b8833781310b3e7c300631cc0e0a66f97efc4f + last_write_checksum: sha1:25325f38ff9226e3d977f13708341c3ede65cc51 + pristine_git_object: b995898c8db408d20edd2aab81a06d90085d7604 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6922,8 +6922,8 @@ trackedFiles: pristine_git_object: 7a6140f2b8afb0cde9b031322a4284c9cbce7e33 src/openrouter/components/chatfunctiontool.py: id: 1fcf92f8a7da - last_write_checksum: sha1:f5a4e444028732635ae55ff627f8f3e4f2d5695b - pristine_git_object: b62a155adffc32102f97f4160386c212b943c875 + last_write_checksum: sha1:a18e2ed4c62125b690f3baa254a8c1763f647726 + pristine_git_object: a225159f24b91219a9f3d7292feefabd81515cf6 src/openrouter/components/chatjsonschemaconfig.py: id: d2278e414fab last_write_checksum: sha1:73791c8aa5f3dec4a25903dcc9c61118fc88a4f3 @@ -10758,4 +10758,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.stt.create_transcription()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.stt.create_transcription_multipart()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.datasets.get_rankings_daily()`: `request` **Changed**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request.tools[].union(FusionServerTool_OpenRouter)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.tools[].union(FusionServerTool_OpenRouter)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 9d74094..348b9c4 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.7 + version: 0.11.8 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 3fb0f9e..ca09c7c 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -4533,6 +4533,7 @@ components: - $ref: '#/components/schemas/BashServerTool' - $ref: '#/components/schemas/DatetimeServerTool' - $ref: '#/components/schemas/FilesServerTool' + - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - $ref: '#/components/schemas/ChatSearchModelsServerTool' - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3c63cc8..ceb6fa9 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:c76873ed773f59ce59af18cd48af7b5e704346cfea03fa8d2fa7fef96fdfb465 - sourceBlobDigest: sha256:e21ec1784f2b7eb1fe3fab59deb0148cc48ecd0f4835ef56502b7e808aab231c + sourceRevisionDigest: sha256:7a4e4af7f34e5e5dc83b857eb62b94f52637b1a26b430d7e0ef087d52b7785e6 + sourceBlobDigest: sha256:48fc5a54f2206a06167402e7a65ffe98be97296dae660a3d62c5a3f9e30004e9 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:c76873ed773f59ce59af18cd48af7b5e704346cfea03fa8d2fa7fef96fdfb465 - sourceBlobDigest: sha256:e21ec1784f2b7eb1fe3fab59deb0148cc48ecd0f4835ef56502b7e808aab231c + sourceRevisionDigest: sha256:7a4e4af7f34e5e5dc83b857eb62b94f52637b1a26b430d7e0ef087d52b7785e6 + sourceBlobDigest: sha256:48fc5a54f2206a06167402e7a65ffe98be97296dae660a3d62c5a3f9e30004e9 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:ca16452a0a4478ea5a47dc4f2c60de4b9be28eab5156d58c8bf691ceabb6d742 + codeSamplesRevisionDigest: sha256:10ee60774c94f2b4646c4693a1daf788a657303a4bb0ea83bf5775d0a751a74b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 5764233..b7d300d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -178,4 +178,14 @@ Based on: ### Generated - [python v0.11.7] . ### Releases -- [PyPI v0.11.7] https://pypi.org/project/openrouter/0.11.7 - . \ No newline at end of file +- [PyPI v0.11.7] https://pypi.org/project/openrouter/0.11.7 - . + +## 2026-07-08 03:29:04 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.8] . +### Releases +- [PyPI v0.11.8] https://pypi.org/project/openrouter/0.11.8 - . \ No newline at end of file diff --git a/docs/components/chatfunctiontool.mdx b/docs/components/chatfunctiontool.mdx index 41b4523..bc9f2fa 100644 --- a/docs/components/chatfunctiontool.mdx +++ b/docs/components/chatfunctiontool.mdx @@ -37,6 +37,12 @@ value: components.DatetimeServerTool = /* values here */ value: components.FilesServerTool = /* values here */ ``` +### `components.FusionServerToolOpenRouter` + +```python +value: components.FusionServerToolOpenRouter = /* values here */ +``` + ### `components.ImageGenerationServerToolOpenRouter` ```python diff --git a/pyproject.toml b/pyproject.toml index 0ab0806..bc961c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.7" +version = "0.11.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 56b8833..b995898 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.7" +__version__: str = "0.11.8" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.7 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.8 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/chatfunctiontool.py b/src/openrouter/components/chatfunctiontool.py index b62a155..a225159 100644 --- a/src/openrouter/components/chatfunctiontool.py +++ b/src/openrouter/components/chatfunctiontool.py @@ -20,6 +20,10 @@ from .chatwebsearchshorthand import ( ) from .datetimeservertool import DatetimeServerTool, DatetimeServerToolTypedDict from .filesservertool import FilesServerTool, FilesServerToolTypedDict +from .fusionservertool_openrouter import ( + FusionServerToolOpenRouter, + FusionServerToolOpenRouterTypedDict, +) from .imagegenerationservertool_openrouter import ( ImageGenerationServerToolOpenRouter, ImageGenerationServerToolOpenRouterTypedDict, @@ -143,6 +147,7 @@ ChatFunctionToolTypedDict = TypeAliasType( BashServerToolTypedDict, DatetimeServerToolTypedDict, FilesServerToolTypedDict, + FusionServerToolOpenRouterTypedDict, ImageGenerationServerToolOpenRouterTypedDict, ChatSearchModelsServerToolTypedDict, SubagentServerToolOpenRouterTypedDict, @@ -162,6 +167,7 @@ ChatFunctionTool = TypeAliasType( BashServerTool, DatetimeServerTool, FilesServerTool, + FusionServerToolOpenRouter, ImageGenerationServerToolOpenRouter, ChatSearchModelsServerTool, SubagentServerToolOpenRouter, diff --git a/uv.lock b/uv.lock index 7d3ca0a..7f529be 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.7" +version = "0.11.8" source = { editable = "." } dependencies = [ { name = "httpcore" }, From abaad35c7e81a234e8224b0816d349ad5b732fc4 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 06:59:19 +0000 Subject: [PATCH 13/62] chore: update OpenAPI spec from monorepo (#405) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index e8969c9..f311b83 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -28473,6 +28473,16 @@ paths: schema: $ref: '#/components/schemas/NotFoundResponse' description: Not Found - Resource does not exist + '413': + content: + application/json: + example: + error: + code: 413 + message: Request payload too large + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + description: Payload Too Large - Request payload exceeds size limits '429': content: application/json: From 00d71ec70ed00c77d46daffc89d2c585c6c636b7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 07:05:03 +0000 Subject: [PATCH 14/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.9=20(#406)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 34 +++++++++++++++++++--------------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 10 ++++++++++ .speakeasy/workflow.lock | 10 +++++----- RELEASES.md | 12 +++++++++++- docs/sdks/images/README.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 ++-- src/openrouter/images.py | 16 ++++++++++++++++ uv.lock | 2 +- 10 files changed, 67 insertions(+), 26 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 3029b66..a5bbd65 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: 650dff337a98bf070a3d52ab3a7ab1c3 + docChecksum: 50e8a290b50314df7023e7445cd94cb7 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.8 - configChecksum: a51ccbb5afd956309fcd066b2592f06a + releaseVersion: 0.11.9 + configChecksum: 9c016c039411cba3aa46abf1ab1badb3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 5184830b-3a82-41c6-bf4b-e4b5d536132f - pristine_commit_hash: 6261057d5344c7013ae79689331b8322cf7cc91f - pristine_tree_hash: 5c34f8ea38ccc5bd114c8bf2a16d8045c5c53e52 + generation_id: 8e196ce1-4bb9-479a-8a36-6bbf4cf7d66f + pristine_commit_hash: a316fdd152bcac88410dd9cf9e6908a4416ed3c8 + pristine_tree_hash: 6f1b53c0371fcec3591a93a8ac1967e4276cf63f features: python: acceptHeaders: 3.0.0 @@ -6386,8 +6386,8 @@ trackedFiles: pristine_git_object: d164a1da79b0838bd68f0a6560a0317eb86e0226 docs/sdks/images/README.mdx: id: 534a6c102c4f - last_write_checksum: sha1:fd7a87a3091a9cc65b1f6785fff8f3b278da1660 - pristine_git_object: 77f3172dabafbaa192b258382074cb34cfd55a5e + last_write_checksum: sha1:eb919a70e20e9bde335ff1e8ae52ba0a309ca5c3 + pristine_git_object: 8277c7710decc3ee152c7fe725c90bac9784800a docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:2a8e7baeb6586e3b46d4da14c1e4701e4625ee7d @@ -6442,8 +6442,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:3e14d3b854b2587843adcc288c3fb7a72eb4702a - pristine_git_object: bc961c19b4d009a656fba6ca0650d989217cbe22 + last_write_checksum: sha1:238a3b1285d4733be3e0d5a000d543a456ef5394 + pristine_git_object: 8d6f4efe9d7861f05cd73ed9fc603106d6f9238f scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6470,8 +6470,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:25325f38ff9226e3d977f13708341c3ede65cc51 - pristine_git_object: b995898c8db408d20edd2aab81a06d90085d7604 + last_write_checksum: sha1:3af1feffc24d94b4b72fc4721954bc0e697b4259 + pristine_git_object: a3f702d5d53068571a1198b71b220742e7f6214b src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -8774,8 +8774,8 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/openrouter/images.py: id: c4d7adf63ae0 - last_write_checksum: sha1:17dfa465ebb0408aff811872149f6ecda426a050 - pristine_git_object: 6f5c7bad3913610dbe97f5bd03837deff83faa6b + last_write_checksum: sha1:2237619daf56a48c3ee0c8980178d36443ca1b13 + pristine_git_object: b7a120ad3562280aab790be56cbf482286fe40b4 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -10721,6 +10721,8 @@ examples: application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} "529": application/json: {"error": {"code": 529, "message": "Provider returned error"}} + "413": + application/json: {"error": {"code": 413, "message": "Request payload too large"}} listImageModels: speakeasy-default-list-image-models: responses: @@ -10758,4 +10760,6 @@ examples: "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.tools[].union(FusionServerTool_OpenRouter)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.tools[].union(FusionServerTool_OpenRouter)` **Added**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.images.generate()`: `error.status[413]` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 348b9c4..4929c6a 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.8 + version: 0.11.9 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index ca09c7c..8a55da3 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -28324,6 +28324,16 @@ paths: schema: $ref: '#/components/schemas/NotFoundResponse' description: Not Found - Resource does not exist + '413': + content: + application/json: + example: + error: + code: 413 + message: Request payload too large + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + description: Payload Too Large - Request payload exceeds size limits '429': content: application/json: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ceb6fa9..51493c6 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:7a4e4af7f34e5e5dc83b857eb62b94f52637b1a26b430d7e0ef087d52b7785e6 - sourceBlobDigest: sha256:48fc5a54f2206a06167402e7a65ffe98be97296dae660a3d62c5a3f9e30004e9 + sourceRevisionDigest: sha256:c731f8b098d442f39d564a1fedec657ac7d3843f65b420ea96129da64def2d56 + sourceBlobDigest: sha256:fd18c48e9365dbfc7d68e34b39776a45cfff3c27aaba929f037f6d0ffb8e2c3c tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:7a4e4af7f34e5e5dc83b857eb62b94f52637b1a26b430d7e0ef087d52b7785e6 - sourceBlobDigest: sha256:48fc5a54f2206a06167402e7a65ffe98be97296dae660a3d62c5a3f9e30004e9 + sourceRevisionDigest: sha256:c731f8b098d442f39d564a1fedec657ac7d3843f65b420ea96129da64def2d56 + sourceBlobDigest: sha256:fd18c48e9365dbfc7d68e34b39776a45cfff3c27aaba929f037f6d0ffb8e2c3c codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:10ee60774c94f2b4646c4693a1daf788a657303a4bb0ea83bf5775d0a751a74b + codeSamplesRevisionDigest: sha256:9f518db7f190fe719cb5f362d238ec42ada2152e6c1251f78b1cbfd106b239ca workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index b7d300d..9ac8a1d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -188,4 +188,14 @@ Based on: ### Generated - [python v0.11.8] . ### Releases -- [PyPI v0.11.8] https://pypi.org/project/openrouter/0.11.8 - . \ No newline at end of file +- [PyPI v0.11.8] https://pypi.org/project/openrouter/0.11.8 - . + +## 2026-07-08 07:00:39 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.9] . +### Releases +- [PyPI v0.11.9] https://pypi.org/project/openrouter/0.11.9 - . \ No newline at end of file diff --git a/docs/sdks/images/README.mdx b/docs/sdks/images/README.mdx index 77f3172..8277c77 100644 --- a/docs/sdks/images/README.mdx +++ b/docs/sdks/images/README.mdx @@ -76,6 +76,7 @@ with OpenRouter( | errors.PaymentRequiredResponseError | 402 | application/json | | errors.ForbiddenResponseError | 403 | application/json | | errors.NotFoundResponseError | 404 | application/json | +| errors.PayloadTooLargeResponseError | 413 | application/json | | errors.TooManyRequestsResponseError | 429 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.BadGatewayResponseError | 502 | application/json | diff --git a/pyproject.toml b/pyproject.toml index bc961c1..8d6f4ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.8" +version = "0.11.9" 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 b995898..a3f702d 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.8" +__version__: str = "0.11.9" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.8 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.9 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/images.py b/src/openrouter/images.py index 6f5c7ba..b7a120a 100644 --- a/src/openrouter/images.py +++ b/src/openrouter/images.py @@ -430,6 +430,14 @@ class Images(BaseSDK): errors.NotFoundResponseErrorData, http_res, http_res_text ) raise errors.NotFoundResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "413", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res, http_res_text + ) + raise errors.PayloadTooLargeResponseError( + response_data, http_res, http_res_text + ) if utils.match_response(http_res, "429", "application/json"): http_res_text = utils.stream_to_text(http_res) response_data = unmarshal_json_response( @@ -902,6 +910,14 @@ class Images(BaseSDK): errors.NotFoundResponseErrorData, http_res, http_res_text ) raise errors.NotFoundResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "413", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res, http_res_text + ) + raise errors.PayloadTooLargeResponseError( + response_data, http_res, http_res_text + ) if utils.match_response(http_res, "429", "application/json"): http_res_text = await utils.stream_to_text_async(http_res) response_data = unmarshal_json_response( diff --git a/uv.lock b/uv.lock index 7f529be..21dc7ad 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.8" +version = "0.11.9" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 2ef07629e5fea4a304aa16d20fd8051c8cf78810 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:29:44 +0000 Subject: [PATCH 15/62] chore: update OpenAPI spec from monorepo (#407) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index f311b83..be434b2 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -9363,9 +9363,9 @@ components: type: integer media_type: description: >- - Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for - non-raster outputs such as SVG (`image/svg+xml`). - example: image/svg+xml + Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be + omitted if the format could not be determined. + example: image/png type: string type: description: The event type @@ -9531,9 +9531,9 @@ components: type: string media_type: description: >- - Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). - Present for non-raster outputs such as SVG (`image/svg+xml`). - example: image/svg+xml + Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. + May be omitted if the format could not be determined. + example: image/png type: string required: - b64_json From 05e372cf537e2e6066f49ff8792d4bfa02c7f0bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:35:25 +0000 Subject: [PATCH 16/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.10=20(#408)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 39 +++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 8 ++-- .speakeasy/workflow.lock | 10 ++--- RELEASES.md | 12 +++++- docs/components/imagegencompletedevent.mdx | 14 +++---- .../imagegenerationresponsedata.mdx | 8 ++-- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- .../components/imagegencompletedevent.py | 4 +- .../components/imagegenerationresponse.py | 4 +- uv.lock | 2 +- 12 files changed, 58 insertions(+), 51 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index a5bbd65..e3da5e5 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: 50e8a290b50314df7023e7445cd94cb7 + docChecksum: 26f46e3c834197b7bc10a6e6c1c6ba9f docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.9 - configChecksum: 9c016c039411cba3aa46abf1ab1badb3 + releaseVersion: 0.11.10 + configChecksum: 196bea01b3663ba0c9fdcc5a798cbc32 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 8e196ce1-4bb9-479a-8a36-6bbf4cf7d66f - pristine_commit_hash: a316fdd152bcac88410dd9cf9e6908a4416ed3c8 - pristine_tree_hash: 6f1b53c0371fcec3591a93a8ac1967e4276cf63f + generation_id: aec5cf4e-117a-47a0-8159-8a6d7ca86365 + pristine_commit_hash: 26539b409b95eeb377bfa623b3f12986c8084558 + pristine_tree_hash: 1e58f3d7bd2923db31822357308a4c3358e7e7e5 features: python: acceptHeaders: 3.0.0 @@ -2062,8 +2062,8 @@ trackedFiles: pristine_git_object: 8eb6786a519936cce87262623156a61e2f645c38 docs/components/imagegencompletedevent.mdx: id: 2b1b82b2ff79 - last_write_checksum: sha1:3d4e28577da1d6ee353a8f3bdacbc45e8a1c043a - pristine_git_object: 90ddd67dae34e0fed8c622edf27638d47709f3f7 + last_write_checksum: sha1:2e4d746322e73bf36923a7f14ff6888207b660d6 + pristine_git_object: 247d9e47e9583ec3778ca94cc3fadee3a4034376 docs/components/imagegencompletedeventtype.mdx: id: dd9998bc9093 last_write_checksum: sha1:a7d7c52d0a7c5128a40fd9f1524e8b6f372a9061 @@ -2106,8 +2106,8 @@ trackedFiles: pristine_git_object: b6e0e2c0dadc42fd0fbfaeb9b81f12efb62ff051 docs/components/imagegenerationresponsedata.mdx: id: 1afc55d56268 - last_write_checksum: sha1:04d65c9889436bc57b88dc1e9e98765f86d9da29 - pristine_git_object: 78ec1e139b813231ed78ecf7f337cb277180b7a8 + last_write_checksum: sha1:7960f5fce39a388da2aaf3a39a38d5c27f17da10 + pristine_git_object: e36ed8937fc9401d2741d97cc03ff5c0ffc3bd52 docs/components/imagegenerationservertool.mdx: id: "299013078656" last_write_checksum: sha1:663ae715382f7f22890ea81a43ddb3cd0c07cf6b @@ -6442,8 +6442,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:238a3b1285d4733be3e0d5a000d543a456ef5394 - pristine_git_object: 8d6f4efe9d7861f05cd73ed9fc603106d6f9238f + last_write_checksum: sha1:873cc7036938ca992145fa28afb0fb5ea2e513ca + pristine_git_object: afaaf4d246119c26a1cba696bbea015daf43fe5f scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6470,8 +6470,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:3af1feffc24d94b4b72fc4721954bc0e697b4259 - pristine_git_object: a3f702d5d53068571a1198b71b220742e7f6214b + last_write_checksum: sha1:a64fdf174e7ccce65f0d2619aed5e905c88dc30d + pristine_git_object: f7bcfe2ddc56fb83561f2b5ef3a3475b70d3f18f src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -7442,16 +7442,16 @@ trackedFiles: pristine_git_object: 5f17d77c25a82ad2bf7b1211d05ee665b6fee35a src/openrouter/components/imagegencompletedevent.py: id: 7a791a02cb5b - last_write_checksum: sha1:bd73865dd7ffd0ff9ec34b2edd484e4f0a3bde61 - pristine_git_object: ca3f68a4504570acfdc9c095ccdecfbb636c30f1 + last_write_checksum: sha1:497f9be381527fd1ee961450a2364a898dba875b + pristine_git_object: 6b9a8990973466285f9b49b366bbc5fc1ae42e41 src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 last_write_checksum: sha1:179a0b7ea9363fa826749e8bb6fb21074433e43e pristine_git_object: fbb59ab7c3ea49aa774b4fc917eb9ed9d4484d32 src/openrouter/components/imagegenerationresponse.py: id: 53354cd0cbfc - last_write_checksum: sha1:8c42a25c58b589aad6031d2c1734eabcf1a1b143 - pristine_git_object: 7eddf64ed888d59494938f38e2b9035e7ba2b38e + last_write_checksum: sha1:53f1cde7b8bfe4f9e786a76f6e57b0a1f76aced2 + pristine_git_object: 687008d328b39a67390cdf0ab3eb8f6179ae6f7c src/openrouter/components/imagegenerationservertool.py: id: 9c95bc975f2e last_write_checksum: sha1:f87c338c9b54030623f7f3e32f08a064e411f76c @@ -10760,6 +10760,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.images.generate()`: `error.status[413]` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4929c6a..2896614 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.9 + version: 0.11.10 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 8a55da3..b283dbb 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9306,8 +9306,8 @@ components: type: integer media_type: description: >- - Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`). - example: image/svg+xml + Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined. + example: image/png type: string type: description: The event type @@ -9471,8 +9471,8 @@ components: type: string media_type: description: >- - Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`). - example: image/svg+xml + Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined. + example: image/png type: string required: - b64_json diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 51493c6..ec4835c 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:c731f8b098d442f39d564a1fedec657ac7d3843f65b420ea96129da64def2d56 - sourceBlobDigest: sha256:fd18c48e9365dbfc7d68e34b39776a45cfff3c27aaba929f037f6d0ffb8e2c3c + sourceRevisionDigest: sha256:87aa335eb202bedb623990e67878aeccd1338fdea6fb68c51d211ad8155652bf + sourceBlobDigest: sha256:98310b3c6bd4b7b0c9e45f9b9402c28a43ee7e81669d401ce000be1885dd4aea tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:c731f8b098d442f39d564a1fedec657ac7d3843f65b420ea96129da64def2d56 - sourceBlobDigest: sha256:fd18c48e9365dbfc7d68e34b39776a45cfff3c27aaba929f037f6d0ffb8e2c3c + sourceRevisionDigest: sha256:87aa335eb202bedb623990e67878aeccd1338fdea6fb68c51d211ad8155652bf + sourceBlobDigest: sha256:98310b3c6bd4b7b0c9e45f9b9402c28a43ee7e81669d401ce000be1885dd4aea codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:9f518db7f190fe719cb5f362d238ec42ada2152e6c1251f78b1cbfd106b239ca + codeSamplesRevisionDigest: sha256:7fa7234a88a43ca2e6a2b0a9b47dcf355f9a3875c0c46977a99bca9a1c784418 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 9ac8a1d..57c0f11 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -198,4 +198,14 @@ Based on: ### Generated - [python v0.11.9] . ### Releases -- [PyPI v0.11.9] https://pypi.org/project/openrouter/0.11.9 - . \ No newline at end of file +- [PyPI v0.11.9] https://pypi.org/project/openrouter/0.11.9 - . + +## 2026-07-08 09:31:18 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.10] . +### Releases +- [PyPI v0.11.10] https://pypi.org/project/openrouter/0.11.10 - . \ No newline at end of file diff --git a/docs/components/imagegencompletedevent.mdx b/docs/components/imagegencompletedevent.mdx index 90ddd67..247d9e4 100644 --- a/docs/components/imagegencompletedevent.mdx +++ b/docs/components/imagegencompletedevent.mdx @@ -7,10 +7,10 @@ Emitted when generation completes and the final image is available ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded final image data | | -| `created` | *int* | :heavy_check_mark: | Unix timestamp (seconds) when the image was generated | | -| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`). | image/svg+xml | -| `type` | [components.ImageGenCompletedEventType](../components/imagegencompletedeventtype.mdx) | :heavy_check_mark: | The event type | | -| `usage` | [Optional[components.ImageGenerationUsage]](../components/imagegenerationusage.mdx) | :heavy_minus_sign: | Token and cost usage for the image generation request, when available | \{
"completion_tokens": 4175,
"cost": 0.04,
"prompt_tokens": 0,
"total_tokens": 4175
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded final image data | | +| `created` | *int* | :heavy_check_mark: | Unix timestamp (seconds) when the image was generated | | +| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined. | image/png | +| `type` | [components.ImageGenCompletedEventType](../components/imagegencompletedeventtype.mdx) | :heavy_check_mark: | The event type | | +| `usage` | [Optional[components.ImageGenerationUsage]](../components/imagegenerationusage.mdx) | :heavy_minus_sign: | Token and cost usage for the image generation request, when available | \{
"completion_tokens": 4175,
"cost": 0.04,
"prompt_tokens": 0,
"total_tokens": 4175
} | \ No newline at end of file diff --git a/docs/components/imagegenerationresponsedata.mdx b/docs/components/imagegenerationresponsedata.mdx index 78ec1e1..e36ed89 100644 --- a/docs/components/imagegenerationresponsedata.mdx +++ b/docs/components/imagegenerationresponsedata.mdx @@ -4,7 +4,7 @@ title: "ImageGenerationResponseData" ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded image bytes | | -| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`). | image/svg+xml | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded image bytes | | +| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined. | image/png | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8d6f4ef..afaaf4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.9" +version = "0.11.10" 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 a3f702d..f7bcfe2 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.9" +__version__: str = "0.11.10" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.9 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.10 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/imagegencompletedevent.py b/src/openrouter/components/imagegencompletedevent.py index ca3f68a..6b9a899 100644 --- a/src/openrouter/components/imagegencompletedevent.py +++ b/src/openrouter/components/imagegencompletedevent.py @@ -22,7 +22,7 @@ class ImageGenCompletedEventTypedDict(TypedDict): type: ImageGenCompletedEventType r"""The event type""" media_type: NotRequired[str] - r"""Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`).""" + r"""Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined.""" usage: NotRequired[ImageGenerationUsageTypedDict] r"""Token and cost usage for the image generation request, when available""" @@ -40,7 +40,7 @@ class ImageGenCompletedEvent(BaseModel): r"""The event type""" media_type: Optional[str] = None - r"""Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`).""" + r"""Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined.""" usage: Optional[ImageGenerationUsage] = None r"""Token and cost usage for the image generation request, when available""" diff --git a/src/openrouter/components/imagegenerationresponse.py b/src/openrouter/components/imagegenerationresponse.py index 7eddf64..687008d 100644 --- a/src/openrouter/components/imagegenerationresponse.py +++ b/src/openrouter/components/imagegenerationresponse.py @@ -12,7 +12,7 @@ class ImageGenerationResponseDataTypedDict(TypedDict): b64_json: str r"""Base64-encoded image bytes""" media_type: NotRequired[str] - r"""Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`).""" + r"""Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined.""" class ImageGenerationResponseData(BaseModel): @@ -20,7 +20,7 @@ class ImageGenerationResponseData(BaseModel): r"""Base64-encoded image bytes""" media_type: Optional[str] = None - r"""Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`).""" + r"""Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/uv.lock b/uv.lock index 21dc7ad..6f3b043 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.9" +version = "0.11.10" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 1da6f0d903d7b28ea01417215b5f85898ea679da Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 19:06:06 +0000 Subject: [PATCH 17/62] chore: update OpenAPI spec from monorepo (#409) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index be434b2..403a536 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -9829,6 +9829,35 @@ components: - type - error type: object + ImageGenTextChunkEvent: + description: Emitted when a text chunk becomes available during streaming generation of text-based formats (e.g. SVG) + example: + phase: content + text: + type: image_generation.text_chunk + properties: + phase: + description: >- + The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are + intermediate provider phases. + enum: + - content + - reasoning + - draft + type: string + text: + description: A text fragment of the image being generated (e.g. partial SVG markup) + type: string + type: + description: The event type + enum: + - image_generation.text_chunk + type: string + required: + - type + - text + - phase + type: object ImageModelArchitecture: example: input_modalities: @@ -10032,6 +10061,7 @@ components: data: anyOf: - $ref: '#/components/schemas/ImageGenPartialImageEvent' + - $ref: '#/components/schemas/ImageGenTextChunkEvent' - $ref: '#/components/schemas/ImageGenCompletedEvent' - $ref: '#/components/schemas/ImageGenStreamErrorEvent' required: From 164490028b398161c7c4c5a0723e54937cdc0d53 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 19:10:58 +0000 Subject: [PATCH 18/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.11=20(#410)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 51 +++++++++++++------ .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 30 +++++++++++ .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 ++++- docs/components/imagegentextchunkevent.mdx | 14 +++++ .../imagegentextchunkeventphase.mdx | 23 +++++++++ .../components/imagegentextchunkeventtype.mdx | 17 +++++++ .../components/imagestreamingresponsedata.mdx | 6 +++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 14 +++++ .../components/imagegentextchunkevent.py | 45 ++++++++++++++++ .../components/imagestreamingresponse.py | 7 +++ uv.lock | 2 +- 15 files changed, 212 insertions(+), 27 deletions(-) create mode 100644 docs/components/imagegentextchunkevent.mdx create mode 100644 docs/components/imagegentextchunkeventphase.mdx create mode 100644 docs/components/imagegentextchunkeventtype.mdx create mode 100644 src/openrouter/components/imagegentextchunkevent.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index e3da5e5..24c4d70 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: 26f46e3c834197b7bc10a6e6c1c6ba9f + docChecksum: afeda9d88fc53bdc999b51cbbfc38e5e docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.10 - configChecksum: 196bea01b3663ba0c9fdcc5a798cbc32 + releaseVersion: 0.11.11 + configChecksum: ae2567ccf8234af257af2be5ae3dbbd1 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: aec5cf4e-117a-47a0-8159-8a6d7ca86365 - pristine_commit_hash: 26539b409b95eeb377bfa623b3f12986c8084558 - pristine_tree_hash: 1e58f3d7bd2923db31822357308a4c3358e7e7e5 + generation_id: 5b3c1f6f-8726-47a8-9cc7-06c617d38a5c + pristine_commit_hash: 76b75ea93007df78d1485757c023c321759bea7b + pristine_tree_hash: 8654a70e996630eaf827850b4aec1216cb1fe692 features: python: acceptHeaders: 3.0.0 @@ -2180,6 +2180,18 @@ trackedFiles: id: 4aebc0906c32 last_write_checksum: sha1:cc721e8cb94394423b023926244b51f981a1840e pristine_git_object: dc1d52997ba58bd62e44c145f3f954ff619d95b9 + docs/components/imagegentextchunkevent.mdx: + id: 90061f61e915 + last_write_checksum: sha1:737477edb091fd149324f9126be49b3e25c8d456 + pristine_git_object: 9c2837aabc4b5ee6f947ae9bca1412d756f261f9 + docs/components/imagegentextchunkeventphase.mdx: + id: d0833d90ca7f + last_write_checksum: sha1:31d0056d886bb9c4b74a04debc2e29e63f2ccd60 + pristine_git_object: b9333b18b1926cb5ba5c8d781e82c57a5ade4a75 + docs/components/imagegentextchunkeventtype.mdx: + id: 352d5a931932 + last_write_checksum: sha1:6d49bb73e36c227f1db9a865435ec47fc3076986 + pristine_git_object: fffb82a794389680343b9317dd08062214edf303 docs/components/imagemodelarchitecture.mdx: id: 605b7d0df8cd last_write_checksum: sha1:4d1003bc766ebe55e79e172c1f959ccb3b945487 @@ -2210,8 +2222,8 @@ trackedFiles: pristine_git_object: 8aad6cc3403b2d0874a7b591248988f3089d33ad docs/components/imagestreamingresponsedata.mdx: id: 4376edf71a13 - last_write_checksum: sha1:5e6ed13b281270c672168c506b36d7e3b16789cf - pristine_git_object: 104002712c11896019f0ef05708333ce6631d4d1 + last_write_checksum: sha1:b782a29aa28c0b85e153a67f919d6080eec96b9d + pristine_git_object: 290f4510d7e41e612aefc61cefa9560a432b0ae1 docs/components/incompletedetails.mdx: id: d83c063d7285 last_write_checksum: sha1:b24c3be63176609c48ae9b19582c520ba1683ce7 @@ -6442,8 +6454,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:873cc7036938ca992145fa28afb0fb5ea2e513ca - pristine_git_object: afaaf4d246119c26a1cba696bbea015daf43fe5f + last_write_checksum: sha1:8ddea0ed1450ec8900293e8184a4637d2c0b10ad + pristine_git_object: b33321664705f741a9e137daa2bbcaee1c59769a scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6470,8 +6482,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:a64fdf174e7ccce65f0d2619aed5e905c88dc30d - pristine_git_object: f7bcfe2ddc56fb83561f2b5ef3a3475b70d3f18f + last_write_checksum: sha1:542e8a57c7755042b8d06156a68deaed693b26f3 + pristine_git_object: ee676105646212488a6db0f5b340ff23483c94f6 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6510,8 +6522,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:67dca4a903421d2bf39474047c5953b2c4432d70 - pristine_git_object: 6fd499892576c4bff0ee51dc59e77b99ff239f7f + last_write_checksum: sha1:0896a3e5a8c1132e269dde09952c109915b76957 + pristine_git_object: 3969a96e0f587fa91f77e55376f5743ab1c99af7 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -7484,6 +7496,10 @@ trackedFiles: id: 15c890eb8a08 last_write_checksum: sha1:29a04e6dc39f00f7784cc9228348a3b6f129b416 pristine_git_object: 80006d6d186baf7838a40a93839cdea5375256f2 + src/openrouter/components/imagegentextchunkevent.py: + id: 5cfc6caf763d + last_write_checksum: sha1:79c33282493bf247e4f761e878cc8242b0992c2c + pristine_git_object: d433ceae961e91fee4732913cfae463775322981 src/openrouter/components/imagemodelarchitecture.py: id: 5f3e50733fe9 last_write_checksum: sha1:cc9bee6400f1b7b65ff1c86c5d6bcd5eeab03209 @@ -7510,8 +7526,8 @@ trackedFiles: pristine_git_object: 4e4c1cb067ac9184362a7284906f13c442cc152b src/openrouter/components/imagestreamingresponse.py: id: 7de5604ae99c - last_write_checksum: sha1:9148415c3a30065e7b1c373818a4d2ae4fc73ace - pristine_git_object: 877d1986f2a7e941f17532061468b5115a7b0d7f + last_write_checksum: sha1:b27e74509fefd10a10fc5e1a75ea8c1efcaa713f + pristine_git_object: d8a39f6587ab7b80f097dda43b908d406539a905 src/openrouter/components/incompletedetails.py: id: 1984e5246b23 last_write_checksum: sha1:573c1e6509ff2a9e1224725ec74e69f1c720eb09 @@ -10760,3 +10776,6 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: | + ## Python SDK Changes: + * `open_router.images.generate()`: `response.[].data.union(image_generation.text_chunk)` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 2896614..2fa6a74 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.10 + version: 0.11.11 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index b283dbb..5c7c375 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9772,6 +9772,35 @@ components: - type - error type: object + ImageGenTextChunkEvent: + description: Emitted when a text chunk becomes available during streaming generation of text-based formats (e.g. SVG) + example: + phase: content + text: + type: image_generation.text_chunk + properties: + phase: + description: >- + The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases. + enum: + - content + - reasoning + - draft + type: string + x-speakeasy-unknown-values: allow + text: + description: A text fragment of the image being generated (e.g. partial SVG markup) + type: string + type: + description: The event type + enum: + - image_generation.text_chunk + type: string + required: + - type + - text + - phase + type: object ImageModelArchitecture: example: input_modalities: @@ -9977,6 +10006,7 @@ components: data: anyOf: - $ref: '#/components/schemas/ImageGenPartialImageEvent' + - $ref: '#/components/schemas/ImageGenTextChunkEvent' - $ref: '#/components/schemas/ImageGenCompletedEvent' - $ref: '#/components/schemas/ImageGenStreamErrorEvent' required: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ec4835c..ed2bf95 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:87aa335eb202bedb623990e67878aeccd1338fdea6fb68c51d211ad8155652bf - sourceBlobDigest: sha256:98310b3c6bd4b7b0c9e45f9b9402c28a43ee7e81669d401ce000be1885dd4aea + sourceRevisionDigest: sha256:87e4c596d105bb13f76c310ec8d8d44d3ffb0350b4c451569fabb11aeeb5bbbd + sourceBlobDigest: sha256:a371855a3645703bef21de566fde2c87342bb0a654e529c38f4344b8ad5e705b tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:87aa335eb202bedb623990e67878aeccd1338fdea6fb68c51d211ad8155652bf - sourceBlobDigest: sha256:98310b3c6bd4b7b0c9e45f9b9402c28a43ee7e81669d401ce000be1885dd4aea + sourceRevisionDigest: sha256:87e4c596d105bb13f76c310ec8d8d44d3ffb0350b4c451569fabb11aeeb5bbbd + sourceBlobDigest: sha256:a371855a3645703bef21de566fde2c87342bb0a654e529c38f4344b8ad5e705b codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:7fa7234a88a43ca2e6a2b0a9b47dcf355f9a3875c0c46977a99bca9a1c784418 + codeSamplesRevisionDigest: sha256:1600c45d7815b8e0a480752fa1fa1f7cb9919e492d2fd2e0162d83e4ad69cfae workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 57c0f11..7d52284 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -208,4 +208,14 @@ Based on: ### Generated - [python v0.11.10] . ### Releases -- [PyPI v0.11.10] https://pypi.org/project/openrouter/0.11.10 - . \ No newline at end of file +- [PyPI v0.11.10] https://pypi.org/project/openrouter/0.11.10 - . + +## 2026-07-08 19:07:22 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.11] . +### Releases +- [PyPI v0.11.11] https://pypi.org/project/openrouter/0.11.11 - . \ No newline at end of file diff --git a/docs/components/imagegentextchunkevent.mdx b/docs/components/imagegentextchunkevent.mdx new file mode 100644 index 0000000..9c2837a --- /dev/null +++ b/docs/components/imagegentextchunkevent.mdx @@ -0,0 +1,14 @@ +--- +title: "ImageGenTextChunkEvent" +--- + +Emitted when a text chunk becomes available during streaming generation of text-based formats (e.g. SVG) + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `phase` | [components.ImageGenTextChunkEventPhase](../components/imagegentextchunkeventphase.mdx) | :heavy_check_mark: | The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases. | +| `text` | *str* | :heavy_check_mark: | A text fragment of the image being generated (e.g. partial SVG markup) | +| `type` | [components.ImageGenTextChunkEventType](../components/imagegentextchunkeventtype.mdx) | :heavy_check_mark: | The event type | \ No newline at end of file diff --git a/docs/components/imagegentextchunkeventphase.mdx b/docs/components/imagegentextchunkeventphase.mdx new file mode 100644 index 0000000..b9333b1 --- /dev/null +++ b/docs/components/imagegentextchunkeventphase.mdx @@ -0,0 +1,23 @@ +--- +title: "ImageGenTextChunkEventPhase" +--- + +The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases. + +## Example Usage + +```python +from openrouter.components import ImageGenTextChunkEventPhase + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ImageGenTextChunkEventPhase = "content" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"content"` +- `"reasoning"` +- `"draft"` diff --git a/docs/components/imagegentextchunkeventtype.mdx b/docs/components/imagegentextchunkeventtype.mdx new file mode 100644 index 0000000..fffb82a --- /dev/null +++ b/docs/components/imagegentextchunkeventtype.mdx @@ -0,0 +1,17 @@ +--- +title: "ImageGenTextChunkEventType" +--- + +The event type + +## Example Usage + +```python +from openrouter.components import ImageGenTextChunkEventType +value: ImageGenTextChunkEventType = "image_generation.text_chunk" +``` + + +## Values + +- `"image_generation.text_chunk"` diff --git a/docs/components/imagestreamingresponsedata.mdx b/docs/components/imagestreamingresponsedata.mdx index 1040027..290f451 100644 --- a/docs/components/imagestreamingresponsedata.mdx +++ b/docs/components/imagestreamingresponsedata.mdx @@ -10,6 +10,12 @@ title: "ImageStreamingResponseData" value: components.ImageGenPartialImageEvent = /* values here */ ``` +### `components.ImageGenTextChunkEvent` + +```python +value: components.ImageGenTextChunkEvent = /* values here */ +``` + ### `components.ImageGenCompletedEvent` ```python diff --git a/pyproject.toml b/pyproject.toml index afaaf4d..b333216 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.10" +version = "0.11.11" 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 f7bcfe2..ee67610 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.10" +__version__: str = "0.11.11" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.10 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.11 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 6fd4998..3969a96 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1179,6 +1179,12 @@ if TYPE_CHECKING: ImageGenStreamErrorEventType, ImageGenStreamErrorEventTypedDict, ) + from .imagegentextchunkevent import ( + ImageGenTextChunkEvent, + ImageGenTextChunkEventPhase, + ImageGenTextChunkEventType, + ImageGenTextChunkEventTypedDict, + ) from .imagemodelarchitecture import ( ImageModelArchitecture, ImageModelArchitectureTypedDict, @@ -3533,6 +3539,10 @@ __all__ = [ "ImageGenStreamErrorEventErrorTypedDict", "ImageGenStreamErrorEventType", "ImageGenStreamErrorEventTypedDict", + "ImageGenTextChunkEvent", + "ImageGenTextChunkEventPhase", + "ImageGenTextChunkEventType", + "ImageGenTextChunkEventTypedDict", "ImageGenerationRequest", "ImageGenerationRequestAspectRatio", "ImageGenerationRequestBackground", @@ -5556,6 +5566,10 @@ _dynamic_imports: dict[str, str] = { "ImageGenStreamErrorEventErrorTypedDict": ".imagegenstreamerrorevent", "ImageGenStreamErrorEventType": ".imagegenstreamerrorevent", "ImageGenStreamErrorEventTypedDict": ".imagegenstreamerrorevent", + "ImageGenTextChunkEvent": ".imagegentextchunkevent", + "ImageGenTextChunkEventPhase": ".imagegentextchunkevent", + "ImageGenTextChunkEventType": ".imagegentextchunkevent", + "ImageGenTextChunkEventTypedDict": ".imagegentextchunkevent", "ImageModelArchitecture": ".imagemodelarchitecture", "ImageModelArchitectureTypedDict": ".imagemodelarchitecture", "ImageModelEndpointsResponse": ".imagemodelendpointsresponse", diff --git a/src/openrouter/components/imagegentextchunkevent.py b/src/openrouter/components/imagegentextchunkevent.py new file mode 100644 index 0000000..d433cea --- /dev/null +++ b/src/openrouter/components/imagegentextchunkevent.py @@ -0,0 +1,45 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from typing import Literal, Union +from typing_extensions import TypedDict + + +ImageGenTextChunkEventPhase = Union[ + Literal[ + "content", + "reasoning", + "draft", + ], + UnrecognizedStr, +] +r"""The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.""" + + +ImageGenTextChunkEventType = Literal["image_generation.text_chunk",] +r"""The event type""" + + +class ImageGenTextChunkEventTypedDict(TypedDict): + r"""Emitted when a text chunk becomes available during streaming generation of text-based formats (e.g. SVG)""" + + phase: ImageGenTextChunkEventPhase + r"""The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.""" + text: str + r"""A text fragment of the image being generated (e.g. partial SVG markup)""" + type: ImageGenTextChunkEventType + r"""The event type""" + + +class ImageGenTextChunkEvent(BaseModel): + r"""Emitted when a text chunk becomes available during streaming generation of text-based formats (e.g. SVG)""" + + phase: ImageGenTextChunkEventPhase + r"""The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.""" + + text: str + r"""A text fragment of the image being generated (e.g. partial SVG markup)""" + + type: ImageGenTextChunkEventType + r"""The event type""" diff --git a/src/openrouter/components/imagestreamingresponse.py b/src/openrouter/components/imagestreamingresponse.py index 877d198..d8a39f6 100644 --- a/src/openrouter/components/imagestreamingresponse.py +++ b/src/openrouter/components/imagestreamingresponse.py @@ -13,6 +13,10 @@ from .imagegenstreamerrorevent import ( ImageGenStreamErrorEvent, ImageGenStreamErrorEventTypedDict, ) +from .imagegentextchunkevent import ( + ImageGenTextChunkEvent, + ImageGenTextChunkEventTypedDict, +) from functools import partial from openrouter.types import BaseModel from openrouter.utils.unions import parse_open_union @@ -27,6 +31,7 @@ ImageStreamingResponseDataTypedDict = TypeAliasType( Union[ ImageGenStreamErrorEventTypedDict, ImageGenPartialImageEventTypedDict, + ImageGenTextChunkEventTypedDict, ImageGenCompletedEventTypedDict, ], ) @@ -44,6 +49,7 @@ class UnknownImageStreamingResponseData(BaseModel): _IMAGE_STREAMING_RESPONSE_DATA_VARIANTS: dict[str, Any] = { "image_generation.partial_image": ImageGenPartialImageEvent, + "image_generation.text_chunk": ImageGenTextChunkEvent, "image_generation.completed": ImageGenCompletedEvent, "error": ImageGenStreamErrorEvent, } @@ -52,6 +58,7 @@ _IMAGE_STREAMING_RESPONSE_DATA_VARIANTS: dict[str, Any] = { ImageStreamingResponseData = Annotated[ Union[ ImageGenPartialImageEvent, + ImageGenTextChunkEvent, ImageGenCompletedEvent, ImageGenStreamErrorEvent, UnknownImageStreamingResponseData, diff --git a/uv.lock b/uv.lock index 6f3b043..87fde5f 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.10" +version = "0.11.11" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 8ba375943d35f82bb82f6ef00a3d6bb49390d44e Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 10:07:32 +0000 Subject: [PATCH 19/62] chore: update OpenAPI spec from monorepo (#411) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 403a536..25399a2 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -18932,6 +18932,15 @@ components: - FakeProvider example: OpenAI type: string + routed_service_tier: + description: >- + The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is + determined by the provider response and may differ. + enum: + - flex + - priority + example: priority + type: string status: description: HTTP status code from the provider example: 200 From 75678a07aa60eb1b9942228e72faf89c9722a1fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 10:18:20 +0000 Subject: [PATCH 20/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.12=20(#412)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 38 ++++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 9 +++++ .speakeasy/workflow.lock | 10 ++--- RELEASES.md | 12 +++++- docs/components/providerresponse.mdx | 19 +++++----- docs/components/routedservicetier.mdx | 22 +++++++++++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 3 ++ src/openrouter/components/providerresponse.py | 16 ++++++++ uv.lock | 2 +- 12 files changed, 102 insertions(+), 37 deletions(-) create mode 100644 docs/components/routedservicetier.mdx diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 24c4d70..726c6bb 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: afeda9d88fc53bdc999b51cbbfc38e5e + docChecksum: 806da48c3f8b0f6fcd8822556deb2d52 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.11 - configChecksum: ae2567ccf8234af257af2be5ae3dbbd1 + releaseVersion: 0.11.12 + configChecksum: 716de99521ede522990999611400003e repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 5b3c1f6f-8726-47a8-9cc7-06c617d38a5c - pristine_commit_hash: 76b75ea93007df78d1485757c023c321759bea7b - pristine_tree_hash: 8654a70e996630eaf827850b4aec1216cb1fe692 + generation_id: 8679aa3b-5d9e-4893-8022-baf536bf7090 + pristine_commit_hash: 65881050ceed3021f70ad4f272545c4b4a65c4b1 + pristine_tree_hash: 81dbfc8598b20a107de700cfb2a93473c41dde40 features: python: acceptHeaders: 3.0.0 @@ -3818,8 +3818,8 @@ trackedFiles: pristine_git_object: 750d3a21ada3133dba71217f0444c2064b2ff081 docs/components/providerresponse.mdx: id: 36e1a24f90b6 - last_write_checksum: sha1:8cc7665df40a74a5df41e654e7824b6cdd8a2155 - pristine_git_object: 65abb901a8ffeeafa89279f5e15d885cbaa297ec + last_write_checksum: sha1:512adc6bd7e7854ce01d5e5c46ce76b26a1b1174 + pristine_git_object: dd376f0952fa0517dd83b06ed7afc2c856123dbc docs/components/providerresponseprovidername.mdx: id: 2fc17b61e546 last_write_checksum: sha1:3c9ef87051135f7aa37e89b7b952aed3b8e2c13a @@ -4124,6 +4124,10 @@ trackedFiles: id: 5eefe41f1850 last_write_checksum: sha1:06ac8357212098a2e461592ff4cd29ef9e7e1fe1 pristine_git_object: a9e4e2a7461ba24eedfd00740bf4522607e64a04 + docs/components/routedservicetier.mdx: + id: 1ecc7cdd925e + last_write_checksum: sha1:538e8fc60dab1d88f2b735682161cc8ab6101d5d + pristine_git_object: 0c826312b0c506004b51e7dbcaceb82639046687 docs/components/routerattempt.mdx: id: 372598a145ed last_write_checksum: sha1:51d8aee604f0093ea6df2df0fd73f02241190f70 @@ -6454,8 +6458,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:8ddea0ed1450ec8900293e8184a4637d2c0b10ad - pristine_git_object: b33321664705f741a9e137daa2bbcaee1c59769a + last_write_checksum: sha1:ac2002f15d1247065c7cb46d7eefa45718cff498 + pristine_git_object: e6ead548984f180e102da37f58096846d8587c7e scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6482,8 +6486,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:542e8a57c7755042b8d06156a68deaed693b26f3 - pristine_git_object: ee676105646212488a6db0f5b340ff23483c94f6 + last_write_checksum: sha1:48782d3a645f92804e627ef77ff3a65b355a5e74 + pristine_git_object: 9208d774c192a728cd2db520bd8ca629d9b2e37c src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6522,8 +6526,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:0896a3e5a8c1132e269dde09952c109915b76957 - pristine_git_object: 3969a96e0f587fa91f77e55376f5743ab1c99af7 + last_write_checksum: sha1:fa3d53883e45a8fb738127b91ca4f16c9ff29c9d + pristine_git_object: b5563aa875171f1bc0051960b459f8ee37314405 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8122,8 +8126,8 @@ trackedFiles: pristine_git_object: abbb3cb3d7d8946aabdbd5e6b07b2e45954f6948 src/openrouter/components/providerresponse.py: id: ad3887be54c5 - last_write_checksum: sha1:98ca4edc575c9c99ba342a4a490268308a0ac4e8 - pristine_git_object: 757907b8bdc224a0b94835fcec085a9f85172d45 + last_write_checksum: sha1:2db05f9a797fe78377f5f7ff426f51a47a998be8 + pristine_git_object: ccc9f82da58ced9e49b6f14f0f73075efcb84307 src/openrouter/components/providersort.py: id: 348e382bf494 last_write_checksum: sha1:57551507f95cd2e16ef995e1c13f859fd0726152 @@ -10778,4 +10782,4 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.images.generate()`: `response.[].data.union(image_generation.text_chunk)` **Added** + * `open_router.generations.get_generation()`: `response.data.provider_responses[].routed_service_tier` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 2fa6a74..f5bd70d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.11 + version: 0.11.12 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 5c7c375..eec586f 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -18824,6 +18824,15 @@ components: example: OpenAI type: string x-speakeasy-unknown-values: allow + routed_service_tier: + description: >- + The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ. + enum: + - flex + - priority + example: priority + type: string + x-speakeasy-unknown-values: allow status: description: HTTP status code from the provider example: 200 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ed2bf95..e560c49 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:87e4c596d105bb13f76c310ec8d8d44d3ffb0350b4c451569fabb11aeeb5bbbd - sourceBlobDigest: sha256:a371855a3645703bef21de566fde2c87342bb0a654e529c38f4344b8ad5e705b + sourceRevisionDigest: sha256:3c5226489661662950b09fb9ca17bb6ab30677c06d598e45101a4b5e57f4defb + sourceBlobDigest: sha256:dbe7c54c8149d63bb85a11bc4a9d5c4f7b6871426b32289bf314847ed57e4203 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:87e4c596d105bb13f76c310ec8d8d44d3ffb0350b4c451569fabb11aeeb5bbbd - sourceBlobDigest: sha256:a371855a3645703bef21de566fde2c87342bb0a654e529c38f4344b8ad5e705b + sourceRevisionDigest: sha256:3c5226489661662950b09fb9ca17bb6ab30677c06d598e45101a4b5e57f4defb + sourceBlobDigest: sha256:dbe7c54c8149d63bb85a11bc4a9d5c4f7b6871426b32289bf314847ed57e4203 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:1600c45d7815b8e0a480752fa1fa1f7cb9919e492d2fd2e0162d83e4ad69cfae + codeSamplesRevisionDigest: sha256:51a9185a00a3d2d584952cd0e0351cd69907763d9174fe6e1ce4ab45f608cf8c workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 7d52284..6277126 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -218,4 +218,14 @@ Based on: ### Generated - [python v0.11.11] . ### Releases -- [PyPI v0.11.11] https://pypi.org/project/openrouter/0.11.11 - . \ No newline at end of file +- [PyPI v0.11.11] https://pypi.org/project/openrouter/0.11.11 - . + +## 2026-07-09 10:13:53 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.12] . +### Releases +- [PyPI v0.11.12] https://pypi.org/project/openrouter/0.11.12 - . \ No newline at end of file diff --git a/docs/components/providerresponse.mdx b/docs/components/providerresponse.mdx index 65abb90..dd376f0 100644 --- a/docs/components/providerresponse.mdx +++ b/docs/components/providerresponse.mdx @@ -7,12 +7,13 @@ Details of a provider response for a generation attempt ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `endpoint_id` | *Optional[str]* | :heavy_minus_sign: | Internal endpoint identifier | ep_abc123 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Upstream provider response identifier | chatcmpl-abc123 | -| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether the request used a bring-your-own-key | false | -| `latency` | *Optional[float]* | :heavy_minus_sign: | Response latency in milliseconds | 1200 | -| `model_permaslug` | *Optional[str]* | :heavy_minus_sign: | Canonical model slug | openai/gpt-4 | -| `provider_name` | [Optional[components.ProviderResponseProviderName]](../components/providerresponseprovidername.mdx) | :heavy_minus_sign: | Name of the provider | OpenAI | -| `status` | *Nullable[int]* | :heavy_check_mark: | HTTP status code from the provider | 200 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `endpoint_id` | *Optional[str]* | :heavy_minus_sign: | Internal endpoint identifier | ep_abc123 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Upstream provider response identifier | chatcmpl-abc123 | +| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether the request used a bring-your-own-key | false | +| `latency` | *Optional[float]* | :heavy_minus_sign: | Response latency in milliseconds | 1200 | +| `model_permaslug` | *Optional[str]* | :heavy_minus_sign: | Canonical model slug | openai/gpt-4 | +| `provider_name` | [Optional[components.ProviderResponseProviderName]](../components/providerresponseprovidername.mdx) | :heavy_minus_sign: | Name of the provider | OpenAI | +| `routed_service_tier` | [Optional[components.RoutedServiceTier]](../components/routedservicetier.mdx) | :heavy_minus_sign: | The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ. | priority | +| `status` | *Nullable[int]* | :heavy_check_mark: | HTTP status code from the provider | 200 | \ No newline at end of file diff --git a/docs/components/routedservicetier.mdx b/docs/components/routedservicetier.mdx new file mode 100644 index 0000000..0c82631 --- /dev/null +++ b/docs/components/routedservicetier.mdx @@ -0,0 +1,22 @@ +--- +title: "RoutedServiceTier" +--- + +The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ. + +## Example Usage + +```python +from openrouter.components import RoutedServiceTier + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: RoutedServiceTier = "flex" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"flex"` +- `"priority"` diff --git a/pyproject.toml b/pyproject.toml index b333216..e6ead54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.11" +version = "0.11.12" 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 ee67610..9208d77 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.11" +__version__: str = "0.11.12" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.11 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.12 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 3969a96..b5563aa 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2165,6 +2165,7 @@ if TYPE_CHECKING: ProviderResponse, ProviderResponseProviderName, ProviderResponseTypedDict, + RoutedServiceTier, ) from .providersort import ProviderSort from .providersortconfig import ( @@ -4335,6 +4336,7 @@ __all__ = [ "ResponsesRequestTypedDict", "ResponsesStreamingResponse", "ResponsesStreamingResponseTypedDict", + "RoutedServiceTier", "RouterAttempt", "RouterAttemptTypedDict", "RouterParams", @@ -6352,6 +6354,7 @@ _dynamic_imports: dict[str, str] = { "ProviderResponse": ".providerresponse", "ProviderResponseProviderName": ".providerresponse", "ProviderResponseTypedDict": ".providerresponse", + "RoutedServiceTier": ".providerresponse", "ProviderSort": ".providersort", "By": ".providersortconfig", "Partition": ".providersortconfig", diff --git a/src/openrouter/components/providerresponse.py b/src/openrouter/components/providerresponse.py index 757907b..ccc9f82 100644 --- a/src/openrouter/components/providerresponse.py +++ b/src/openrouter/components/providerresponse.py @@ -135,6 +135,16 @@ ProviderResponseProviderName = Union[ r"""Name of the provider""" +RoutedServiceTier = Union[ + Literal[ + "flex", + "priority", + ], + UnrecognizedStr, +] +r"""The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.""" + + class ProviderResponseTypedDict(TypedDict): r"""Details of a provider response for a generation attempt""" @@ -152,6 +162,8 @@ class ProviderResponseTypedDict(TypedDict): r"""Canonical model slug""" provider_name: NotRequired[ProviderResponseProviderName] r"""Name of the provider""" + routed_service_tier: NotRequired[RoutedServiceTier] + r"""The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.""" class ProviderResponse(BaseModel): @@ -178,6 +190,9 @@ class ProviderResponse(BaseModel): provider_name: Optional[ProviderResponseProviderName] = None r"""Name of the provider""" + routed_service_tier: Optional[RoutedServiceTier] = None + r"""The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -188,6 +203,7 @@ class ProviderResponse(BaseModel): "latency", "model_permaslug", "provider_name", + "routed_service_tier", ] ) nullable_fields = set(["status"]) diff --git a/uv.lock b/uv.lock index 87fde5f..f4b684e 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.11" +version = "0.11.12" source = { editable = "." } dependencies = [ { name = "httpcore" }, From c9d39da7086ecabf00deeabcbff1e9e9388169b7 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:11:09 +0000 Subject: [PATCH 21/62] chore: update OpenAPI spec from monorepo (#413) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 25399a2..99e8729 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -19401,6 +19401,43 @@ components: - type - data type: object + ReasoningDetailServerToolCall: + description: >- + Record of an OpenRouter server-tool invocation (e.g. openrouter:fusion), carried in reasoning_details so a prior + tool call can be rehydrated into a later turn of the same conversation. + example: + arguments: '{"prompt":"Compare carbon tax proposals"}' + result: '{"status":"ok","models":["openai/gpt-4o"]}' + tool_call_id: call_abc123 + tool_name: openrouter:fusion + type: reasoning.server_tool_call + properties: + arguments: + type: string + format: + $ref: '#/components/schemas/ReasoningFormat' + id: + nullable: true + type: string + index: + type: integer + result: + type: string + tool_call_id: + nullable: true + type: string + tool_name: + type: string + type: + enum: + - reasoning.server_tool_call + type: string + required: + - type + - tool_name + - arguments + - result + type: object ReasoningDetailSummary: description: Reasoning detail summary schema example: @@ -19456,6 +19493,7 @@ components: discriminator: mapping: reasoning.encrypted: '#/components/schemas/ReasoningDetailEncrypted' + reasoning.server_tool_call: '#/components/schemas/ReasoningDetailServerToolCall' reasoning.summary: '#/components/schemas/ReasoningDetailSummary' reasoning.text: '#/components/schemas/ReasoningDetailText' propertyName: type @@ -19466,6 +19504,7 @@ components: - $ref: '#/components/schemas/ReasoningDetailSummary' - $ref: '#/components/schemas/ReasoningDetailEncrypted' - $ref: '#/components/schemas/ReasoningDetailText' + - $ref: '#/components/schemas/ReasoningDetailServerToolCall' ReasoningDoneEvent: allOf: - $ref: '#/components/schemas/BaseReasoningDoneEvent' From 9b7ee68d767a1506e63ce8b6d486655f9402a9e8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:15:52 +0000 Subject: [PATCH 22/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.13=20(#414)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 48 ++++++----- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 38 +++++++++ .speakeasy/workflow.lock | 10 +-- RELEASES.md | 12 ++- .../reasoningdetailservertoolcall.mdx | 19 +++++ .../reasoningdetailservertoolcalltype.mdx | 15 ++++ docs/components/reasoningdetailunion.mdx | 6 ++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 11 +++ .../reasoningdetailservertoolcall.py | 84 +++++++++++++++++++ .../components/reasoningdetailunion.py | 7 ++ uv.lock | 2 +- 14 files changed, 230 insertions(+), 30 deletions(-) create mode 100644 docs/components/reasoningdetailservertoolcall.mdx create mode 100644 docs/components/reasoningdetailservertoolcalltype.mdx create mode 100644 src/openrouter/components/reasoningdetailservertoolcall.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 726c6bb..ea088db 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: 806da48c3f8b0f6fcd8822556deb2d52 + docChecksum: 8f7ea245a84b730eab57728b3cacc35c docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.12 - configChecksum: 716de99521ede522990999611400003e + releaseVersion: 0.11.13 + configChecksum: c88203387459a0cbb769727c96db3986 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 8679aa3b-5d9e-4893-8022-baf536bf7090 - pristine_commit_hash: 65881050ceed3021f70ad4f272545c4b4a65c4b1 - pristine_tree_hash: 81dbfc8598b20a107de700cfb2a93473c41dde40 + generation_id: 609662c1-5d0e-47a3-9079-d08e16b49533 + pristine_commit_hash: 4cc996dbf6544dc4b74c850198e2854bc462097d + pristine_tree_hash: 0c0596c5003de8de766314afa7eb7c8f5d5f433b features: python: acceptHeaders: 3.0.0 @@ -3904,6 +3904,14 @@ trackedFiles: id: 7dea8887a486 last_write_checksum: sha1:92808e57ae938c7cfaf7d5ab1dcc2e411d887108 pristine_git_object: 3779ebb04af32b9188d75c4c910752f6ef31ccc6 + docs/components/reasoningdetailservertoolcall.mdx: + id: 095a5cb44df4 + last_write_checksum: sha1:ef83973b82b8630fcb3f195c4bed67e1ea9a0994 + pristine_git_object: 78f316a13caa1cbc4b95082c1273f83cdfdb88b6 + docs/components/reasoningdetailservertoolcalltype.mdx: + id: 703597bf09db + last_write_checksum: sha1:a4415cefe09b6e1944d239999be6622a057ef865 + pristine_git_object: cb6b4d6476d46b8715441055056e000b56448b3d docs/components/reasoningdetailsummary.mdx: id: 264cd49526bd last_write_checksum: sha1:73d7efd548b4a457454ebf381f159797ddc91970 @@ -3922,8 +3930,8 @@ trackedFiles: pristine_git_object: 4b94f542433728f6cf9adce6be943b7be90dbd41 docs/components/reasoningdetailunion.mdx: id: b79bc447eaff - last_write_checksum: sha1:93c29cce21e4ba625b7299ecc8891d1b1fa7ef87 - pristine_git_object: 49ac02bee627aed7cc041917d432dd368463827a + last_write_checksum: sha1:b2451dd8ad86ad3ef3ba6cea0fd18bea1c488bcd + pristine_git_object: 19039845eae5a92b79a1e53f4797cd69996fec0a docs/components/reasoningdoneevent.mdx: id: 3183f11559d0 last_write_checksum: sha1:b2ab6eac3b93629f1643c518dca3e7274d4b17c9 @@ -6458,8 +6466,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:ac2002f15d1247065c7cb46d7eefa45718cff498 - pristine_git_object: e6ead548984f180e102da37f58096846d8587c7e + last_write_checksum: sha1:cdca9f1f09271dc533678cd9ba90c0a00909e209 + pristine_git_object: f0cbdaa88fc060abeadb111e9c3466fdaf854ddd scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6486,8 +6494,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:48782d3a645f92804e627ef77ff3a65b355a5e74 - pristine_git_object: 9208d774c192a728cd2db520bd8ca629d9b2e37c + last_write_checksum: sha1:a509125dbf0ac5f32ee0e70ac41c9c1a476e36eb + pristine_git_object: 150a77b0b7087e6c156087c8502ea4b98c03249c src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6526,8 +6534,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:fa3d53883e45a8fb738127b91ca4f16c9ff29c9d - pristine_git_object: b5563aa875171f1bc0051960b459f8ee37314405 + last_write_checksum: sha1:d65b820c63aa6a5ee9fdbe852f4e00ccb3d7fbcf + pristine_git_object: 397ffe2ed69a6cd49c904ad5e4a487a6feb4116e src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8176,6 +8184,10 @@ trackedFiles: id: ae7d7526c9b5 last_write_checksum: sha1:df579e34f32d49b348ae1fc8e74904ac4edb03a3 pristine_git_object: 0ba2daa8d62116e1122638e2c703e89428cd742d + src/openrouter/components/reasoningdetailservertoolcall.py: + id: f95da47c231d + last_write_checksum: sha1:5196ad2ea5f8b463bb8e9e98adc54f8faa63a07e + pristine_git_object: 4487eb0e24600c0affed1a29ea5380328c56fd0f src/openrouter/components/reasoningdetailsummary.py: id: 53bda5c72dc5 last_write_checksum: sha1:db665a5b9c7ca3be181719df3c81f07ce3c127ea @@ -8186,8 +8198,8 @@ trackedFiles: pristine_git_object: 49b08a205274f8aad7af7c5c910a7dbc73c12588 src/openrouter/components/reasoningdetailunion.py: id: 3326e0b80cdb - last_write_checksum: sha1:ba9766e0906ce06081ef33e5889ca7c0af870e13 - pristine_git_object: 78e5924ea5aff2f91111acd8348907ff37c738e9 + last_write_checksum: sha1:0a582331054241874c2bb83991b6596c84358e43 + pristine_git_object: 17b2534207bf2a898937bbcf3ee56fd58020cb41 src/openrouter/components/reasoningdoneevent.py: id: 5d7fc847e949 last_write_checksum: sha1:456aa0d5bc1ca2e46d2dd494d3d0f78d77ca23bf @@ -10780,6 +10792,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.generations.get_generation()`: `response.data.provider_responses[].routed_service_tier` **Added** +releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request.messages[].union(assistant).reasoning_details[].union(reasoning.server_tool_call)` **Added**\n * `response` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.messages[].union(assistant).reasoning_details[].union(reasoning.server_tool_call)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f5bd70d..06fbbbf 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.12 + version: 0.11.13 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index eec586f..d4dde6d 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -19277,6 +19277,42 @@ components: - type - data type: object + ReasoningDetailServerToolCall: + description: >- + Record of an OpenRouter server-tool invocation (e.g. openrouter:fusion), carried in reasoning_details so a prior tool call can be rehydrated into a later turn of the same conversation. + example: + arguments: '{"prompt":"Compare carbon tax proposals"}' + result: '{"status":"ok","models":["openai/gpt-4o"]}' + tool_call_id: call_abc123 + tool_name: openrouter:fusion + type: reasoning.server_tool_call + properties: + arguments: + type: string + format: + $ref: '#/components/schemas/ReasoningFormat' + id: + nullable: true + type: string + index: + type: integer + result: + type: string + tool_call_id: + nullable: true + type: string + tool_name: + type: string + type: + enum: + - reasoning.server_tool_call + type: string + required: + - type + - tool_name + - arguments + - result + type: object ReasoningDetailSummary: description: Reasoning detail summary schema example: @@ -19332,6 +19368,7 @@ components: discriminator: mapping: reasoning.encrypted: '#/components/schemas/ReasoningDetailEncrypted' + reasoning.server_tool_call: '#/components/schemas/ReasoningDetailServerToolCall' reasoning.summary: '#/components/schemas/ReasoningDetailSummary' reasoning.text: '#/components/schemas/ReasoningDetailText' propertyName: type @@ -19342,6 +19379,7 @@ components: - $ref: '#/components/schemas/ReasoningDetailSummary' - $ref: '#/components/schemas/ReasoningDetailEncrypted' - $ref: '#/components/schemas/ReasoningDetailText' + - $ref: '#/components/schemas/ReasoningDetailServerToolCall' ReasoningDoneEvent: allOf: - $ref: '#/components/schemas/BaseReasoningDoneEvent' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e560c49..16f199c 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:3c5226489661662950b09fb9ca17bb6ab30677c06d598e45101a4b5e57f4defb - sourceBlobDigest: sha256:dbe7c54c8149d63bb85a11bc4a9d5c4f7b6871426b32289bf314847ed57e4203 + sourceRevisionDigest: sha256:92cd773ef78afbd37e90739af75ab30e169c59cb0931e50a0afbb81a040efa47 + sourceBlobDigest: sha256:ad7b1ae1700a5dd784690c2a598d95fa515f280fd2dfaf020567d85c76f91d73 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:3c5226489661662950b09fb9ca17bb6ab30677c06d598e45101a4b5e57f4defb - sourceBlobDigest: sha256:dbe7c54c8149d63bb85a11bc4a9d5c4f7b6871426b32289bf314847ed57e4203 + sourceRevisionDigest: sha256:92cd773ef78afbd37e90739af75ab30e169c59cb0931e50a0afbb81a040efa47 + sourceBlobDigest: sha256:ad7b1ae1700a5dd784690c2a598d95fa515f280fd2dfaf020567d85c76f91d73 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:51a9185a00a3d2d584952cd0e0351cd69907763d9174fe6e1ce4ab45f608cf8c + codeSamplesRevisionDigest: sha256:67ea1409449c1bdeac71bddc4300e6137ad4d53833ad8b4f631c80c338c5c414 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 6277126..bbebb0d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -228,4 +228,14 @@ Based on: ### Generated - [python v0.11.12] . ### Releases -- [PyPI v0.11.12] https://pypi.org/project/openrouter/0.11.12 - . \ No newline at end of file +- [PyPI v0.11.12] https://pypi.org/project/openrouter/0.11.12 - . + +## 2026-07-09 17:12:18 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.13] . +### Releases +- [PyPI v0.11.13] https://pypi.org/project/openrouter/0.11.13 - . \ No newline at end of file diff --git a/docs/components/reasoningdetailservertoolcall.mdx b/docs/components/reasoningdetailservertoolcall.mdx new file mode 100644 index 0000000..78f316a --- /dev/null +++ b/docs/components/reasoningdetailservertoolcall.mdx @@ -0,0 +1,19 @@ +--- +title: "ReasoningDetailServerToolCall" +--- + +Record of an OpenRouter server-tool invocation (e.g. openrouter:fusion), carried in reasoning_details so a prior tool call can be rehydrated into a later turn of the same conversation. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `arguments` | *str* | :heavy_check_mark: | N/A | | +| `format_` | [OptionalNullable[components.ReasoningFormat]](../components/reasoningformat.mdx) | :heavy_minus_sign: | N/A | unknown | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `index` | *Optional[int]* | :heavy_minus_sign: | N/A | | +| `result` | *str* | :heavy_check_mark: | N/A | | +| `tool_call_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `tool_name` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.ReasoningDetailServerToolCallType](../components/reasoningdetailservertoolcalltype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/reasoningdetailservertoolcalltype.mdx b/docs/components/reasoningdetailservertoolcalltype.mdx new file mode 100644 index 0000000..cb6b4d6 --- /dev/null +++ b/docs/components/reasoningdetailservertoolcalltype.mdx @@ -0,0 +1,15 @@ +--- +title: "ReasoningDetailServerToolCallType" +--- + +## Example Usage + +```python +from openrouter.components import ReasoningDetailServerToolCallType +value: ReasoningDetailServerToolCallType = "reasoning.server_tool_call" +``` + + +## Values + +- `"reasoning.server_tool_call"` diff --git a/docs/components/reasoningdetailunion.mdx b/docs/components/reasoningdetailunion.mdx index 49ac02b..1903984 100644 --- a/docs/components/reasoningdetailunion.mdx +++ b/docs/components/reasoningdetailunion.mdx @@ -13,6 +13,12 @@ Reasoning detail union schema value: components.ReasoningDetailEncrypted = /* values here */ ``` +### `components.ReasoningDetailServerToolCall` + +```python +value: components.ReasoningDetailServerToolCall = /* values here */ +``` + ### `components.ReasoningDetailSummary` ```python diff --git a/pyproject.toml b/pyproject.toml index e6ead54..f0cbdaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.12" +version = "0.11.13" 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 9208d77..150a77b 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.12" +__version__: str = "0.11.13" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.12 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.13 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 b5563aa..397ffe2 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2209,6 +2209,11 @@ if TYPE_CHECKING: ReasoningDetailEncryptedType, ReasoningDetailEncryptedTypedDict, ) + from .reasoningdetailservertoolcall import ( + ReasoningDetailServerToolCall, + ReasoningDetailServerToolCallType, + ReasoningDetailServerToolCallTypedDict, + ) from .reasoningdetailsummary import ( ReasoningDetailSummary, ReasoningDetailSummaryType, @@ -4253,6 +4258,9 @@ __all__ = [ "ReasoningDetailEncrypted", "ReasoningDetailEncryptedType", "ReasoningDetailEncryptedTypedDict", + "ReasoningDetailServerToolCall", + "ReasoningDetailServerToolCallType", + "ReasoningDetailServerToolCallTypedDict", "ReasoningDetailSummary", "ReasoningDetailSummaryType", "ReasoningDetailSummaryTypedDict", @@ -6386,6 +6394,9 @@ _dynamic_imports: dict[str, str] = { "ReasoningDetailEncrypted": ".reasoningdetailencrypted", "ReasoningDetailEncryptedType": ".reasoningdetailencrypted", "ReasoningDetailEncryptedTypedDict": ".reasoningdetailencrypted", + "ReasoningDetailServerToolCall": ".reasoningdetailservertoolcall", + "ReasoningDetailServerToolCallType": ".reasoningdetailservertoolcall", + "ReasoningDetailServerToolCallTypedDict": ".reasoningdetailservertoolcall", "ReasoningDetailSummary": ".reasoningdetailsummary", "ReasoningDetailSummaryType": ".reasoningdetailsummary", "ReasoningDetailSummaryTypedDict": ".reasoningdetailsummary", diff --git a/src/openrouter/components/reasoningdetailservertoolcall.py b/src/openrouter/components/reasoningdetailservertoolcall.py new file mode 100644 index 0000000..4487eb0 --- /dev/null +++ b/src/openrouter/components/reasoningdetailservertoolcall.py @@ -0,0 +1,84 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .reasoningformat import ReasoningFormat +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +ReasoningDetailServerToolCallType = Literal["reasoning.server_tool_call",] + + +class ReasoningDetailServerToolCallTypedDict(TypedDict): + r"""Record of an OpenRouter server-tool invocation (e.g. openrouter:fusion), carried in reasoning_details so a prior tool call can be rehydrated into a later turn of the same conversation.""" + + arguments: str + result: str + tool_name: str + type: ReasoningDetailServerToolCallType + format_: NotRequired[Nullable[ReasoningFormat]] + id: NotRequired[Nullable[str]] + index: NotRequired[int] + tool_call_id: NotRequired[Nullable[str]] + + +class ReasoningDetailServerToolCall(BaseModel): + r"""Record of an OpenRouter server-tool invocation (e.g. openrouter:fusion), carried in reasoning_details so a prior tool call can be rehydrated into a later turn of the same conversation.""" + + arguments: str + + result: str + + tool_name: str + + type: ReasoningDetailServerToolCallType + + format_: Annotated[ + OptionalNullable[ReasoningFormat], pydantic.Field(alias="format") + ] = UNSET + + id: OptionalNullable[str] = UNSET + + index: Optional[int] = None + + tool_call_id: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["format", "id", "index", "tool_call_id"]) + nullable_fields = set(["format", "id", "tool_call_id"]) + 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 + + +try: + ReasoningDetailServerToolCall.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/reasoningdetailunion.py b/src/openrouter/components/reasoningdetailunion.py index 78e5924..17b2534 100644 --- a/src/openrouter/components/reasoningdetailunion.py +++ b/src/openrouter/components/reasoningdetailunion.py @@ -5,6 +5,10 @@ from .reasoningdetailencrypted import ( ReasoningDetailEncrypted, ReasoningDetailEncryptedTypedDict, ) +from .reasoningdetailservertoolcall import ( + ReasoningDetailServerToolCall, + ReasoningDetailServerToolCallTypedDict, +) from .reasoningdetailsummary import ( ReasoningDetailSummary, ReasoningDetailSummaryTypedDict, @@ -25,6 +29,7 @@ ReasoningDetailUnionTypedDict = TypeAliasType( ReasoningDetailSummaryTypedDict, ReasoningDetailEncryptedTypedDict, ReasoningDetailTextTypedDict, + ReasoningDetailServerToolCallTypedDict, ], ) r"""Reasoning detail union schema""" @@ -42,6 +47,7 @@ class UnknownReasoningDetailUnion(BaseModel): _REASONING_DETAIL_UNION_VARIANTS: dict[str, Any] = { "reasoning.encrypted": ReasoningDetailEncrypted, + "reasoning.server_tool_call": ReasoningDetailServerToolCall, "reasoning.summary": ReasoningDetailSummary, "reasoning.text": ReasoningDetailText, } @@ -50,6 +56,7 @@ _REASONING_DETAIL_UNION_VARIANTS: dict[str, Any] = { ReasoningDetailUnion = Annotated[ Union[ ReasoningDetailEncrypted, + ReasoningDetailServerToolCall, ReasoningDetailSummary, ReasoningDetailText, UnknownReasoningDetailUnion, diff --git a/uv.lock b/uv.lock index f4b684e..8ffa638 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.12" +version = "0.11.13" source = { editable = "." } dependencies = [ { name = "httpcore" }, From c382f8fbc050297546b8ed2e5a594f0652c44857 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:27:10 +0000 Subject: [PATCH 23/62] chore: update OpenAPI spec from monorepo (#415) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 99e8729..2200f9b 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -3101,6 +3101,8 @@ components: properties: effort: $ref: '#/components/schemas/ReasoningEffort' + mode: + $ref: '#/components/schemas/ReasoningMode' summary: $ref: '#/components/schemas/ReasoningSummaryVerbosity' type: object @@ -19565,6 +19567,17 @@ components: - text: Step by step analysis type: summary_text type: reasoning + ReasoningMode: + description: >- + Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, + billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. + enum: + - standard + - pro + - null + example: standard + nullable: true + type: string ReasoningSummaryPartAddedEvent: allOf: - $ref: '#/components/schemas/BaseReasoningSummaryPartAddedEvent' From 1281ae62dadd1cc403d16bc4e6e9bd81e1f39754 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:32:51 +0000 Subject: [PATCH 24/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.14=20(#416)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 50 +++++++++++-------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 13 +++++ .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 ++++- docs/components/basereasoningconfig.mdx | 9 ++-- docs/components/reasoningconfig.mdx | 13 ++--- docs/components/reasoningmode.mdx | 22 ++++++++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 3 ++ .../components/basereasoningconfig.py | 10 +++- src/openrouter/components/reasoningconfig.py | 10 +++- src/openrouter/components/reasoningmode.py | 15 ++++++ uv.lock | 2 +- 15 files changed, 131 insertions(+), 46 deletions(-) create mode 100644 docs/components/reasoningmode.mdx create mode 100644 src/openrouter/components/reasoningmode.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ea088db..724629f 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: 8f7ea245a84b730eab57728b3cacc35c + docChecksum: 09df6acb8d33fc0a6e700e04d4655ba0 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.13 - configChecksum: c88203387459a0cbb769727c96db3986 + releaseVersion: 0.11.14 + configChecksum: f50be4abc577933c26adbd554a8c0a32 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 609662c1-5d0e-47a3-9079-d08e16b49533 - pristine_commit_hash: 4cc996dbf6544dc4b74c850198e2854bc462097d - pristine_tree_hash: 0c0596c5003de8de766314afa7eb7c8f5d5f433b + generation_id: a013eea8-05d8-4341-bd1d-eece9f6abc6a + pristine_commit_hash: 956ac8e76c81a4ebd4c9924aad87c7aae1c20436 + pristine_tree_hash: fb3578808042a59c539cc83b5cfc79991d33712a features: python: acceptHeaders: 3.0.0 @@ -610,8 +610,8 @@ trackedFiles: pristine_git_object: 633bd16e1abe0e3894c12f551761ad1a9da37d5e docs/components/basereasoningconfig.mdx: id: 3c6f03de40b1 - last_write_checksum: sha1:3273f4dc1e6af65f58aa87e4b97bdab579f65f8a - pristine_git_object: 628251998a3571d2b89225ac5a707f372c5ec143 + last_write_checksum: sha1:eb6d9ba91551e795f59a1fd85bef0df0c0c04fea + pristine_git_object: 3ccce9e99c37e70708c2aff1e1f4891a59c31979 docs/components/bashservertool.mdx: id: 664dbaf53aa3 last_write_checksum: sha1:0b276c752d22836d67b31aab477b4ebba24c17c1 @@ -3886,8 +3886,8 @@ trackedFiles: pristine_git_object: 99c4a374a4dacb8e64c8a1cf5efb815fb177e22d docs/components/reasoningconfig.mdx: id: e5500b541923 - last_write_checksum: sha1:0356f9e98a2ae7ec83b1c352994ced8cddeaaf79 - pristine_git_object: 819b0830608d88a227d9457f4189d7b1112c39d4 + last_write_checksum: sha1:368c0d607d496c07707b24ce67b1603294c6c91e + pristine_git_object: 42457ac688a05ee75ac807d882c7c949744f2919 docs/components/reasoningdeltaevent.mdx: id: 2ec3838c029f last_write_checksum: sha1:15dccf12992148893efb3325d86be310d339fda5 @@ -3972,6 +3972,10 @@ trackedFiles: id: e8641738e2de last_write_checksum: sha1:3e48a910c91face268f4856b29513a839387908b pristine_git_object: ce469f036c494a9b65a2f9c6cba2a00d84ea27be + docs/components/reasoningmode.mdx: + id: bbff17cc0627 + last_write_checksum: sha1:5a3d3051d45f770038d66c27cade83a2ec9d9ffe + pristine_git_object: d288ff3c7f26ed6a639f3c790d7d2a5de4d1715e docs/components/reasoningsummarypartaddedevent.mdx: id: f8185d70cec5 last_write_checksum: sha1:ea2de8082c5aa7e86313a4e22caf7f800d76988a @@ -6466,8 +6470,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:cdca9f1f09271dc533678cd9ba90c0a00909e209 - pristine_git_object: f0cbdaa88fc060abeadb111e9c3466fdaf854ddd + last_write_checksum: sha1:3177e6621f92622eaa6776a68dd2bb077cdcfdc8 + pristine_git_object: d177de9881a5636e96018d98b7d221ec0124761b scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6494,8 +6498,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:a509125dbf0ac5f32ee0e70ac41c9c1a476e36eb - pristine_git_object: 150a77b0b7087e6c156087c8502ea4b98c03249c + last_write_checksum: sha1:f6992fba8825a552cf53e8a013d7e6fa7ca2530c + pristine_git_object: 97bfd4246432cf5e50e7008f1125f9e6db969f75 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6534,8 +6538,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:d65b820c63aa6a5ee9fdbe852f4e00ccb3d7fbcf - pristine_git_object: 397ffe2ed69a6cd49c904ad5e4a487a6feb4116e + last_write_checksum: sha1:85cd21f3c0b6b129b5b09b952fa3c4e48a9d93a9 + pristine_git_object: d6a693898dda47aad55259292807fc7d31be4e10 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6786,8 +6790,8 @@ trackedFiles: pristine_git_object: 56b48e741547abaae734d07a4022808fb082f899 src/openrouter/components/basereasoningconfig.py: id: 8bd09a7e873a - last_write_checksum: sha1:1519371cc541bdec60a88b183b45717cd60d93c2 - pristine_git_object: 35d8ea7747973582b749e258443a1450e74a589b + last_write_checksum: sha1:fbc371f27810d872041ed3e6b24a9f892c71d84b + pristine_git_object: 2e7bcf61a1b6d47a86c755720c1d4ccd0b419e49 src/openrouter/components/bashservertool.py: id: 1c5881bea648 last_write_checksum: sha1:fd74247241c7371ff595e3b5e8fb1cac31f66ddc @@ -8174,8 +8178,8 @@ trackedFiles: pristine_git_object: 9adc8e68c6993b0490e8d14e1d2c0f15694dde97 src/openrouter/components/reasoningconfig.py: id: 754fc31a7b69 - last_write_checksum: sha1:49e4159a5318afffc7be6061d809c91c6fe26924 - pristine_git_object: 7e37f18a825c059606ec701dd94dbdcd3343f2c3 + last_write_checksum: sha1:7320173c0dd16ceac04a722ac138ee1d00a71165 + pristine_git_object: b0c9375431363731a4a6eb3de53a140e03104244 src/openrouter/components/reasoningdeltaevent.py: id: 6de06228d1f6 last_write_checksum: sha1:efff164cfffbf6b89ab270ac4912243649149457 @@ -8216,6 +8220,10 @@ trackedFiles: id: 4345f446ad97 last_write_checksum: sha1:609a0510506f8dc70ca9cba07040b82ebdc9ec9f pristine_git_object: 40ee3f6c1a1e249d988950ebe49d1ad6f8c05dc1 + src/openrouter/components/reasoningmode.py: + id: 874f05fcf99c + last_write_checksum: sha1:0613ad16798a2678bb9fe0c55a20a13bf51373b1 + pristine_git_object: b0b5cbdbb34a9f84c8facd1bd213d3a877a4132d src/openrouter/components/reasoningsummarypartaddedevent.py: id: 006a060524d6 last_write_checksum: sha1:acd510a13e5cc8df7dcca38040af2be0a37a689b @@ -10792,4 +10800,4 @@ examples: "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.messages[].union(assistant).reasoning_details[].union(reasoning.server_tool_call)` **Added**\n * `response` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.messages[].union(assistant).reasoning_details[].union(reasoning.server_tool_call)` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.reasoning.mode` **Added**\n * `response` **Changed**\n* `open_router.presets.create_presets_responses()`: \n * `request.reasoning.mode` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 06fbbbf..1cee56d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.13 + version: 0.11.14 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index d4dde6d..719cd05 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -3100,6 +3100,8 @@ components: properties: effort: $ref: '#/components/schemas/ReasoningEffort' + mode: + $ref: '#/components/schemas/ReasoningMode' summary: $ref: '#/components/schemas/ReasoningSummaryVerbosity' type: object @@ -19442,6 +19444,17 @@ components: - text: Step by step analysis type: summary_text type: reasoning + ReasoningMode: + description: >- + Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. + enum: + - standard + - pro + - null + example: standard + nullable: true + type: string + x-speakeasy-unknown-values: allow ReasoningSummaryPartAddedEvent: allOf: - $ref: '#/components/schemas/BaseReasoningSummaryPartAddedEvent' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 16f199c..83e115d 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:92cd773ef78afbd37e90739af75ab30e169c59cb0931e50a0afbb81a040efa47 - sourceBlobDigest: sha256:ad7b1ae1700a5dd784690c2a598d95fa515f280fd2dfaf020567d85c76f91d73 + sourceRevisionDigest: sha256:d327ecf77f0054c2b8ef6744061285c669e336bcffefed3734162fa92619b7da + sourceBlobDigest: sha256:cecf0268e9e30429f9c9d516f5c6a5881ea046b4c6f53f8997c1f8c9a9108898 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:92cd773ef78afbd37e90739af75ab30e169c59cb0931e50a0afbb81a040efa47 - sourceBlobDigest: sha256:ad7b1ae1700a5dd784690c2a598d95fa515f280fd2dfaf020567d85c76f91d73 + sourceRevisionDigest: sha256:d327ecf77f0054c2b8ef6744061285c669e336bcffefed3734162fa92619b7da + sourceBlobDigest: sha256:cecf0268e9e30429f9c9d516f5c6a5881ea046b4c6f53f8997c1f8c9a9108898 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:67ea1409449c1bdeac71bddc4300e6137ad4d53833ad8b4f631c80c338c5c414 + codeSamplesRevisionDigest: sha256:a276c0ed9f4e7618be962a296d3e456696c53c9f8f83d787218fe50779ff395f workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index bbebb0d..0d26d50 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -238,4 +238,14 @@ Based on: ### Generated - [python v0.11.13] . ### Releases -- [PyPI v0.11.13] https://pypi.org/project/openrouter/0.11.13 - . \ No newline at end of file +- [PyPI v0.11.13] https://pypi.org/project/openrouter/0.11.13 - . + +## 2026-07-09 17:28:34 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.14] . +### Releases +- [PyPI v0.11.14] https://pypi.org/project/openrouter/0.11.14 - . \ No newline at end of file diff --git a/docs/components/basereasoningconfig.mdx b/docs/components/basereasoningconfig.mdx index 6282519..3ccce9e 100644 --- a/docs/components/basereasoningconfig.mdx +++ b/docs/components/basereasoningconfig.mdx @@ -4,7 +4,8 @@ title: "BaseReasoningConfig" ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | -| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | +| `mode` | [OptionalNullable[components.ReasoningMode]](../components/reasoningmode.mdx) | :heavy_minus_sign: | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. | standard | +| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | \ No newline at end of file diff --git a/docs/components/reasoningconfig.mdx b/docs/components/reasoningconfig.mdx index 819b083..42457ac 100644 --- a/docs/components/reasoningconfig.mdx +++ b/docs/components/reasoningconfig.mdx @@ -7,9 +7,10 @@ Configuration for reasoning mode in the response ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | -| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | -| `enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | +| `mode` | [OptionalNullable[components.ReasoningMode]](../components/reasoningmode.mdx) | :heavy_minus_sign: | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. | standard | +| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | +| `enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | +| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/reasoningmode.mdx b/docs/components/reasoningmode.mdx new file mode 100644 index 0000000..d288ff3 --- /dev/null +++ b/docs/components/reasoningmode.mdx @@ -0,0 +1,22 @@ +--- +title: "ReasoningMode" +--- + +Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. + +## Example Usage + +```python +from openrouter.components import ReasoningMode + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ReasoningMode = "standard" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"standard"` +- `"pro"` diff --git a/pyproject.toml b/pyproject.toml index f0cbdaa..d177de9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.13" +version = "0.11.14" 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 150a77b..97bfd42 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.13" +__version__: str = "0.11.14" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.13 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.14 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 397ffe2..d6a6938 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2246,6 +2246,7 @@ if TYPE_CHECKING: ReasoningItemType, ReasoningItemTypedDict, ) + from .reasoningmode import ReasoningMode from .reasoningsummarypartaddedevent import ( ReasoningSummaryPartAddedEvent, ReasoningSummaryPartAddedEventType, @@ -4282,6 +4283,7 @@ __all__ = [ "ReasoningItemStatusUnionTypedDict", "ReasoningItemType", "ReasoningItemTypedDict", + "ReasoningMode", "ReasoningSummaryPartAddedEvent", "ReasoningSummaryPartAddedEventType", "ReasoningSummaryPartAddedEventTypedDict", @@ -6419,6 +6421,7 @@ _dynamic_imports: dict[str, str] = { "ReasoningItemStatusUnionTypedDict": ".reasoningitem", "ReasoningItemType": ".reasoningitem", "ReasoningItemTypedDict": ".reasoningitem", + "ReasoningMode": ".reasoningmode", "ReasoningSummaryPartAddedEvent": ".reasoningsummarypartaddedevent", "ReasoningSummaryPartAddedEventType": ".reasoningsummarypartaddedevent", "ReasoningSummaryPartAddedEventTypedDict": ".reasoningsummarypartaddedevent", diff --git a/src/openrouter/components/basereasoningconfig.py b/src/openrouter/components/basereasoningconfig.py index 35d8ea7..2e7bcf6 100644 --- a/src/openrouter/components/basereasoningconfig.py +++ b/src/openrouter/components/basereasoningconfig.py @@ -2,6 +2,7 @@ from __future__ import annotations from .reasoningeffort import ReasoningEffort +from .reasoningmode import ReasoningMode from .reasoningsummaryverbosity import ReasoningSummaryVerbosity from openrouter.types import ( BaseModel, @@ -16,18 +17,23 @@ from typing_extensions import NotRequired, TypedDict class BaseReasoningConfigTypedDict(TypedDict): effort: NotRequired[Nullable[ReasoningEffort]] + mode: NotRequired[Nullable[ReasoningMode]] + r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.""" summary: NotRequired[Nullable[ReasoningSummaryVerbosity]] class BaseReasoningConfig(BaseModel): effort: OptionalNullable[ReasoningEffort] = UNSET + mode: OptionalNullable[ReasoningMode] = UNSET + r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.""" + summary: OptionalNullable[ReasoningSummaryVerbosity] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["effort", "summary"]) - nullable_fields = set(["effort", "summary"]) + optional_fields = set(["effort", "mode", "summary"]) + nullable_fields = set(["effort", "mode", "summary"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/reasoningconfig.py b/src/openrouter/components/reasoningconfig.py index 7e37f18..b0c9375 100644 --- a/src/openrouter/components/reasoningconfig.py +++ b/src/openrouter/components/reasoningconfig.py @@ -2,6 +2,7 @@ from __future__ import annotations from .reasoningeffort import ReasoningEffort +from .reasoningmode import ReasoningMode from .reasoningsummaryverbosity import ReasoningSummaryVerbosity from openrouter.types import ( BaseModel, @@ -18,6 +19,8 @@ class ReasoningConfigTypedDict(TypedDict): r"""Configuration for reasoning mode in the response""" effort: NotRequired[Nullable[ReasoningEffort]] + mode: NotRequired[Nullable[ReasoningMode]] + r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.""" summary: NotRequired[Nullable[ReasoningSummaryVerbosity]] enabled: NotRequired[Nullable[bool]] max_tokens: NotRequired[Nullable[int]] @@ -28,6 +31,9 @@ class ReasoningConfig(BaseModel): effort: OptionalNullable[ReasoningEffort] = UNSET + mode: OptionalNullable[ReasoningMode] = UNSET + r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.""" + summary: OptionalNullable[ReasoningSummaryVerbosity] = UNSET enabled: OptionalNullable[bool] = UNSET @@ -36,8 +42,8 @@ class ReasoningConfig(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["effort", "summary", "enabled", "max_tokens"]) - nullable_fields = set(["effort", "summary", "enabled", "max_tokens"]) + optional_fields = set(["effort", "mode", "summary", "enabled", "max_tokens"]) + nullable_fields = set(["effort", "mode", "summary", "enabled", "max_tokens"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/reasoningmode.py b/src/openrouter/components/reasoningmode.py new file mode 100644 index 0000000..b0b5cbd --- /dev/null +++ b/src/openrouter/components/reasoningmode.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +ReasoningMode = Union[ + Literal[ + "standard", + "pro", + ], + UnrecognizedStr, +] +r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.""" diff --git a/uv.lock b/uv.lock index 8ffa638..41606a8 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.13" +version = "0.11.14" source = { editable = "." } dependencies = [ { name = "httpcore" }, From a2e9c978555e61d836eff2eef441a0cb8bfc65b0 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 18:13:45 +0000 Subject: [PATCH 25/62] chore: update OpenAPI spec from monorepo (#417) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 2200f9b..67f9439 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -3099,6 +3099,8 @@ components: summary: auto nullable: true properties: + context: + $ref: '#/components/schemas/ReasoningContext' effort: $ref: '#/components/schemas/ReasoningEffort' mode: @@ -10408,6 +10410,8 @@ components: text: Hello, how can I help you? type: input_text properties: + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpoint' text: type: string type: @@ -15595,6 +15599,9 @@ components: type: integer input_tokens_details: properties: + cache_write_tokens: + nullable: true + type: integer cached_tokens: type: integer required: @@ -18011,6 +18018,40 @@ components: required: - type type: object + PromptCacheBreakpoint: + description: >- + Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker + is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. + example: + mode: explicit + nullable: true + properties: + mode: + enum: + - explicit + type: string + required: + - mode + type: object + PromptCacheOptions: + description: >- + Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks + marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. + example: + mode: explicit + ttl: 30m + nullable: true + properties: + mode: + enum: + - explicit + type: string + ttl: + nullable: true + type: string + required: + - mode + type: object PromptInjectionScanScope: description: >- Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults @@ -19367,6 +19408,19 @@ components: example: enabled: true summary: auto + ReasoningContext: + description: >- + Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); + `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn + only. Only supported by OpenAI GPT-5.6 and newer. + enum: + - auto + - all_turns + - current_turn + - null + example: all_turns + nullable: true + type: string ReasoningDeltaEvent: allOf: - $ref: '#/components/schemas/BaseReasoningDeltaEvent' @@ -19976,6 +20030,8 @@ components: prompt_cache_key: nullable: true type: string + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptions' provider: $ref: '#/components/schemas/ProviderPreferences' reasoning: From 3f1ab05c95b78d8e37f6bb3c6c66affd48efb6b9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 18:20:26 +0000 Subject: [PATCH 26/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.15=20(#418)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 130 +++++++++++------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 53 +++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/basereasoningconfig.mdx | 11 +- docs/components/inputtext.mdx | 9 +- docs/components/inputtokensdetails.mdx | 7 +- docs/components/promptcachebreakpoint.mdx | 12 ++ docs/components/promptcachebreakpointmode.mdx | 15 ++ docs/components/promptcacheoptions.mdx | 13 ++ docs/components/promptcacheoptionsmode.mdx | 15 ++ docs/components/reasoningconfig.mdx | 15 +- docs/components/reasoningcontext.mdx | 23 ++++ docs/components/responsesrequest.mdx | 1 + docs/sdks/presets/README.mdx | 1 + docs/sdks/responses/README.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 25 ++++ src/openrouter/components/baseinputs_union.py | 2 +- .../components/basereasoningconfig.py | 10 +- src/openrouter/components/easyinputmessage.py | 2 +- src/openrouter/components/inputmessageitem.py | 2 +- src/openrouter/components/inputtext.py | 42 +++++- .../openairesponseinputmessageitem.py | 2 +- .../components/promptcachebreakpoint.py | 21 +++ .../components/promptcacheoptions.py | 56 ++++++++ src/openrouter/components/reasoningconfig.py | 14 +- src/openrouter/components/reasoningcontext.py | 16 +++ src/openrouter/components/responsesrequest.py | 8 ++ src/openrouter/components/usage.py | 28 ++++ src/openrouter/presets.py | 16 +++ src/openrouter/responses.py | 40 ++++++ uv.lock | 2 +- 35 files changed, 533 insertions(+), 89 deletions(-) create mode 100644 docs/components/promptcachebreakpoint.mdx create mode 100644 docs/components/promptcachebreakpointmode.mdx create mode 100644 docs/components/promptcacheoptions.mdx create mode 100644 docs/components/promptcacheoptionsmode.mdx create mode 100644 docs/components/reasoningcontext.mdx create mode 100644 src/openrouter/components/promptcachebreakpoint.py create mode 100644 src/openrouter/components/promptcacheoptions.py create mode 100644 src/openrouter/components/reasoningcontext.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 724629f..b0d351f 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: 09df6acb8d33fc0a6e700e04d4655ba0 + docChecksum: d7b69b574731b7c9c94be5901ee7a5c5 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.14 - configChecksum: f50be4abc577933c26adbd554a8c0a32 + releaseVersion: 0.11.15 + configChecksum: 90c0043479fd28548bbe6b76d7541742 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: a013eea8-05d8-4341-bd1d-eece9f6abc6a - pristine_commit_hash: 956ac8e76c81a4ebd4c9924aad87c7aae1c20436 - pristine_tree_hash: fb3578808042a59c539cc83b5cfc79991d33712a + generation_id: c1cfa591-61b4-49f2-80a7-e1007bcbe17f + pristine_commit_hash: 1a48d7424a4c6692678c01def7f1d0e12d687c0c + pristine_tree_hash: e1b850bb5a9838612c0137a69be76c48ef66ac8e features: python: acceptHeaders: 3.0.0 @@ -610,8 +610,8 @@ trackedFiles: pristine_git_object: 633bd16e1abe0e3894c12f551761ad1a9da37d5e docs/components/basereasoningconfig.mdx: id: 3c6f03de40b1 - last_write_checksum: sha1:eb6d9ba91551e795f59a1fd85bef0df0c0c04fea - pristine_git_object: 3ccce9e99c37e70708c2aff1e1f4891a59c31979 + last_write_checksum: sha1:036514fae32cb43664cd47805eeb2f848a340547 + pristine_git_object: 6f900a92fdf544de9b1531b7c2865fa9564cbeb1 docs/components/bashservertool.mdx: id: 664dbaf53aa3 last_write_checksum: sha1:0b276c752d22836d67b31aab477b4ebba24c17c1 @@ -2410,16 +2410,16 @@ trackedFiles: pristine_git_object: 9d37626f96de3c19d39e4901d041ef41b01bdc98 docs/components/inputtext.mdx: id: c8a97322a50a - last_write_checksum: sha1:5462885a683c2ca29551281c9fcf3ad1bceb0634 - pristine_git_object: 5ebcb8365d9d55c2032d5d4739ceeb30831d1ebb + last_write_checksum: sha1:58653e40ea0a33629dda40d2a11c8d21a75b0467 + pristine_git_object: ece32d6edb601578cdb56fc8b4a60e40bc089f22 docs/components/inputtexttype.mdx: id: 91f958925357 last_write_checksum: sha1:42a8d9a6d3506e02f6024592691292b7ac255075 pristine_git_object: 18baf9c9090c0696427dfebf69ed7e12a8fd77af docs/components/inputtokensdetails.mdx: id: 1b569c720e5c - last_write_checksum: sha1:f6b5b4912a20dfea2515994f9656374d3fc56676 - pristine_git_object: c58b1d023f8ebca70e803c0128b0ade367b4ae35 + last_write_checksum: sha1:c77b55a6ef458ebd7c03cb877aa9ce3d6eec3114 + pristine_git_object: daa531b4e153c105de1905f44bfce078f755f3fb docs/components/inputunion.mdx: id: 94f68c6e9582 last_write_checksum: sha1:85c3b78897569c4572f3fc43f6b1143c293b452d @@ -3796,6 +3796,22 @@ trackedFiles: id: 6816d700f8b1 last_write_checksum: sha1:ac5c56af4e56eb98da5686e33a224950dfbb8207 pristine_git_object: 78ac34b5053103dc4261c2fbeb9833f97ef109db + docs/components/promptcachebreakpoint.mdx: + id: c135956dc623 + last_write_checksum: sha1:1b0c9884eb9b6fe1d4fdf822c75cb566ead67e07 + pristine_git_object: 1d1ff6162c98c1639ea8e2e4dfa7f6d5cd7d3fcd + docs/components/promptcachebreakpointmode.mdx: + id: 05abe4e54869 + last_write_checksum: sha1:f7ca9f8ff280c1fa750609f4aa13b0706d1dd7cd + pristine_git_object: 37263b53e0db06966ac692cd11558cd68c515637 + docs/components/promptcacheoptions.mdx: + id: 84100012ff84 + last_write_checksum: sha1:fee66864b36bed40090f8e330a390f12b8847dec + pristine_git_object: a9b20d3f963b738ae414738b0b96d42ab8f9ab13 + docs/components/promptcacheoptionsmode.mdx: + id: fbdb2c936b50 + last_write_checksum: sha1:9ad96fb9d26840c0088b7013ef9cba7a7d0431c9 + pristine_git_object: b9df1b4b846931011deabad7c556720ec383ce45 docs/components/promptinjectionscanscope.mdx: id: 27b252a0e798 last_write_checksum: sha1:a8947423372ce9b2edee232b8da4aa0afe5c6619 @@ -3886,8 +3902,12 @@ trackedFiles: pristine_git_object: 99c4a374a4dacb8e64c8a1cf5efb815fb177e22d docs/components/reasoningconfig.mdx: id: e5500b541923 - last_write_checksum: sha1:368c0d607d496c07707b24ce67b1603294c6c91e - pristine_git_object: 42457ac688a05ee75ac807d882c7c949744f2919 + last_write_checksum: sha1:b83b9e28c2808197ddfe72729f5f2795b5df3b33 + pristine_git_object: d087355d2333bdff545bcfcb351aca98dbd8a4ab + docs/components/reasoningcontext.mdx: + id: 8187c67b9cf1 + last_write_checksum: sha1:b24b2ff096dbdf64839e0842812a043a95f2f9a8 + pristine_git_object: fa199a5442e9a1af6f58a63fc04bc597e1e660d0 docs/components/reasoningdeltaevent.mdx: id: 2ec3838c029f last_write_checksum: sha1:15dccf12992148893efb3325d86be310d339fda5 @@ -4110,8 +4130,8 @@ trackedFiles: pristine_git_object: 996cffee821435729436d7f29bce4333f4900382 docs/components/responsesrequest.mdx: id: 0dbcef40a4b1 - last_write_checksum: sha1:6349c1560ef2f55875ce6d926e42117d1b069cee - pristine_git_object: eb2f6540a39471b65545174c8f5658303868f00f + last_write_checksum: sha1:462f684189fca9eefc0809564ab964d89025724d + pristine_git_object: 371d94f398a631b4146a2a76b46dbd257637caba docs/components/responsesrequestplugin.mdx: id: 4d550c41c85f last_write_checksum: sha1:ab9d1e6c062cd51fc976da6ccf393e9974171f7b @@ -6434,8 +6454,8 @@ trackedFiles: pristine_git_object: 6e199abaeb2f5269a885637d65bb176fd235a61c docs/sdks/presets/README.mdx: id: eeb505928d52 - last_write_checksum: sha1:6f71a463dd8d32e2a002e86c3ff37a44350b54af - pristine_git_object: 5e8523f49f3809d1a9f0af88342148d40cf8bb4d + last_write_checksum: sha1:c61b06287a4f3e854cf729a6621a8760ef3c73c0 + pristine_git_object: 5f20994a95b6c41ceab181a1523d1b03935d0ac0 docs/sdks/providers/README.mdx: id: 5ea9af111324 last_write_checksum: sha1:570b55655ee7602d3807c3218e450741f634eed6 @@ -6446,8 +6466,8 @@ trackedFiles: pristine_git_object: cd1b341b1b7c0284b9ba9b102bd8020e0d7ce707 docs/sdks/responses/README.mdx: id: abab319e080e - last_write_checksum: sha1:c93ea3f5b1bedad1e7ac32b47a28dc3fc1bc8bae - pristine_git_object: 03281f8cf709ebb9a81700ade4cf9bc0db665eb6 + last_write_checksum: sha1:69540ef8f6a556c86c4ba8a6ebd4ed03e36ee927 + pristine_git_object: bbd2952598bc9e67b6080bf8ee53d7f6ac838d9c docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 last_write_checksum: sha1:a8e68ac2b0bb8640e01d962177b42ab47b24898b @@ -6470,8 +6490,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:3177e6621f92622eaa6776a68dd2bb077cdcfdc8 - pristine_git_object: d177de9881a5636e96018d98b7d221ec0124761b + last_write_checksum: sha1:e16ca23f9cddf95638b28905c555da47d4c09f0d + pristine_git_object: 31212f7a50ba4ee6134fe7460c6fe12ca48fbfba scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6498,8 +6518,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:f6992fba8825a552cf53e8a013d7e6fa7ca2530c - pristine_git_object: 97bfd4246432cf5e50e7008f1125f9e6db969f75 + last_write_checksum: sha1:1a938199eea20cbbf018bdd7bcdb63590b81ea8b + pristine_git_object: b953813a40461fccd42607239baebf1b5fae2b83 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6538,8 +6558,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:85cd21f3c0b6b129b5b09b952fa3c4e48a9d93a9 - pristine_git_object: d6a693898dda47aad55259292807fc7d31be4e10 + last_write_checksum: sha1:969fd835f76893c65f98b4776374df55095f590d + pristine_git_object: 3e5280df638221322326c598c530d0d7efe6ac44 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6786,12 +6806,12 @@ trackedFiles: pristine_git_object: c59b958cb34640b4cc6329be5154480e4116929f src/openrouter/components/baseinputs_union.py: id: d85e19ff642b - last_write_checksum: sha1:0d8178381a828cc9db2f7b7eb36e0b657f0e1d52 - pristine_git_object: 56b48e741547abaae734d07a4022808fb082f899 + last_write_checksum: sha1:ef1fd31c14b1d9ee88ce2a927e4d68c199d5dce0 + pristine_git_object: f662ef47202e2685b0342486507c31ef27341c8d src/openrouter/components/basereasoningconfig.py: id: 8bd09a7e873a - last_write_checksum: sha1:fbc371f27810d872041ed3e6b24a9f892c71d84b - pristine_git_object: 2e7bcf61a1b6d47a86c755720c1d4ccd0b419e49 + last_write_checksum: sha1:db86178d4a8ebbd0279ba6107b9ae8a6eafa1c44 + pristine_git_object: c70517b14d7851590774b1a21cd813827a875e5e src/openrouter/components/bashservertool.py: id: 1c5881bea648 last_write_checksum: sha1:fd74247241c7371ff595e3b5e8fb1cac31f66ddc @@ -7242,8 +7262,8 @@ trackedFiles: pristine_git_object: 708dfac62530c5fcd29f6bb0be113dc34fd24718 src/openrouter/components/easyinputmessage.py: id: 72619a312585 - last_write_checksum: sha1:6fe16f2a35b373420e6b5289132da3557a3daaca - pristine_git_object: acc023a14c9edefd377c7d213fa928fd046ec999 + last_write_checksum: sha1:d239d7043ffc81d1fa3ec0779f6170f3d494a8f6 + pristine_git_object: 814efc2c2b79781d126d77e0d7fda85dcae7608f src/openrouter/components/edgenetworktimeoutresponseerrordata.py: id: dc53aae5b171 last_write_checksum: sha1:cfbbb83051f349bedda3d81a81ef2d3aea2916d6 @@ -7562,8 +7582,8 @@ trackedFiles: pristine_git_object: 0e7edf2ba9a0c7cfa1e395b240ab55ada9bbd436 src/openrouter/components/inputmessageitem.py: id: 6c5260d62714 - last_write_checksum: sha1:98b5f65b95e9b984ed78a2555e58b33ded517f41 - pristine_git_object: 654f64256a1cc0fdcdcf60c22e0bdc99256fba5a + last_write_checksum: sha1:b3d5ab531388f83247f204f15b9bba082f8aa035 + pristine_git_object: e6332882b51e720126426ccdede1a60f2e90819f src/openrouter/components/inputmodality.py: id: ffa999fb401a last_write_checksum: sha1:da607c1deed71fcc11d880b7cebe92471e2ec5d4 @@ -7578,8 +7598,8 @@ trackedFiles: pristine_git_object: 1371934ab909d77965b050958080277ca8988f09 src/openrouter/components/inputtext.py: id: a995ae96be99 - last_write_checksum: sha1:0e30dbfa1813d3e69e0ccd2511f50080cce0fb6e - pristine_git_object: 088b7564b2d7a76d0a1aef448050975fbc18663c + last_write_checksum: sha1:f78a6a35792b704f18ee6e1312c24f78f38cca36 + pristine_git_object: ab1dcb92e9370c9252ac5623a447669cca01e0ee src/openrouter/components/inputvideo.py: id: d262affd6f7e last_write_checksum: sha1:60c1792ab1f440ae67b5b451fd4d195e02783161 @@ -7850,8 +7870,8 @@ trackedFiles: pristine_git_object: af8258c63d88899948741f0597c89203e461fea1 src/openrouter/components/openairesponseinputmessageitem.py: id: 90c7fe9366e7 - last_write_checksum: sha1:629ebc3b56ae4570554eef76220d9394d189ac0d - pristine_git_object: 3dedde3ce07be821316ef8b9eda0999071d5946b + last_write_checksum: sha1:36c63c2364d5bdb82ab06b91a9cb0c19121d9b69 + pristine_git_object: d96f09596b5e0d88b4de5e5df6315022bb6a65b0 src/openrouter/components/openairesponsesannotation.py: id: 092d7d770eb3 last_write_checksum: sha1:7fed7001721d065ceb1644217e397d7c76ee7203 @@ -8116,6 +8136,14 @@ trackedFiles: id: 40414eada27a last_write_checksum: sha1:0e241830bf9014e8ea814465c573711d8a7caa2c pristine_git_object: 90bdb267893360608210843a5da0d5d68e80d41e + src/openrouter/components/promptcachebreakpoint.py: + id: f1e589a13300 + last_write_checksum: sha1:458ef5170c7c9ea1367dcfb090b1b28333aff73d + pristine_git_object: a082e2d9b4d27d0cffb7794279ab5fb9d9e06789 + src/openrouter/components/promptcacheoptions.py: + id: 5c39fe555e03 + last_write_checksum: sha1:77647b94fd80f6cfcae368bff4c87cbaf903a98e + pristine_git_object: 9d3586245623788e9accd1fe5ff883de89dc4bbe src/openrouter/components/promptinjectionscanscope.py: id: e78ab231a530 last_write_checksum: sha1:f257e3ae2b6385cf758e891ba02601c435e92098 @@ -8178,8 +8206,12 @@ trackedFiles: pristine_git_object: 9adc8e68c6993b0490e8d14e1d2c0f15694dde97 src/openrouter/components/reasoningconfig.py: id: 754fc31a7b69 - last_write_checksum: sha1:7320173c0dd16ceac04a722ac138ee1d00a71165 - pristine_git_object: b0c9375431363731a4a6eb3de53a140e03104244 + last_write_checksum: sha1:03e4e2ec1a964e9d549604a6883001cd241c3b62 + pristine_git_object: fc8b0fb192b13cc1bd9700df1ee91bab73f446c2 + src/openrouter/components/reasoningcontext.py: + id: 39d2491701d9 + last_write_checksum: sha1:91e931a7ef777351be84e50d342fe635b0e1d8be + pristine_git_object: 79fc4af70b05b0bb716ccd1ba43ec1e7443ec41a src/openrouter/components/reasoningdeltaevent.py: id: 6de06228d1f6 last_write_checksum: sha1:efff164cfffbf6b89ab270ac4912243649149457 @@ -8282,8 +8314,8 @@ trackedFiles: pristine_git_object: 1c7f8a0ef6bc011cd6196c4a4c77a94b1cbb6b73 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:a473bffe268a505095e26b83c4eb52cf1ebe3b4b - pristine_git_object: 9a98af5bc71c7be9fd3ec851cebce9b806b384a7 + last_write_checksum: sha1:b6afc18fad09f40c0f343cf5944e80070ef45077 + pristine_git_object: 7331187ebb7ad8010f213526e172d64d2e08d268 src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -8586,8 +8618,8 @@ trackedFiles: pristine_git_object: a0491cc8fd3bd9986146cb1176e27d5b9c9beb60 src/openrouter/components/usage.py: id: 965ca6748bf6 - last_write_checksum: sha1:859ca57d253deee9ccf672095bbe59b52df571d3 - pristine_git_object: 62c5e14fb1646a51b213ce3b5f822d0dc75ad979 + last_write_checksum: sha1:712340f3df2194c53f37d0491e220296ad3c3dbd + pristine_git_object: 572d04f457607099ae7e041922de146de10e2eae src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c last_write_checksum: sha1:bb81c3a4684e20898148e1415980457732da28d2 @@ -9198,8 +9230,8 @@ trackedFiles: pristine_git_object: d24bfa86c4b67290033a18eced04435a3fc3d69f src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:ff4882369524258936055676e9516ebeb68959d5 - pristine_git_object: 83085f60d38d0cb0b5540b8dd1cc1dfb7dc613ee + last_write_checksum: sha1:69ad1119617e8e5af1294075eceb9502492724d0 + pristine_git_object: 13b309db7d8dc063c26af9479110eca7fa5b9641 src/openrouter/providers.py: id: debc4c48f149 last_write_checksum: sha1:11dbc607825edee8dcc84b39ee8171e097c47acf @@ -9214,8 +9246,8 @@ trackedFiles: pristine_git_object: 76378ffba1806e0ca66fc873db1a568be0becebb src/openrouter/responses.py: id: f2108fb635e1 - last_write_checksum: sha1:9d6782aa347b58754a77cacbd85c3fec63febbac - pristine_git_object: 28b31f4ca269976764c47bd9a27f4d942e08f1d4 + last_write_checksum: sha1:b0e886f229ea3a440be77c9a037de5ffcf824100 + pristine_git_object: fbf686bae92410678880d1bbdb8da82c04b1869d src/openrouter/sdk.py: id: ee9846c4c9c5 last_write_checksum: sha1:2247537eca7f88a8f36e53fe011904b98569ad52 @@ -10800,4 +10832,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.reasoning.mode` **Added**\n * `response` **Changed**\n* `open_router.presets.create_presets_responses()`: \n * `request.reasoning.mode` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.presets.create_presets_responses()`: `request` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 1cee56d..7d6f9ff 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.14 + version: 0.11.15 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 719cd05..2851dde 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -3098,6 +3098,8 @@ components: summary: auto nullable: true properties: + context: + $ref: '#/components/schemas/ReasoningContext' effort: $ref: '#/components/schemas/ReasoningEffort' mode: @@ -10356,6 +10358,8 @@ components: text: Hello, how can I help you? type: input_text properties: + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpoint' text: type: string type: @@ -15519,6 +15523,9 @@ components: type: integer input_tokens_details: properties: + cache_write_tokens: + nullable: true + type: integer cached_tokens: type: integer required: @@ -17911,6 +17918,38 @@ components: required: - type type: object + PromptCacheBreakpoint: + description: >- + Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. + example: + mode: explicit + nullable: true + properties: + mode: + enum: + - explicit + type: string + required: + - mode + type: object + PromptCacheOptions: + description: >- + Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. + example: + mode: explicit + ttl: 30m + nullable: true + properties: + mode: + enum: + - explicit + type: string + ttl: + nullable: true + type: string + required: + - mode + type: object PromptInjectionScanScope: description: >- Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults to all_messages. @@ -19243,6 +19282,18 @@ components: example: enabled: true summary: auto + ReasoningContext: + description: >- + Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. + enum: + - auto + - all_turns + - current_turn + - null + example: all_turns + nullable: true + type: string + x-speakeasy-unknown-values: allow ReasoningDeltaEvent: allOf: - $ref: '#/components/schemas/BaseReasoningDeltaEvent' @@ -19855,6 +19906,8 @@ components: prompt_cache_key: nullable: true type: string + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptions' provider: $ref: '#/components/schemas/ProviderPreferences' reasoning: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 83e115d..c153a70 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:d327ecf77f0054c2b8ef6744061285c669e336bcffefed3734162fa92619b7da - sourceBlobDigest: sha256:cecf0268e9e30429f9c9d516f5c6a5881ea046b4c6f53f8997c1f8c9a9108898 + sourceRevisionDigest: sha256:638456160de19dc7f76c9dc98b0b3d709f41eeadeb33db0842cc4a2ef4b6bf83 + sourceBlobDigest: sha256:20ee9b71a9893734705e46acd21f565ff71406ed4c0269adabc2fef3e20b1c48 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:d327ecf77f0054c2b8ef6744061285c669e336bcffefed3734162fa92619b7da - sourceBlobDigest: sha256:cecf0268e9e30429f9c9d516f5c6a5881ea046b4c6f53f8997c1f8c9a9108898 + sourceRevisionDigest: sha256:638456160de19dc7f76c9dc98b0b3d709f41eeadeb33db0842cc4a2ef4b6bf83 + sourceBlobDigest: sha256:20ee9b71a9893734705e46acd21f565ff71406ed4c0269adabc2fef3e20b1c48 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:a276c0ed9f4e7618be962a296d3e456696c53c9f8f83d787218fe50779ff395f + codeSamplesRevisionDigest: sha256:bd0f33f1c085bdb89c4eb8b925b93de8b35cc7286fc4f00041955a4f0bafea09 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 0d26d50..5b43d9b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -248,4 +248,14 @@ Based on: ### Generated - [python v0.11.14] . ### Releases -- [PyPI v0.11.14] https://pypi.org/project/openrouter/0.11.14 - . \ No newline at end of file +- [PyPI v0.11.14] https://pypi.org/project/openrouter/0.11.14 - . + +## 2026-07-09 18:16:05 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.15] . +### Releases +- [PyPI v0.11.15] https://pypi.org/project/openrouter/0.11.15 - . \ No newline at end of file diff --git a/docs/components/basereasoningconfig.mdx b/docs/components/basereasoningconfig.mdx index 3ccce9e..6f900a9 100644 --- a/docs/components/basereasoningconfig.mdx +++ b/docs/components/basereasoningconfig.mdx @@ -4,8 +4,9 @@ title: "BaseReasoningConfig" ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | -| `mode` | [OptionalNullable[components.ReasoningMode]](../components/reasoningmode.mdx) | :heavy_minus_sign: | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. | standard | -| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `context` | [OptionalNullable[components.ReasoningContext]](../components/reasoningcontext.mdx) | :heavy_minus_sign: | Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. | all_turns | +| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | +| `mode` | [OptionalNullable[components.ReasoningMode]](../components/reasoningmode.mdx) | :heavy_minus_sign: | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. | standard | +| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | \ No newline at end of file diff --git a/docs/components/inputtext.mdx b/docs/components/inputtext.mdx index 5ebcb83..ece32d6 100644 --- a/docs/components/inputtext.mdx +++ b/docs/components/inputtext.mdx @@ -7,7 +7,8 @@ Text input content item ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `text` | *str* | :heavy_check_mark: | N/A | -| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit"
} | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/inputtokensdetails.mdx b/docs/components/inputtokensdetails.mdx index c58b1d0..daa531b 100644 --- a/docs/components/inputtokensdetails.mdx +++ b/docs/components/inputtokensdetails.mdx @@ -4,6 +4,7 @@ title: "InputTokensDetails" ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `cached_tokens` | *int* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `cache_write_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | +| `cached_tokens` | *int* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/promptcachebreakpoint.mdx b/docs/components/promptcachebreakpoint.mdx new file mode 100644 index 0000000..1d1ff61 --- /dev/null +++ b/docs/components/promptcachebreakpoint.mdx @@ -0,0 +1,12 @@ +--- +title: "PromptCacheBreakpoint" +--- + +Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `mode` | [components.PromptCacheBreakpointMode](../components/promptcachebreakpointmode.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/promptcachebreakpointmode.mdx b/docs/components/promptcachebreakpointmode.mdx new file mode 100644 index 0000000..37263b5 --- /dev/null +++ b/docs/components/promptcachebreakpointmode.mdx @@ -0,0 +1,15 @@ +--- +title: "PromptCacheBreakpointMode" +--- + +## Example Usage + +```python +from openrouter.components import PromptCacheBreakpointMode +value: PromptCacheBreakpointMode = "explicit" +``` + + +## Values + +- `"explicit"` diff --git a/docs/components/promptcacheoptions.mdx b/docs/components/promptcacheoptions.mdx new file mode 100644 index 0000000..a9b20d3 --- /dev/null +++ b/docs/components/promptcacheoptions.mdx @@ -0,0 +1,13 @@ +--- +title: "PromptCacheOptions" +--- + +Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `mode` | [components.PromptCacheOptionsMode](../components/promptcacheoptionsmode.mdx) | :heavy_check_mark: | N/A | +| `ttl` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/promptcacheoptionsmode.mdx b/docs/components/promptcacheoptionsmode.mdx new file mode 100644 index 0000000..b9df1b4 --- /dev/null +++ b/docs/components/promptcacheoptionsmode.mdx @@ -0,0 +1,15 @@ +--- +title: "PromptCacheOptionsMode" +--- + +## Example Usage + +```python +from openrouter.components import PromptCacheOptionsMode +value: PromptCacheOptionsMode = "explicit" +``` + + +## Values + +- `"explicit"` diff --git a/docs/components/reasoningconfig.mdx b/docs/components/reasoningconfig.mdx index 42457ac..d087355 100644 --- a/docs/components/reasoningconfig.mdx +++ b/docs/components/reasoningconfig.mdx @@ -7,10 +7,11 @@ Configuration for reasoning mode in the response ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | -| `mode` | [OptionalNullable[components.ReasoningMode]](../components/reasoningmode.mdx) | :heavy_minus_sign: | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. | standard | -| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | -| `enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `context` | [OptionalNullable[components.ReasoningContext]](../components/reasoningcontext.mdx) | :heavy_minus_sign: | Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. | all_turns | +| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium | +| `mode` | [OptionalNullable[components.ReasoningMode]](../components/reasoningmode.mdx) | :heavy_minus_sign: | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. | standard | +| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto | +| `enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | +| `max_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/reasoningcontext.mdx b/docs/components/reasoningcontext.mdx new file mode 100644 index 0000000..fa199a5 --- /dev/null +++ b/docs/components/reasoningcontext.mdx @@ -0,0 +1,23 @@ +--- +title: "ReasoningContext" +--- + +Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. + +## Example Usage + +```python +from openrouter.components import ReasoningContext + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ReasoningContext = "auto" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"auto"` +- `"all_turns"` +- `"current_turn"` diff --git a/docs/components/responsesrequest.mdx b/docs/components/responsesrequest.mdx index eb2f654..371d94f 100644 --- a/docs/components/responsesrequest.mdx +++ b/docs/components/responsesrequest.mdx @@ -29,6 +29,7 @@ Request schema for Responses endpoint | `previous_response_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `prompt` | [OptionalNullable[components.StoredPromptTemplate]](../components/storedprompttemplate.mdx) | :heavy_minus_sign: | N/A | \{
"id": "prompt-abc123",
"variables": \{
"name": "John"
}
} | | `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [OptionalNullable[components.ReasoningConfig]](../components/reasoningconfig.mdx) | :heavy_minus_sign: | Configuration for reasoning mode in the response | \{
"enabled": true,
"summary": "auto"
} | | `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | diff --git a/docs/sdks/presets/README.mdx b/docs/sdks/presets/README.mdx index 5e8523f..5f20994 100644 --- a/docs/sdks/presets/README.mdx +++ b/docs/sdks/presets/README.mdx @@ -350,6 +350,7 @@ with OpenRouter( | `previous_response_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `prompt` | [OptionalNullable[components.StoredPromptTemplate]](../../components/storedprompttemplate.mdx) | :heavy_minus_sign: | N/A | \{
"id": "prompt-abc123",
"variables": \{
"name": "John"
}
} | | `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [OptionalNullable[components.ReasoningConfig]](../../components/reasoningconfig.mdx) | :heavy_minus_sign: | Configuration for reasoning mode in the response | \{
"enabled": true,
"summary": "auto"
} | | `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | diff --git a/docs/sdks/responses/README.mdx b/docs/sdks/responses/README.mdx index 03281f8..bbd2952 100644 --- a/docs/sdks/responses/README.mdx +++ b/docs/sdks/responses/README.mdx @@ -88,6 +88,7 @@ with OpenRouter( | `previous_response_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | | `prompt` | [OptionalNullable[components.StoredPromptTemplate]](../../components/storedprompttemplate.mdx) | :heavy_minus_sign: | N/A | \{
"id": "prompt-abc123",
"variables": \{
"name": "John"
}
} | | `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [OptionalNullable[components.ReasoningConfig]](../../components/reasoningconfig.mdx) | :heavy_minus_sign: | Configuration for reasoning mode in the response | \{
"enabled": true,
"summary": "auto"
} | | `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | diff --git a/pyproject.toml b/pyproject.toml index d177de9..31212f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.14" +version = "0.11.15" 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 97bfd42..b953813 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.14" +__version__: str = "0.11.15" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.14 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.15 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 d6a6938..3e5280d 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2139,6 +2139,16 @@ if TYPE_CHECKING: PreviewWebSearchUserLocationType, PreviewWebSearchUserLocationTypedDict, ) + from .promptcachebreakpoint import ( + PromptCacheBreakpoint, + PromptCacheBreakpointMode, + PromptCacheBreakpointTypedDict, + ) + from .promptcacheoptions import ( + PromptCacheOptions, + PromptCacheOptionsMode, + PromptCacheOptionsTypedDict, + ) from .promptinjectionscanscope import PromptInjectionScanScope from .providername import ProviderName from .provideroptions import ProviderOptions, ProviderOptionsTypedDict @@ -2199,6 +2209,7 @@ if TYPE_CHECKING: RankingsDailyResponseTypedDict, ) from .reasoningconfig import ReasoningConfig, ReasoningConfigTypedDict + from .reasoningcontext import ReasoningContext from .reasoningdeltaevent import ( ReasoningDeltaEvent, ReasoningDeltaEventType, @@ -4217,6 +4228,12 @@ __all__ = [ "PriceSource", "Pricing", "PricingTypedDict", + "PromptCacheBreakpoint", + "PromptCacheBreakpointMode", + "PromptCacheBreakpointTypedDict", + "PromptCacheOptions", + "PromptCacheOptionsMode", + "PromptCacheOptionsTypedDict", "PromptInjectionScanScope", "ProviderName", "ProviderOptions", @@ -4253,6 +4270,7 @@ __all__ = [ "Reason", "ReasoningConfig", "ReasoningConfigTypedDict", + "ReasoningContext", "ReasoningDeltaEvent", "ReasoningDeltaEventType", "ReasoningDeltaEventTypedDict", @@ -6342,6 +6360,12 @@ _dynamic_imports: dict[str, str] = { "PreviewWebSearchUserLocation": ".preview_websearchuserlocation", "PreviewWebSearchUserLocationType": ".preview_websearchuserlocation", "PreviewWebSearchUserLocationTypedDict": ".preview_websearchuserlocation", + "PromptCacheBreakpoint": ".promptcachebreakpoint", + "PromptCacheBreakpointMode": ".promptcachebreakpoint", + "PromptCacheBreakpointTypedDict": ".promptcachebreakpoint", + "PromptCacheOptions": ".promptcacheoptions", + "PromptCacheOptionsMode": ".promptcacheoptions", + "PromptCacheOptionsTypedDict": ".promptcacheoptions", "PromptInjectionScanScope": ".promptinjectionscanscope", "ProviderName": ".providername", "ProviderOptions": ".provideroptions", @@ -6390,6 +6414,7 @@ _dynamic_imports: dict[str, str] = { "RankingsDailyResponseTypedDict": ".rankingsdailyresponse", "ReasoningConfig": ".reasoningconfig", "ReasoningConfigTypedDict": ".reasoningconfig", + "ReasoningContext": ".reasoningcontext", "ReasoningDeltaEvent": ".reasoningdeltaevent", "ReasoningDeltaEventType": ".reasoningdeltaevent", "ReasoningDeltaEventTypedDict": ".reasoningdeltaevent", diff --git a/src/openrouter/components/baseinputs_union.py b/src/openrouter/components/baseinputs_union.py index 56b48e7..f662ef4 100644 --- a/src/openrouter/components/baseinputs_union.py +++ b/src/openrouter/components/baseinputs_union.py @@ -53,7 +53,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict BaseInputsContent1TypedDict = TypeAliasType( "BaseInputsContent1TypedDict", Union[ - InputTextTypedDict, InputAudioTypedDict, InputImageTypedDict, InputFileTypedDict + InputAudioTypedDict, InputTextTypedDict, InputImageTypedDict, InputFileTypedDict ], ) diff --git a/src/openrouter/components/basereasoningconfig.py b/src/openrouter/components/basereasoningconfig.py index 2e7bcf6..c70517b 100644 --- a/src/openrouter/components/basereasoningconfig.py +++ b/src/openrouter/components/basereasoningconfig.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .reasoningcontext import ReasoningContext from .reasoningeffort import ReasoningEffort from .reasoningmode import ReasoningMode from .reasoningsummaryverbosity import ReasoningSummaryVerbosity @@ -16,6 +17,8 @@ from typing_extensions import NotRequired, TypedDict class BaseReasoningConfigTypedDict(TypedDict): + context: NotRequired[Nullable[ReasoningContext]] + r"""Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.""" effort: NotRequired[Nullable[ReasoningEffort]] mode: NotRequired[Nullable[ReasoningMode]] r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.""" @@ -23,6 +26,9 @@ class BaseReasoningConfigTypedDict(TypedDict): class BaseReasoningConfig(BaseModel): + context: OptionalNullable[ReasoningContext] = UNSET + r"""Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.""" + effort: OptionalNullable[ReasoningEffort] = UNSET mode: OptionalNullable[ReasoningMode] = UNSET @@ -32,8 +38,8 @@ class BaseReasoningConfig(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["effort", "mode", "summary"]) - nullable_fields = set(["effort", "mode", "summary"]) + optional_fields = set(["context", "effort", "mode", "summary"]) + nullable_fields = set(["context", "effort", "mode", "summary"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/easyinputmessage.py b/src/openrouter/components/easyinputmessage.py index acc023a..814efc2 100644 --- a/src/openrouter/components/easyinputmessage.py +++ b/src/openrouter/components/easyinputmessage.py @@ -79,9 +79,9 @@ class EasyInputMessageContentInputImage(BaseModel): EasyInputMessageContentUnion1TypedDict = TypeAliasType( "EasyInputMessageContentUnion1TypedDict", Union[ - InputTextTypedDict, InputAudioTypedDict, InputVideoTypedDict, + InputTextTypedDict, EasyInputMessageContentInputImageTypedDict, InputFileTypedDict, ], diff --git a/src/openrouter/components/inputmessageitem.py b/src/openrouter/components/inputmessageitem.py index 654f642..e633288 100644 --- a/src/openrouter/components/inputmessageitem.py +++ b/src/openrouter/components/inputmessageitem.py @@ -79,9 +79,9 @@ class InputMessageItemContentInputImage(BaseModel): InputMessageItemContentUnionTypedDict = TypeAliasType( "InputMessageItemContentUnionTypedDict", Union[ - InputTextTypedDict, InputAudioTypedDict, InputVideoTypedDict, + InputTextTypedDict, InputMessageItemContentInputImageTypedDict, InputFileTypedDict, ], diff --git a/src/openrouter/components/inputtext.py b/src/openrouter/components/inputtext.py index 088b756..ab1dcb9 100644 --- a/src/openrouter/components/inputtext.py +++ b/src/openrouter/components/inputtext.py @@ -1,9 +1,17 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel +from .promptcachebreakpoint import PromptCacheBreakpoint, PromptCacheBreakpointTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer from typing import Literal -from typing_extensions import TypedDict +from typing_extensions import NotRequired, TypedDict InputTextType = Literal["input_text",] @@ -14,6 +22,8 @@ class InputTextTypedDict(TypedDict): text: str type: InputTextType + prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]] + r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" class InputText(BaseModel): @@ -22,3 +32,31 @@ class InputText(BaseModel): text: str type: InputTextType + + prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET + r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["prompt_cache_breakpoint"]) + nullable_fields = set(["prompt_cache_breakpoint"]) + 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/components/openairesponseinputmessageitem.py b/src/openrouter/components/openairesponseinputmessageitem.py index 3dedde3..d96f095 100644 --- a/src/openrouter/components/openairesponseinputmessageitem.py +++ b/src/openrouter/components/openairesponseinputmessageitem.py @@ -17,7 +17,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict OpenAIResponseInputMessageItemContentTypedDict = TypeAliasType( "OpenAIResponseInputMessageItemContentTypedDict", Union[ - InputTextTypedDict, InputAudioTypedDict, InputImageTypedDict, InputFileTypedDict + InputAudioTypedDict, InputTextTypedDict, InputImageTypedDict, InputFileTypedDict ], ) diff --git a/src/openrouter/components/promptcachebreakpoint.py b/src/openrouter/components/promptcachebreakpoint.py new file mode 100644 index 0000000..a082e2d --- /dev/null +++ b/src/openrouter/components/promptcachebreakpoint.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +PromptCacheBreakpointMode = Literal["explicit",] + + +class PromptCacheBreakpointTypedDict(TypedDict): + r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + + mode: PromptCacheBreakpointMode + + +class PromptCacheBreakpoint(BaseModel): + r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + + mode: PromptCacheBreakpointMode diff --git a/src/openrouter/components/promptcacheoptions.py b/src/openrouter/components/promptcacheoptions.py new file mode 100644 index 0000000..9d35862 --- /dev/null +++ b/src/openrouter/components/promptcacheoptions.py @@ -0,0 +1,56 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import Literal +from typing_extensions import NotRequired, TypedDict + + +PromptCacheOptionsMode = Literal["explicit",] + + +class PromptCacheOptionsTypedDict(TypedDict): + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" + + mode: PromptCacheOptionsMode + ttl: NotRequired[Nullable[str]] + + +class PromptCacheOptions(BaseModel): + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" + + mode: PromptCacheOptionsMode + + ttl: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["ttl"]) + nullable_fields = set(["ttl"]) + 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/components/reasoningconfig.py b/src/openrouter/components/reasoningconfig.py index b0c9375..fc8b0fb 100644 --- a/src/openrouter/components/reasoningconfig.py +++ b/src/openrouter/components/reasoningconfig.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .reasoningcontext import ReasoningContext from .reasoningeffort import ReasoningEffort from .reasoningmode import ReasoningMode from .reasoningsummaryverbosity import ReasoningSummaryVerbosity @@ -18,6 +19,8 @@ from typing_extensions import NotRequired, TypedDict class ReasoningConfigTypedDict(TypedDict): r"""Configuration for reasoning mode in the response""" + context: NotRequired[Nullable[ReasoningContext]] + r"""Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.""" effort: NotRequired[Nullable[ReasoningEffort]] mode: NotRequired[Nullable[ReasoningMode]] r"""Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.""" @@ -29,6 +32,9 @@ class ReasoningConfigTypedDict(TypedDict): class ReasoningConfig(BaseModel): r"""Configuration for reasoning mode in the response""" + context: OptionalNullable[ReasoningContext] = UNSET + r"""Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.""" + effort: OptionalNullable[ReasoningEffort] = UNSET mode: OptionalNullable[ReasoningMode] = UNSET @@ -42,8 +48,12 @@ class ReasoningConfig(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["effort", "mode", "summary", "enabled", "max_tokens"]) - nullable_fields = set(["effort", "mode", "summary", "enabled", "max_tokens"]) + optional_fields = set( + ["context", "effort", "mode", "summary", "enabled", "max_tokens"] + ) + nullable_fields = set( + ["context", "effort", "mode", "summary", "enabled", "max_tokens"] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/reasoningcontext.py b/src/openrouter/components/reasoningcontext.py new file mode 100644 index 0000000..79fc4af --- /dev/null +++ b/src/openrouter/components/reasoningcontext.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 + + +ReasoningContext = Union[ + Literal[ + "auto", + "all_turns", + "current_turn", + ], + UnrecognizedStr, +] +r"""Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.""" diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 9a98af5..7331187 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -72,6 +72,7 @@ from .preview_websearchservertool import ( PreviewWebSearchServerTool, PreviewWebSearchServerToolTypedDict, ) +from .promptcacheoptions import PromptCacheOptions, PromptCacheOptionsTypedDict from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDict from .reasoningconfig import ReasoningConfig, ReasoningConfigTypedDict from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict @@ -314,6 +315,8 @@ class ResponsesRequestTypedDict(TypedDict): previous_response_id: NotRequired[Nullable[str]] prompt: NotRequired[Nullable[StoredPromptTemplateTypedDict]] prompt_cache_key: NotRequired[Nullable[str]] + prompt_cache_options: NotRequired[Nullable[PromptCacheOptionsTypedDict]] + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" provider: NotRequired[Nullable[ProviderPreferencesTypedDict]] r"""When multiple model providers are available, optionally indicate your routing preference.""" reasoning: NotRequired[Nullable[ReasoningConfigTypedDict]] @@ -391,6 +394,9 @@ class ResponsesRequest(BaseModel): prompt_cache_key: OptionalNullable[str] = UNSET + prompt_cache_options: OptionalNullable[PromptCacheOptions] = UNSET + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" + provider: OptionalNullable[ProviderPreferences] = UNSET r"""When multiple model providers are available, optionally indicate your routing preference.""" @@ -461,6 +467,7 @@ class ResponsesRequest(BaseModel): "previous_response_id", "prompt", "prompt_cache_key", + "prompt_cache_options", "provider", "reasoning", "safety_identifier", @@ -495,6 +502,7 @@ class ResponsesRequest(BaseModel): "previous_response_id", "prompt", "prompt_cache_key", + "prompt_cache_options", "provider", "reasoning", "safety_identifier", diff --git a/src/openrouter/components/usage.py b/src/openrouter/components/usage.py index 62c5e14..572d04f 100644 --- a/src/openrouter/components/usage.py +++ b/src/openrouter/components/usage.py @@ -15,11 +15,39 @@ from typing_extensions import NotRequired, TypedDict class InputTokensDetailsTypedDict(TypedDict): cached_tokens: int + cache_write_tokens: NotRequired[Nullable[int]] class InputTokensDetails(BaseModel): cached_tokens: int + cache_write_tokens: OptionalNullable[int] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["cache_write_tokens"]) + nullable_fields = set(["cache_write_tokens"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + class OutputTokensDetailsTypedDict(TypedDict): reasoning_tokens: int diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index 83085f6..13b309d 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -1989,6 +1989,9 @@ class Presets(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -2070,6 +2073,7 @@ class Presets(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -2142,6 +2146,10 @@ class Presets(BaseSDK): prompt, OptionalNullable[components.StoredPromptTemplate] ), prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -2333,6 +2341,9 @@ class Presets(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -2414,6 +2425,7 @@ class Presets(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -2486,6 +2498,10 @@ class Presets(BaseSDK): prompt, OptionalNullable[components.StoredPromptTemplate] ), prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index 28b31f4..fbf686b 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -74,6 +74,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -153,6 +156,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -228,6 +232,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -307,6 +314,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -382,6 +390,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -464,6 +475,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -538,6 +550,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -620,6 +635,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -692,6 +708,10 @@ class Responses(BaseSDK): prompt, OptionalNullable[components.StoredPromptTemplate] ), prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -973,6 +993,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1052,6 +1075,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -1127,6 +1151,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1206,6 +1233,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -1281,6 +1309,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1363,6 +1394,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -1437,6 +1469,9 @@ class Responses(BaseSDK): ] ] = UNSET, prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1519,6 +1554,7 @@ class Responses(BaseSDK): :param previous_response_id: :param prompt: :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration for reasoning mode in the response :param safety_identifier: @@ -1591,6 +1627,10 @@ class Responses(BaseSDK): prompt, OptionalNullable[components.StoredPromptTemplate] ), prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), diff --git a/uv.lock b/uv.lock index 41606a8..0f343e9 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.14" +version = "0.11.15" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 52b53dd35ae88a7e4a0a9aa0532ba3307cdc6a12 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 19:47:13 +0000 Subject: [PATCH 27/62] chore: update OpenAPI spec from monorepo (#419) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 67f9439..70f7fa3 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -9576,9 +9576,6 @@ components: type: string type: object model: - enum: - - gpt-image-1 - - gpt-image-1-mini type: string moderation: enum: @@ -9603,11 +9600,6 @@ components: - auto type: string size: - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto type: string type: enum: @@ -19917,6 +19909,7 @@ components: - empty_image_file - failed_to_download_image - image_file_not_found + - bio_policy type: string message: type: string From dfebb7ca0dda989e7b6a45d6a069f3397d4ff619 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 19:53:03 +0000 Subject: [PATCH 28/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.16=20(#420)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 50 ++++++++----------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 11 +--- .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 ++++- docs/components/code.mdx | 1 + docs/components/imagegenerationservertool.mdx | 4 +- docs/components/modelenum.mdx | 20 -------- docs/components/size.mdx | 22 -------- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 6 --- .../components/imagegenerationservertool.py | 30 ++--------- .../components/responseserrorfield.py | 1 + uv.lock | 2 +- 15 files changed, 52 insertions(+), 125 deletions(-) delete mode 100644 docs/components/modelenum.mdx delete mode 100644 docs/components/size.mdx diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b0d351f..1ae9272 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: d7b69b574731b7c9c94be5901ee7a5c5 + docChecksum: a4a66ca81e062a140820ff0a8797409f docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.15 - configChecksum: 90c0043479fd28548bbe6b76d7541742 + releaseVersion: 0.11.16 + configChecksum: a4a1bd1b84fa14d397a7dfb0bb351efc repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c1cfa591-61b4-49f2-80a7-e1007bcbe17f - pristine_commit_hash: 1a48d7424a4c6692678c01def7f1d0e12d687c0c - pristine_tree_hash: e1b850bb5a9838612c0137a69be76c48ef66ac8e + generation_id: c9801f2b-9850-4020-b390-d229911befbe + pristine_commit_hash: 71dbc8aa473f514b093d15901e5f67dece278cb7 + pristine_tree_hash: 2769400e291cb8861d2736b7b3e036f7d043614e features: python: acceptHeaders: 3.0.0 @@ -1098,8 +1098,8 @@ trackedFiles: pristine_git_object: d5682fcb62d709606d7e073a9447621cc6da7a68 docs/components/code.mdx: id: 1cc125f1dfa9 - last_write_checksum: sha1:4a06fc3c63211ff7ac30cd5012663f58d077d3ec - pristine_git_object: dc6776c36813b18fba2613f5cfaf147acb229a90 + last_write_checksum: sha1:322ba712be712d52ddd41577792f1d4ec2012c9c + pristine_git_object: 7605a858caea23ecb7afe6bcc306d659abc245c6 docs/components/codeinterpreterservertool.mdx: id: d828abe3a52a last_write_checksum: sha1:8eafcbabe4084b286d34a7b2e7db0f99ad547727 @@ -2110,8 +2110,8 @@ trackedFiles: pristine_git_object: e36ed8937fc9401d2741d97cc03ff5c0ffc3bd52 docs/components/imagegenerationservertool.mdx: id: "299013078656" - last_write_checksum: sha1:663ae715382f7f22890ea81a43ddb3cd0c07cf6b - pristine_git_object: c290753ad894940926de78e89ec89f19f71b7370 + last_write_checksum: sha1:e0bcf01506046b995743f16aa0bffbe10f65846e + pristine_git_object: c620407af23e39d21aa1e4a372fc2584cdb7a072 docs/components/imagegenerationservertoolbackground.mdx: id: d42f0c89a96f last_write_checksum: sha1:1e06585c90c3fd1fbe38bbf24d2c382cfe5f0738 @@ -2728,10 +2728,6 @@ trackedFiles: id: a56406a8820b last_write_checksum: sha1:556248629a58731cd01f96ad5972f9d09c00e8af pristine_git_object: f9d4890de1167d8a1fbef33478ab3de57b5396ab - docs/components/modelenum.mdx: - id: 354b0a829212 - last_write_checksum: sha1:52c95ff24eb1c1f0a797e99f1915a218f9f22758 - pristine_git_object: 815fb46e5e07168841ed484059450e5e9cdf3a49 docs/components/modelgroup.mdx: id: 8f246164d34c last_write_checksum: sha1:2954097c66c1dd56fa0440a501630275a6cfebea @@ -4268,10 +4264,6 @@ trackedFiles: id: b35cae5eacec last_write_checksum: sha1:6865169ff4445d70d63c674092812b47236f213f pristine_git_object: 1c0dd3c44cfce8b531e7d89e3db6b2787f060984 - docs/components/size.mdx: - id: 21d53f42f1b5 - last_write_checksum: sha1:543c159668e36a35b0d6f2357e4b9cfda44ce2f4 - pristine_git_object: 707abe9890dce5df4f29843cb2b05cff5d9f280c docs/components/sort.mdx: id: 2423f4a05690 last_write_checksum: sha1:3443886b2481e8685a1c390530dfd7b763d9f237 @@ -6490,8 +6482,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:e16ca23f9cddf95638b28905c555da47d4c09f0d - pristine_git_object: 31212f7a50ba4ee6134fe7460c6fe12ca48fbfba + last_write_checksum: sha1:061a0de3204cab06837642e4c0785b6b93705db3 + pristine_git_object: 60e16427643f806b9ab68941ac30f77e162c0c64 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6518,8 +6510,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:1a938199eea20cbbf018bdd7bcdb63590b81ea8b - pristine_git_object: b953813a40461fccd42607239baebf1b5fae2b83 + last_write_checksum: sha1:24cd6e9d1cf6e73b5cdef8748fa0124728b83567 + pristine_git_object: 623fc3453b008b588e0be363ab8c42525c104cfb src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6558,8 +6550,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:969fd835f76893c65f98b4776374df55095f590d - pristine_git_object: 3e5280df638221322326c598c530d0d7efe6ac44 + last_write_checksum: sha1:010555a6206e0d8eaf1215bab3ad9a3a86db071f + pristine_git_object: d127e29e5b6be993e21770cb1d968397fda34e8f src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -7502,8 +7494,8 @@ trackedFiles: pristine_git_object: 687008d328b39a67390cdf0ab3eb8f6179ae6f7c src/openrouter/components/imagegenerationservertool.py: id: 9c95bc975f2e - last_write_checksum: sha1:f87c338c9b54030623f7f3e32f08a064e411f76c - pristine_git_object: 6e4cf9a3bd6eb13429a87a31c22864f56567e889 + last_write_checksum: sha1:808635f6a028797cd87918e3a3353d6c3bf00226 + pristine_git_object: bdf825ff7cbb8efb1a6aca6baebb724f877c6108 src/openrouter/components/imagegenerationservertool_openrouter.py: id: b7499cf15b3a last_write_checksum: sha1:37b4e32b48943100d6a3c894c514a9785e08c797 @@ -8310,8 +8302,8 @@ trackedFiles: pristine_git_object: 900bf08ec940565a8cbf55712a437775db00ca46 src/openrouter/components/responseserrorfield.py: id: 565a88fd70a1 - last_write_checksum: sha1:2547f2be40063fd0c897edd541c38485ddbd598f - pristine_git_object: 1c7f8a0ef6bc011cd6196c4a4c77a94b1cbb6b73 + last_write_checksum: sha1:98c70c30d80e112b471776feb4dd3c0cee5b26f3 + pristine_git_object: f38c8edcb616d9e7cbd0f724fbb9d9f5aae014f9 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d last_write_checksum: sha1:b6afc18fad09f40c0f343cf5944e80070ef45077 @@ -10832,4 +10824,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.presets.create_presets_responses()`: `request` **Changed**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.tools[].union(image_generation)` **Changed** (Breaking ⚠️)\n * `response` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_responses()`: \n * `request.tools[].union(image_generation)` **Changed** (Breaking ⚠️)\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 7d6f9ff..76543dd 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.15 + version: 0.11.16 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2851dde..198ee99 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9517,11 +9517,7 @@ components: type: string type: object model: - enum: - - gpt-image-1 - - gpt-image-1-mini type: string - x-speakeasy-unknown-values: allow moderation: enum: - auto @@ -9548,13 +9544,7 @@ components: type: string x-speakeasy-unknown-values: allow size: - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto type: string - x-speakeasy-unknown-values: allow type: enum: - image_generation @@ -19792,6 +19782,7 @@ components: - empty_image_file - failed_to_download_image - image_file_not_found + - bio_policy type: string x-speakeasy-unknown-values: allow message: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index c153a70..af61311 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:638456160de19dc7f76c9dc98b0b3d709f41eeadeb33db0842cc4a2ef4b6bf83 - sourceBlobDigest: sha256:20ee9b71a9893734705e46acd21f565ff71406ed4c0269adabc2fef3e20b1c48 + sourceRevisionDigest: sha256:daca20db09d6cfb4b50c5e6bf7d8f5cbadae39021bd5cb9c856d71b4e6f9c192 + sourceBlobDigest: sha256:0834507d142ac7906f4ca76b874a2b49bd5709b782a420377f3cf4349552a445 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:638456160de19dc7f76c9dc98b0b3d709f41eeadeb33db0842cc4a2ef4b6bf83 - sourceBlobDigest: sha256:20ee9b71a9893734705e46acd21f565ff71406ed4c0269adabc2fef3e20b1c48 + sourceRevisionDigest: sha256:daca20db09d6cfb4b50c5e6bf7d8f5cbadae39021bd5cb9c856d71b4e6f9c192 + sourceBlobDigest: sha256:0834507d142ac7906f4ca76b874a2b49bd5709b782a420377f3cf4349552a445 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:bd0f33f1c085bdb89c4eb8b925b93de8b35cc7286fc4f00041955a4f0bafea09 + codeSamplesRevisionDigest: sha256:d7c4a0cd51e67e5c63e2540958b5a5df3406fbbe723c58338a51e48feb9ddae2 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 5b43d9b..0076cf6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -258,4 +258,14 @@ Based on: ### Generated - [python v0.11.15] . ### Releases -- [PyPI v0.11.15] https://pypi.org/project/openrouter/0.11.15 - . \ No newline at end of file +- [PyPI v0.11.15] https://pypi.org/project/openrouter/0.11.15 - . + +## 2026-07-09 19:48:43 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.16] . +### Releases +- [PyPI v0.11.16] https://pypi.org/project/openrouter/0.11.16 - . \ No newline at end of file diff --git a/docs/components/code.mdx b/docs/components/code.mdx index dc6776c..7605a85 100644 --- a/docs/components/code.mdx +++ b/docs/components/code.mdx @@ -34,3 +34,4 @@ This is an open enum. Unrecognized values will not fail type checks. - `"empty_image_file"` - `"failed_to_download_image"` - `"image_file_not_found"` +- `"bio_policy"` diff --git a/docs/components/imagegenerationservertool.mdx b/docs/components/imagegenerationservertool.mdx index c290753..c620407 100644 --- a/docs/components/imagegenerationservertool.mdx +++ b/docs/components/imagegenerationservertool.mdx @@ -12,11 +12,11 @@ Image generation tool configuration | `background` | [Optional[components.ImageGenerationServerToolBackground]](../components/imagegenerationservertoolbackground.mdx) | :heavy_minus_sign: | N/A | | `input_fidelity` | [OptionalNullable[components.InputFidelity]](../components/inputfidelity.mdx) | :heavy_minus_sign: | N/A | | `input_image_mask` | [Optional[components.InputImageMask]](../components/inputimagemask.mdx) | :heavy_minus_sign: | N/A | -| `model` | [Optional[components.ModelEnum]](../components/modelenum.mdx) | :heavy_minus_sign: | N/A | +| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | | `moderation` | [Optional[components.Moderation]](../components/moderation.mdx) | :heavy_minus_sign: | N/A | | `output_compression` | *Optional[int]* | :heavy_minus_sign: | N/A | | `output_format` | [Optional[components.ImageGenerationServerToolOutputFormat]](../components/imagegenerationservertooloutputformat.mdx) | :heavy_minus_sign: | N/A | | `partial_images` | *Optional[int]* | :heavy_minus_sign: | N/A | | `quality` | [Optional[components.ImageGenerationServerToolQuality]](../components/imagegenerationservertoolquality.mdx) | :heavy_minus_sign: | N/A | -| `size` | [Optional[components.Size]](../components/size.mdx) | :heavy_minus_sign: | N/A | +| `size` | *Optional[str]* | :heavy_minus_sign: | N/A | | `type` | [components.ImageGenerationServerToolType](../components/imagegenerationservertooltype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/modelenum.mdx b/docs/components/modelenum.mdx deleted file mode 100644 index 815fb46..0000000 --- a/docs/components/modelenum.mdx +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "ModelEnum" ---- - -## Example Usage - -```python -from openrouter.components import ModelEnum - -# Open enum: unrecognized values are captured as UnrecognizedStr -value: ModelEnum = "gpt-image-1" -``` - - -## Values - -This is an open enum. Unrecognized values will not fail type checks. - -- `"gpt-image-1"` -- `"gpt-image-1-mini"` diff --git a/docs/components/size.mdx b/docs/components/size.mdx deleted file mode 100644 index 707abe9..0000000 --- a/docs/components/size.mdx +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Size" ---- - -## Example Usage - -```python -from openrouter.components import Size - -# Open enum: unrecognized values are captured as UnrecognizedStr -value: Size = "1024x1024" -``` - - -## Values - -This is an open enum. Unrecognized values will not fail type checks. - -- `"1024x1024"` -- `"1024x1536"` -- `"1536x1024"` -- `"auto"` diff --git a/pyproject.toml b/pyproject.toml index 31212f7..60e1642 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.15" +version = "0.11.16" 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 b953813..623fc34 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.15" +__version__: str = "0.11.16" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.15 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.16 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 3e5280d..d127e29 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1139,9 +1139,7 @@ if TYPE_CHECKING: InputFidelity, InputImageMask, InputImageMaskTypedDict, - ModelEnum, Moderation, - Size, ) from .imagegenerationservertool_openrouter import ( ImageGenerationServerToolOpenRouter, @@ -3813,7 +3811,6 @@ __all__ = [ "ModelArchitectureTypedDict", "ModelBenchmarks", "ModelBenchmarksTypedDict", - "ModelEnum", "ModelGroup", "ModelLinks", "ModelLinksTypedDict", @@ -4424,7 +4421,6 @@ __all__ = [ "ShellServerToolOpenRouterTypedDict", "ShellServerToolType", "ShellServerToolTypedDict", - "Size", "Sort", "SortTypedDict", "SourceContent", @@ -5569,9 +5565,7 @@ _dynamic_imports: dict[str, str] = { "InputFidelity": ".imagegenerationservertool", "InputImageMask": ".imagegenerationservertool", "InputImageMaskTypedDict": ".imagegenerationservertool", - "ModelEnum": ".imagegenerationservertool", "Moderation": ".imagegenerationservertool", - "Size": ".imagegenerationservertool", "ImageGenerationServerToolOpenRouter": ".imagegenerationservertool_openrouter", "ImageGenerationServerToolOpenRouterType": ".imagegenerationservertool_openrouter", "ImageGenerationServerToolOpenRouterTypedDict": ".imagegenerationservertool_openrouter", diff --git a/src/openrouter/components/imagegenerationservertool.py b/src/openrouter/components/imagegenerationservertool.py index 6e4cf9a..bdf825f 100644 --- a/src/openrouter/components/imagegenerationservertool.py +++ b/src/openrouter/components/imagegenerationservertool.py @@ -60,15 +60,6 @@ class InputImageMask(BaseModel): return m -ModelEnum = Union[ - Literal[ - "gpt-image-1", - "gpt-image-1-mini", - ], - UnrecognizedStr, -] - - Moderation = Union[ Literal[ "auto", @@ -99,17 +90,6 @@ ImageGenerationServerToolQuality = Union[ ] -Size = Union[ - Literal[ - "1024x1024", - "1024x1536", - "1536x1024", - "auto", - ], - UnrecognizedStr, -] - - ImageGenerationServerToolType = Literal["image_generation",] @@ -120,13 +100,13 @@ class ImageGenerationServerToolTypedDict(TypedDict): background: NotRequired[ImageGenerationServerToolBackground] input_fidelity: NotRequired[Nullable[InputFidelity]] input_image_mask: NotRequired[InputImageMaskTypedDict] - model: NotRequired[ModelEnum] + model: NotRequired[str] moderation: NotRequired[Moderation] output_compression: NotRequired[int] output_format: NotRequired[ImageGenerationServerToolOutputFormat] partial_images: NotRequired[int] quality: NotRequired[ImageGenerationServerToolQuality] - size: NotRequired[Size] + size: NotRequired[str] class ImageGenerationServerTool(BaseModel): @@ -140,7 +120,7 @@ class ImageGenerationServerTool(BaseModel): input_image_mask: Optional[InputImageMask] = None - model: Optional[ModelEnum] = None + model: Optional[str] = None moderation: Optional[Moderation] = None @@ -152,10 +132,10 @@ class ImageGenerationServerTool(BaseModel): quality: Optional[ImageGenerationServerToolQuality] = None - size: Optional[Size] = None + size: Optional[str] = None @model_serializer(mode="wrap") - def _serialize_model(self, handler): + def serialize_model(self, handler): optional_fields = set( [ "background", diff --git a/src/openrouter/components/responseserrorfield.py b/src/openrouter/components/responseserrorfield.py index 1c7f8a0..f38c8ed 100644 --- a/src/openrouter/components/responseserrorfield.py +++ b/src/openrouter/components/responseserrorfield.py @@ -26,6 +26,7 @@ Code = Union[ "empty_image_file", "failed_to_download_image", "image_file_not_found", + "bio_policy", ], UnrecognizedStr, ] diff --git a/uv.lock b/uv.lock index 0f343e9..5722a13 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.15" +version = "0.11.16" source = { editable = "." } dependencies = [ { name = "httpcore" }, From e62415b7ce6b5fcf16b952c5ef639b041d50758f Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 21:33:33 +0000 Subject: [PATCH 29/62] chore: update OpenAPI spec from monorepo (#421) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 138 ++++++++++++++++++++++++++++++++++++- 1 file changed, 135 insertions(+), 3 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 70f7fa3..7e11f40 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -4051,7 +4051,7 @@ components: - recraft - reka - relace - - sakana-ai + - sakana - sambanova - seed - siliconflow @@ -18544,7 +18544,7 @@ components: additionalProperties: nullable: true type: object - sakana-ai: + sakana: additionalProperties: nullable: true type: object @@ -21267,6 +21267,58 @@ components: $ref: '#/components/schemas/SubagentNestedTool' type: array type: object + SubmitGenerationFeedbackRequest: + description: Structured feedback about a specific generation + example: + category: incorrect_response + comment: The model repeated the same paragraph three times. + generation_id: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + properties: + category: + description: The category of feedback being reported + enum: + - latency + - incoherence + - incorrect_response + - formatting + - billing + - api_error + - other + example: incorrect_response + type: string + comment: + description: An optional free-text comment describing the feedback + example: The model repeated the same paragraph three times. + maxLength: 1000 + type: string + generation_id: + description: The generation to submit feedback on + example: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + minLength: 1 + type: string + required: + - generation_id + - category + type: object + SubmitGenerationFeedbackResponse: + description: Confirmation that the feedback was recorded + example: + data: + success: true + properties: + data: + properties: + success: + const: true + description: Whether the feedback was recorded + example: true + type: boolean + required: + - success + type: object + required: + - data + type: object SupportedParameters: additionalProperties: $ref: '#/components/schemas/CapabilityDescriptor' @@ -24893,7 +24945,7 @@ paths: - recraft - reka - relace - - sakana-ai + - sakana - sambanova - seed - siliconflow @@ -27438,6 +27490,86 @@ paths: summary: Get stored prompt and completion content for a generation tags: - Generations + /generation/feedback: + post: + description: >- + Submit structured feedback on a generation the authenticated user made. [Management + key](/docs/guides/overview/auth/management-api-keys) required. + operationId: submitGenerationFeedback + requestBody: + content: + application/json: + example: + category: incorrect_response + comment: The model repeated the same paragraph three times. + generation_id: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + schema: + $ref: '#/components/schemas/SubmitGenerationFeedbackRequest' + required: true + responses: + '200': + content: + application/json: + example: + data: + success: true + schema: + $ref: '#/components/schemas/SubmitGenerationFeedbackResponse' + description: Feedback recorded successfully + '400': + content: + application/json: + example: + error: + code: 400 + message: Invalid request parameters + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: Bad Request - Invalid request parameters or malformed input + '401': + content: + application/json: + example: + error: + code: 401 + message: Missing Authentication header + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '404': + content: + application/json: + example: + error: + code: 404 + message: Resource not found + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist + '429': + content: + application/json: + example: + error: + code: 429 + message: Rate limit exceeded + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: Too Many Requests - Rate limit exceeded + '500': + content: + application/json: + example: + error: + code: 500 + message: Internal Server Error + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: Submit feedback for a generation + tags: + - Generations + x-speakeasy-name-override: submitFeedback /guardrails: get: description: >- From 4a9b45c2a0e07a5fbce56b8612f98385f9ef2dfa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 21:39:01 +0000 Subject: [PATCH 30/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.17=20(#422)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 131 +++++--- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 142 +++++++- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/byokproviderslug.mdx | 2 +- docs/components/category.mdx | 27 ++ .../imagegenerationrequestoptions.mdx | 2 +- docs/components/provideroptions.mdx | 2 +- .../submitgenerationfeedbackrequest.mdx | 14 + .../submitgenerationfeedbackresponse.mdx | 12 + .../submitgenerationfeedbackresponsedata.mdx | 9 + .../videogenerationrequestoptions.mdx | 2 +- docs/operations/provider.mdx | 2 +- .../submitgenerationfeedbackglobals.mdx | 11 + .../submitgenerationfeedbackrequest.mdx | 12 + docs/sdks/generations/README.mdx | 55 +++- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 25 ++ src/openrouter/components/byokproviderslug.py | 2 +- .../components/imagegenerationrequest.py | 8 +- src/openrouter/components/provideroptions.py | 8 +- .../submitgenerationfeedbackrequest.py | 62 ++++ .../submitgenerationfeedbackresponse.py | 40 +++ .../components/videogenerationrequest.py | 8 +- src/openrouter/generations.py | 310 ++++++++++++++++++ src/openrouter/operations/__init__.py | 14 + src/openrouter/operations/listbyokkeys.py | 2 +- .../operations/submitgenerationfeedback.py | 146 +++++++++ uv.lock | 2 +- 31 files changed, 1004 insertions(+), 76 deletions(-) create mode 100644 docs/components/category.mdx create mode 100644 docs/components/submitgenerationfeedbackrequest.mdx create mode 100644 docs/components/submitgenerationfeedbackresponse.mdx create mode 100644 docs/components/submitgenerationfeedbackresponsedata.mdx create mode 100644 docs/operations/submitgenerationfeedbackglobals.mdx create mode 100644 docs/operations/submitgenerationfeedbackrequest.mdx create mode 100644 src/openrouter/components/submitgenerationfeedbackrequest.py create mode 100644 src/openrouter/components/submitgenerationfeedbackresponse.py create mode 100644 src/openrouter/operations/submitgenerationfeedback.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1ae9272..803358a 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: a4a66ca81e062a140820ff0a8797409f + docChecksum: ad7637a68c46f585f25b6a36b9dd0f64 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.16 - configChecksum: a4a1bd1b84fa14d397a7dfb0bb351efc + releaseVersion: 0.11.17 + configChecksum: e1094fdca787104fc58b99c1a21f533d repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c9801f2b-9850-4020-b390-d229911befbe - pristine_commit_hash: 71dbc8aa473f514b093d15901e5f67dece278cb7 - pristine_tree_hash: 2769400e291cb8861d2736b7b3e036f7d043614e + generation_id: efe0a4c5-68bb-420f-acd6-9382a2e84419 + pristine_commit_hash: 2c5b8d0d8b460f97ba19d673e012040cb8cceddc + pristine_tree_hash: d8087e47e225e199329a004d366ac4e933efff90 features: python: acceptHeaders: 3.0.0 @@ -702,8 +702,8 @@ trackedFiles: pristine_git_object: 151dd8398dc818ff4d26d6859d25efd202d03917 docs/components/byokproviderslug.mdx: id: 6ea70819f6d8 - last_write_checksum: sha1:5116cfa7ed1f8270dfc9d277d3cc0ee02b147c44 - pristine_git_object: 439563d0fe5440c4f0127337f39ddc403f63ae06 + last_write_checksum: sha1:195859204474448ffacfda46106c4c529cc05a4e + pristine_git_object: 619d8a0909e742416ef893c01e0093ab5cc5c686 docs/components/caching.mdx: id: edc8a0f8f37f last_write_checksum: sha1:b4e6619f389c1440555ec567fbdcddbc9976e63e @@ -712,6 +712,10 @@ trackedFiles: id: 34ac0e581d79 last_write_checksum: sha1:62ee9ccab6cec4572383cef654997ab4106d4676 pristine_git_object: ace8f22b972273bdee620a9981abcb0cc46d994e + docs/components/category.mdx: + id: c952e528e6a0 + last_write_checksum: sha1:8c57eac99923f3c4d343cd6dc3727c58d405c33c + pristine_git_object: e67ca2a02783050e89bed3f53bf59d2e8c805478 docs/components/chatassistantimages.mdx: id: ffb19be9dace last_write_checksum: sha1:cbcf9e1fb04e660786ad38a273b852cf84504f9f @@ -2082,8 +2086,8 @@ trackedFiles: pristine_git_object: 8501680bcfebabb3af52b518c01f732d18282120 docs/components/imagegenerationrequestoptions.mdx: id: 2245ece0aaf8 - last_write_checksum: sha1:ef565300c4aaaacf991f0ecabb2dade678494423 - pristine_git_object: 26f3f1ecd8f4865034e81ce1eca81552d90d70b8 + last_write_checksum: sha1:d6ca724147440eda6fe039b29ab5495824ae5c0a + pristine_git_object: b6426f4b8f4549a0e1e3e931b0cc467012c7d512 docs/components/imagegenerationrequestoutputformat.mdx: id: 380f12bf77bd last_write_checksum: sha1:afb479dc34118828e988888a8f49e7a5a50a45ab @@ -3818,8 +3822,8 @@ trackedFiles: pristine_git_object: f7cde44d7ed6638b63f3f5c3921096cd368c1b1e docs/components/provideroptions.mdx: id: 2697807524fe - last_write_checksum: sha1:e1d6db7e6b3ed82bc19a6ece557566273f9a4b93 - pristine_git_object: b15b96fc074273c0d83e59b9b69c64ce8dfb48d8 + last_write_checksum: sha1:f0ee004496e6067b61305a24191eecb3c7444dbb + pristine_git_object: c9df643ff81878c93f6d6f363f622be76442f13a docs/components/provideroverloadedresponseerrordata.mdx: id: dc500cd14889 last_write_checksum: sha1:6c1d551db4083f1d0bc429baa1ce472d2c085331 @@ -4460,6 +4464,18 @@ trackedFiles: id: 36a519fbf209 last_write_checksum: sha1:14f4bf5f550f0dfddb8bd950e000ed431a5470e9 pristine_git_object: a93cd73684c2a51b27f8a1e13a09f980a676567e + docs/components/submitgenerationfeedbackrequest.mdx: + id: fba2401919b4 + last_write_checksum: sha1:0c574d3011a3b5c9183697be0484a019188b5ec0 + pristine_git_object: 9e56152e2335fe11da9245816c8d1e97cd86948f + docs/components/submitgenerationfeedbackresponse.mdx: + id: 965ad9f0e7d8 + last_write_checksum: sha1:7451bf17e40384dd0c719af06afd429f305da84d + pristine_git_object: ba546e044aa0cacbde96b10562c4526a03cc0408 + docs/components/submitgenerationfeedbackresponsedata.mdx: + id: 3dc9b2ef8c55 + last_write_checksum: sha1:3bd23a1fe786aa76836d0990d51213c9ddd8fc36 + pristine_git_object: 2b6ccfe5787d34259f7c5c89e9852d32afd6aef4 docs/components/supportedaspectratio.mdx: id: 236a2016da06 last_write_checksum: sha1:638d1fbeb7e634fd924c4c1c92a0cc69f5291635 @@ -4926,8 +4942,8 @@ trackedFiles: pristine_git_object: 67f56887bb4758559189e3e9e6123dff9a38df81 docs/components/videogenerationrequestoptions.mdx: id: 1d67160e7e7a - last_write_checksum: sha1:8f1c4b3b0a67cce0aad25ef560ca635a929f8784 - pristine_git_object: f3d6474edb250bfaecbdb3a1fa9c930e9587a46b + last_write_checksum: sha1:5212fca896119c2cbede7f2efbc0855d007e68d1 + pristine_git_object: c1d338ae75a61869d4e8b5110b2a85d5e624da1e docs/components/videogenerationrequestprovider.mdx: id: d6424dd5de9d last_write_checksum: sha1:72aa46a3335220b579db56574ea179d150dbe2b6 @@ -6178,8 +6194,8 @@ trackedFiles: pristine_git_object: 0f0b54e43577a8a835cd971f82e48c3921e3d88e docs/operations/provider.mdx: id: c75b3bbeeaa0 - last_write_checksum: sha1:c55d7af5c40483430e2debde39643c564ea19838 - pristine_git_object: 1b6b620243fb2472e1bfe2acc7bbb646b8a82a79 + last_write_checksum: sha1:050746e3c160daa03b108e45aed42aadf82d641f + pristine_git_object: 139a0786eebb659c9b410f430efac3115759d5ae docs/operations/queryanalyticsdata1.mdx: id: 0e41beea77d0 last_write_checksum: sha1:f9a349b4fee07f786180e94b45f92002bfae0e56 @@ -6244,6 +6260,14 @@ trackedFiles: id: b3291e6c44b9 last_write_checksum: sha1:2594ecd2302b9515e5997f4fbaaebba4a9a0615c pristine_git_object: af1d9e961714b356ae1a7cd86d64ff636215bae8 + docs/operations/submitgenerationfeedbackglobals.mdx: + id: cdef4c621cb3 + last_write_checksum: sha1:dc4e93ccccf8e97b25a5a64428a8bf8c679037bd + pristine_git_object: bbd731b6fa9990b637d7dad9fd5614619c83d0d9 + docs/operations/submitgenerationfeedbackrequest.mdx: + id: f159f51b36f7 + last_write_checksum: sha1:1d16f944195d66950cba4bfc2f96255286cf33c0 + pristine_git_object: 18f5cc3e2fe30014037f8f68d5513a4981d513b9 docs/operations/tasktype.mdx: id: d3da8106d2d1 last_write_checksum: sha1:06aede3448490e1fb77b5c1b758238a11ce1dceb @@ -6418,8 +6442,8 @@ trackedFiles: pristine_git_object: 8ed39ab511e8430389a8cb92bed10b088a586006 docs/sdks/generations/README.mdx: id: a754fecc8514 - last_write_checksum: sha1:e4276fe2f85be0fbafaf573fe58d17b7236d0652 - pristine_git_object: b29ea120367f5944c6a71e31f6c3d5e07ab4b798 + last_write_checksum: sha1:b5f8035c676b5eb050472ed9697b64718aed8f17 + pristine_git_object: f262b34982a18293f5ae22bfbbf385010bfcdc9c docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa last_write_checksum: sha1:b6543c22a38aca53d7bfbc8d41ed482965fc3b3c @@ -6482,8 +6506,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:061a0de3204cab06837642e4c0785b6b93705db3 - pristine_git_object: 60e16427643f806b9ab68941ac30f77e162c0c64 + last_write_checksum: sha1:8564217ec020db72f0e9fdbc4cc2a9741aef8da8 + pristine_git_object: 1f53995948f1621cbe09a49eab44c5b08e538977 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6510,8 +6534,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:24cd6e9d1cf6e73b5cdef8748fa0124728b83567 - pristine_git_object: 623fc3453b008b588e0be363ab8c42525c104cfb + last_write_checksum: sha1:24a6775af4e431ffa67c67f909015339440e6b0a + pristine_git_object: d07f58993aa7027d3e22432eeec9c887d991b7ea src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6550,8 +6574,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:010555a6206e0d8eaf1215bab3ad9a3a86db071f - pristine_git_object: d127e29e5b6be993e21770cb1d968397fda34e8f + last_write_checksum: sha1:f4f8b839a539a8885447d5bbdadcc985553d65c8 + pristine_git_object: 25795f206171fcfa804e2e44c033713d99f52c21 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6878,8 +6902,8 @@ trackedFiles: pristine_git_object: 47ef267b5e0f7b615b0cd66018728e3f47440a66 src/openrouter/components/byokproviderslug.py: id: 6738a8516caf - last_write_checksum: sha1:2b105bacb46fd7150af7f079241fab2ba6700322 - pristine_git_object: 38050fde0204f069cb2568fafc91338a7051c92f + last_write_checksum: sha1:a5a6e1a2e7709f0afb9d97347c5d76457fea7d3e + pristine_git_object: 044751122a1397e7624e0e3abd867286dc96c6fc src/openrouter/components/capabilitydescriptor.py: id: 368790a86f10 last_write_checksum: sha1:a167551924ee82b4b5876a0ab698a45fe8c87a95 @@ -7486,8 +7510,8 @@ trackedFiles: pristine_git_object: 6b9a8990973466285f9b49b366bbc5fc1ae42e41 src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 - last_write_checksum: sha1:179a0b7ea9363fa826749e8bb6fb21074433e43e - pristine_git_object: fbb59ab7c3ea49aa774b4fc917eb9ed9d4484d32 + last_write_checksum: sha1:8a1e549056b8ef856f89c75182b49e3386c410fd + pristine_git_object: d1937b9c35752d03b04098295ea5dadb1804dafb src/openrouter/components/imagegenerationresponse.py: id: 53354cd0cbfc last_write_checksum: sha1:53f1cde7b8bfe4f9e786a76f6e57b0a1f76aced2 @@ -8146,8 +8170,8 @@ trackedFiles: pristine_git_object: 009c1401a29123f18887b48c03f9c2a8b11ca2b5 src/openrouter/components/provideroptions.py: id: 73dde6c8f359 - last_write_checksum: sha1:ddde99f94118559796f316a1f05de70060f3bee1 - pristine_git_object: d84b93dea4982ead0bd8a069cb0801a8e02447c0 + last_write_checksum: sha1:72fe38a2faab604e52a16eec0b5d1273b3eda64d + pristine_git_object: 9ab53163a6884a4fbf41c87391903f013eead544 src/openrouter/components/provideroverloadedresponseerrordata.py: id: 5b693682570e last_write_checksum: sha1:1ebc4527736f1e174ab37c84bea8a169fda9f8b8 @@ -8484,6 +8508,14 @@ trackedFiles: id: a8425c790cb6 last_write_checksum: sha1:f434a1ff30f069c379b1809edd62b0435998156a pristine_git_object: eb9f276769106934801d88ce9d2c5c5c67fe1bc2 + src/openrouter/components/submitgenerationfeedbackrequest.py: + id: ae68ea802a9c + last_write_checksum: sha1:3d0fb9415d218dfbe5b978791c95bc0f28abb131 + pristine_git_object: c73cccc81298593ce3f4acbf2b25f02956528d8f + src/openrouter/components/submitgenerationfeedbackresponse.py: + id: 1e1463bcfd03 + last_write_checksum: sha1:d7ba55af6eca473c91a3cd09a73068bb8a75ad22 + pristine_git_object: 139b0fc5a600fee17eafff1d36df72754c90b2fe src/openrouter/components/taskclassificationitem.py: id: 86d4bab5ebf3 last_write_checksum: sha1:16176fda0ccd16b0be59bb5c4b74db78eae02f36 @@ -8614,8 +8646,8 @@ trackedFiles: pristine_git_object: 572d04f457607099ae7e041922de146de10e2eae src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c - last_write_checksum: sha1:bb81c3a4684e20898148e1415980457732da28d2 - pristine_git_object: 1f383a973b0d3f20605db372c24c9e9204c95d85 + last_write_checksum: sha1:ded4141016409c0ee6bdde4061c704f8b006c84c + pristine_git_object: d96af0892419695a7fe096e045490a9a4ff13b8f src/openrouter/components/videogenerationresponse.py: id: 541f1321b072 last_write_checksum: sha1:18c3aa7845f63a9614286b1a27b6098eae1c4951 @@ -8826,8 +8858,8 @@ trackedFiles: pristine_git_object: 1c20e7d6a4837053dac23f3d7985ef6910217589 src/openrouter/generations.py: id: 70e1c21042bc - last_write_checksum: sha1:c513500d0aecefad46e4e791094672dd8a31e6f2 - pristine_git_object: cecdd21a8e07352f8fa8d44e9018e01dfd918a99 + last_write_checksum: sha1:00b190db603c57571f77ccfe5d5612a3f42c62a0 + pristine_git_object: f6dbf5440466ba6b1d92442cad1b91e2b3587c52 src/openrouter/guardrails.py: id: 705839f34e66 last_write_checksum: sha1:e525be9e5746b7b1cb6d170ac74cce37f010004a @@ -8866,8 +8898,8 @@ trackedFiles: pristine_git_object: a1dea9b45650cc42a6f60447c032fa46b102839a src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:46a3dfac25ac1c3d774e37ec8df54f9ba9851e46 - pristine_git_object: ab9fa9e4793e73671cc752005123a482b51b506f + last_write_checksum: sha1:23cba14efcf42e3a94779c6c259362a6f8a97deb + pristine_git_object: 3ee6fd4deecd7fcc382a5256db8e43c6f7e719ca src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -9082,8 +9114,8 @@ trackedFiles: pristine_git_object: cc90375e9aac23107e57e18e6adecc38f544e185 src/openrouter/operations/listbyokkeys.py: id: b6dd42b3e05f - last_write_checksum: sha1:ca0276ecb273e8b62e43937369d7b059ad73d9f1 - pristine_git_object: 2ec07724128bf2fb6152e84694f31b4234279e82 + last_write_checksum: sha1:7f5d32c8e8d9dc55fe7c5e8bf8fd71ed6406e10a + pristine_git_object: c3080ca256a625e437d85da39c703d0c3b495049 src/openrouter/operations/listembeddingsmodels.py: id: bf749a1f23d6 last_write_checksum: sha1:19ed80a098e6e1b43bedfcccb11b4c8d8794541c @@ -9188,6 +9220,10 @@ trackedFiles: id: d9fee71bb577 last_write_checksum: sha1:0cba4011b8e305270ac30f88cb7ab59b6aefe619 pristine_git_object: b065e38c8d449348c4d133004653607e4194da6e + src/openrouter/operations/submitgenerationfeedback.py: + id: a1f4458f5e75 + last_write_checksum: sha1:634750972ca2bf7d76b1530f19f0d5401a44c3d8 + pristine_git_object: 878e3ec2224f81c003c35efa326d2ba53ee595c0 src/openrouter/operations/updatebyokkey.py: id: 486f4ea60120 last_write_checksum: sha1:a170382e38c66128bddbe8ea18c034d1350910da @@ -10823,5 +10859,22 @@ examples: application/json: {"error": {"code": 404, "message": "Resource not found"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + submitGenerationFeedback: + speakeasy-default-submit-generation-feedback: + requestBody: + application/json: {"category": "incorrect_response", "generation_id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG"} + responses: + "200": + application/json: {"data": {"success": true}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.tools[].union(image_generation)` **Changed** (Breaking ⚠️)\n * `response` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_responses()`: \n * `request.tools[].union(image_generation)` **Changed** (Breaking ⚠️)\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.tts.create_speech()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.stt.create_transcription()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.byok.list()`: \n * `request.provider` **Changed** (Breaking ⚠️)\n * `response.data[].provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.create()`: \n * `request.provider` **Changed** (Breaking ⚠️)\n * `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.get()`: `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.update()`: `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.images.generate()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.video_generation.generate()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.generations.submit_feedback()`: **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 76543dd..d85800f 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.16 + version: 0.11.17 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 198ee99..1a0c9ef 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -4047,7 +4047,7 @@ components: - recraft - reka - relace - - sakana-ai + - sakana - sambanova - seed - siliconflow @@ -18440,7 +18440,7 @@ components: additionalProperties: nullable: true type: object - sakana-ai: + sakana: additionalProperties: nullable: true type: object @@ -21121,6 +21121,59 @@ components: $ref: '#/components/schemas/SubagentNestedTool' type: array type: object + SubmitGenerationFeedbackRequest: + description: Structured feedback about a specific generation + example: + category: incorrect_response + comment: The model repeated the same paragraph three times. + generation_id: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + properties: + category: + description: The category of feedback being reported + enum: + - latency + - incoherence + - incorrect_response + - formatting + - billing + - api_error + - other + example: incorrect_response + type: string + x-speakeasy-unknown-values: allow + comment: + description: An optional free-text comment describing the feedback + example: The model repeated the same paragraph three times. + maxLength: 1000 + type: string + generation_id: + description: The generation to submit feedback on + example: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + minLength: 1 + type: string + required: + - generation_id + - category + type: object + SubmitGenerationFeedbackResponse: + description: Confirmation that the feedback was recorded + example: + data: + success: true + properties: + data: + properties: + success: + const: true + description: Whether the feedback was recorded + example: true + type: boolean + required: + - success + type: object + required: + - data + type: object SupportedParameters: additionalProperties: $ref: '#/components/schemas/CapabilityDescriptor' @@ -24710,7 +24763,7 @@ paths: - recraft - reka - relace - - sakana-ai + - sakana - sambanova - seed - siliconflow @@ -27262,6 +27315,89 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /generation/feedback: + post: + description: >- + Submit structured feedback on a generation the authenticated user made. [Management key](/docs/guides/overview/auth/management-api-keys) required. + operationId: submitGenerationFeedback + requestBody: + content: + application/json: + example: + category: incorrect_response + comment: The model repeated the same paragraph three times. + generation_id: gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG + schema: + $ref: '#/components/schemas/SubmitGenerationFeedbackRequest' + required: true + responses: + '200': + content: + application/json: + example: + data: + success: true + schema: + $ref: '#/components/schemas/SubmitGenerationFeedbackResponse' + description: Feedback recorded successfully + '400': + content: + application/json: + example: + error: + code: 400 + message: Invalid request parameters + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: Bad Request - Invalid request parameters or malformed input + '401': + content: + application/json: + example: + error: + code: 401 + message: Missing Authentication header + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: Unauthorized - Authentication required or invalid credentials + '404': + content: + application/json: + example: + error: + code: 404 + message: Resource not found + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: Not Found - Resource does not exist + '429': + content: + application/json: + example: + error: + code: 429 + message: Rate limit exceeded + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: Too Many Requests - Rate limit exceeded + '500': + content: + application/json: + example: + error: + code: 500 + message: Internal Server Error + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: Internal Server Error - Unexpected server error + summary: Submit feedback for a generation + tags: + - Generations + x-speakeasy-name-override: submitFeedback + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /guardrails: get: description: >- diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index af61311..4af3fa7 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:daca20db09d6cfb4b50c5e6bf7d8f5cbadae39021bd5cb9c856d71b4e6f9c192 - sourceBlobDigest: sha256:0834507d142ac7906f4ca76b874a2b49bd5709b782a420377f3cf4349552a445 + sourceRevisionDigest: sha256:99649ad73bd44656a11c0f47bf5b52ff056911ce5543fdd487b1c7d835d4d01e + sourceBlobDigest: sha256:fb03e6ac1679e81970afc16a019748cc195bb2881a09f0e5dc0ae18934621701 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:daca20db09d6cfb4b50c5e6bf7d8f5cbadae39021bd5cb9c856d71b4e6f9c192 - sourceBlobDigest: sha256:0834507d142ac7906f4ca76b874a2b49bd5709b782a420377f3cf4349552a445 + sourceRevisionDigest: sha256:99649ad73bd44656a11c0f47bf5b52ff056911ce5543fdd487b1c7d835d4d01e + sourceBlobDigest: sha256:fb03e6ac1679e81970afc16a019748cc195bb2881a09f0e5dc0ae18934621701 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:d7c4a0cd51e67e5c63e2540958b5a5df3406fbbe723c58338a51e48feb9ddae2 + codeSamplesRevisionDigest: sha256:a6459b61a352d9d8512b16c634606461a35e4275e373904dec9cd85e245db64b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 0076cf6..bd0faa7 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -268,4 +268,14 @@ Based on: ### Generated - [python v0.11.16] . ### Releases -- [PyPI v0.11.16] https://pypi.org/project/openrouter/0.11.16 - . \ No newline at end of file +- [PyPI v0.11.16] https://pypi.org/project/openrouter/0.11.16 - . + +## 2026-07-09 21:34:56 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.17] . +### Releases +- [PyPI v0.11.17] https://pypi.org/project/openrouter/0.11.17 - . \ No newline at end of file diff --git a/docs/components/byokproviderslug.mdx b/docs/components/byokproviderslug.mdx index 439563d..619d8a0 100644 --- a/docs/components/byokproviderslug.mdx +++ b/docs/components/byokproviderslug.mdx @@ -89,7 +89,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"recraft"` - `"reka"` - `"relace"` -- `"sakana-ai"` +- `"sakana"` - `"sambanova"` - `"seed"` - `"siliconflow"` diff --git a/docs/components/category.mdx b/docs/components/category.mdx new file mode 100644 index 0000000..e67ca2a --- /dev/null +++ b/docs/components/category.mdx @@ -0,0 +1,27 @@ +--- +title: "Category" +--- + +The category of feedback being reported + +## Example Usage + +```python +from openrouter.components import Category + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: Category = "latency" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"latency"` +- `"incoherence"` +- `"incorrect_response"` +- `"formatting"` +- `"billing"` +- `"api_error"` +- `"other"` diff --git a/docs/components/imagegenerationrequestoptions.mdx b/docs/components/imagegenerationrequestoptions.mdx index 26f3f1e..b6426f4 100644 --- a/docs/components/imagegenerationrequestoptions.mdx +++ b/docs/components/imagegenerationrequestoptions.mdx @@ -106,7 +106,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | -| `sakana_ai` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `seed` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/provideroptions.mdx b/docs/components/provideroptions.mdx index b15b96f..c9df643 100644 --- a/docs/components/provideroptions.mdx +++ b/docs/components/provideroptions.mdx @@ -106,7 +106,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | -| `sakana_ai` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `seed` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/submitgenerationfeedbackrequest.mdx b/docs/components/submitgenerationfeedbackrequest.mdx new file mode 100644 index 0000000..9e56152 --- /dev/null +++ b/docs/components/submitgenerationfeedbackrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "SubmitGenerationFeedbackRequest" +--- + +Structured feedback about a specific generation + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `category` | [components.Category](../components/category.mdx) | :heavy_check_mark: | The category of feedback being reported | incorrect_response | +| `comment` | *Optional[str]* | :heavy_minus_sign: | An optional free-text comment describing the feedback | The model repeated the same paragraph three times. | +| `generation_id` | *str* | :heavy_check_mark: | The generation to submit feedback on | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | \ No newline at end of file diff --git a/docs/components/submitgenerationfeedbackresponse.mdx b/docs/components/submitgenerationfeedbackresponse.mdx new file mode 100644 index 0000000..ba546e0 --- /dev/null +++ b/docs/components/submitgenerationfeedbackresponse.mdx @@ -0,0 +1,12 @@ +--- +title: "SubmitGenerationFeedbackResponse" +--- + +Confirmation that the feedback was recorded + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `data` | [components.SubmitGenerationFeedbackResponseData](../components/submitgenerationfeedbackresponsedata.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/submitgenerationfeedbackresponsedata.mdx b/docs/components/submitgenerationfeedbackresponsedata.mdx new file mode 100644 index 0000000..2b6ccfe --- /dev/null +++ b/docs/components/submitgenerationfeedbackresponsedata.mdx @@ -0,0 +1,9 @@ +--- +title: "SubmitGenerationFeedbackResponseData" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `success` | *Literal[True]* | :heavy_check_mark: | Whether the feedback was recorded | true | \ No newline at end of file diff --git a/docs/components/videogenerationrequestoptions.mdx b/docs/components/videogenerationrequestoptions.mdx index f3d6474..c1d338a 100644 --- a/docs/components/videogenerationrequestoptions.mdx +++ b/docs/components/videogenerationrequestoptions.mdx @@ -106,7 +106,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | -| `sakana_ai` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `seed` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/operations/provider.mdx b/docs/operations/provider.mdx index 1b6b620..139a078 100644 --- a/docs/operations/provider.mdx +++ b/docs/operations/provider.mdx @@ -89,7 +89,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"recraft"` - `"reka"` - `"relace"` -- `"sakana-ai"` +- `"sakana"` - `"sambanova"` - `"seed"` - `"siliconflow"` diff --git a/docs/operations/submitgenerationfeedbackglobals.mdx b/docs/operations/submitgenerationfeedbackglobals.mdx new file mode 100644 index 0000000..bbd731b --- /dev/null +++ b/docs/operations/submitgenerationfeedbackglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "SubmitGenerationFeedbackGlobals" +--- + +## 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/submitgenerationfeedbackrequest.mdx b/docs/operations/submitgenerationfeedbackrequest.mdx new file mode 100644 index 0000000..18f5cc3 --- /dev/null +++ b/docs/operations/submitgenerationfeedbackrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "SubmitGenerationFeedbackRequest" +--- + +## 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.
| | +| `submit_generation_feedback_request` | [components.SubmitGenerationFeedbackRequest](../components/submitgenerationfeedbackrequest.mdx) | :heavy_check_mark: | N/A | \{
"category": "incorrect_response",
"comment": "The model repeated the same paragraph three times.",
"generation_id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG"
} | \ No newline at end of file diff --git a/docs/sdks/generations/README.mdx b/docs/sdks/generations/README.mdx index b29ea12..f262b34 100644 --- a/docs/sdks/generations/README.mdx +++ b/docs/sdks/generations/README.mdx @@ -11,6 +11,7 @@ Generation history endpoints * [get_generation](#get_generation) - Get request & usage metadata for a generation * [list_generation_content](#list_generation_content) - Get stored prompt and completion content for a generation +* [submit_feedback](#submit_feedback) - Submit feedback for a generation ## get_generation @@ -116,4 +117,56 @@ with OpenRouter( | errors.BadGatewayResponseError | 502 | application/json | | errors.EdgeNetworkTimeoutResponseError | 524 | application/json | | errors.ProviderOverloadedResponseError | 529 | application/json | -| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## submit_feedback + +Submit structured feedback on a generation the authenticated user made. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.generations.submit_feedback(category="incorrect_response", generation_id="gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", comment="The model repeated the same paragraph three times.") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `category` | [components.Category](../../components/category.mdx) | :heavy_check_mark: | The category of feedback being reported | incorrect_response | +| `generation_id` | *str* | :heavy_check_mark: | The generation to submit feedback on | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG | +| `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.
| | +| `comment` | *Optional[str]* | :heavy_minus_sign: | An optional free-text comment describing the feedback | The model repeated the same paragraph three times. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[components.SubmitGenerationFeedbackResponse](../../components/submitgenerationfeedbackresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 60e1642..1f53995 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.16" +version = "0.11.17" 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 623fc34..d07f589 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.16" +__version__: str = "0.11.17" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.16 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.17 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 d127e29..25795f2 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2488,6 +2488,17 @@ if TYPE_CHECKING: SubagentServerToolConfig, SubagentServerToolConfigTypedDict, ) + from .submitgenerationfeedbackrequest import ( + Category, + SubmitGenerationFeedbackRequest, + SubmitGenerationFeedbackRequestTypedDict, + ) + from .submitgenerationfeedbackresponse import ( + SubmitGenerationFeedbackResponse, + SubmitGenerationFeedbackResponseData, + SubmitGenerationFeedbackResponseDataTypedDict, + SubmitGenerationFeedbackResponseTypedDict, + ) from .taskclassificationitem import ( TaskClassificationItem, TaskClassificationItemTypedDict, @@ -2995,6 +3006,7 @@ __all__ = [ "CachingTypedDict", "CapabilityDescriptor", "CapabilityDescriptorTypedDict", + "Category", "ChatAssistantImages", "ChatAssistantImagesImageURL", "ChatAssistantImagesImageURLTypedDict", @@ -4486,6 +4498,12 @@ __all__ = [ "SubagentServerToolOpenRouter", "SubagentServerToolOpenRouterType", "SubagentServerToolOpenRouterTypedDict", + "SubmitGenerationFeedbackRequest", + "SubmitGenerationFeedbackRequestTypedDict", + "SubmitGenerationFeedbackResponse", + "SubmitGenerationFeedbackResponseData", + "SubmitGenerationFeedbackResponseDataTypedDict", + "SubmitGenerationFeedbackResponseTypedDict", "SupportedAspectRatio", "SupportedFrameImage", "SupportedResolution", @@ -6605,6 +6623,13 @@ _dynamic_imports: dict[str, str] = { "SubagentServerToolOpenRouterTypedDict": ".subagentservertool_openrouter", "SubagentServerToolConfig": ".subagentservertoolconfig", "SubagentServerToolConfigTypedDict": ".subagentservertoolconfig", + "Category": ".submitgenerationfeedbackrequest", + "SubmitGenerationFeedbackRequest": ".submitgenerationfeedbackrequest", + "SubmitGenerationFeedbackRequestTypedDict": ".submitgenerationfeedbackrequest", + "SubmitGenerationFeedbackResponse": ".submitgenerationfeedbackresponse", + "SubmitGenerationFeedbackResponseData": ".submitgenerationfeedbackresponse", + "SubmitGenerationFeedbackResponseDataTypedDict": ".submitgenerationfeedbackresponse", + "SubmitGenerationFeedbackResponseTypedDict": ".submitgenerationfeedbackresponse", "TaskClassificationItem": ".taskclassificationitem", "TaskClassificationItemTypedDict": ".taskclassificationitem", "TaskClassificationMacroCategory": ".taskclassificationmacrocategory", diff --git a/src/openrouter/components/byokproviderslug.py b/src/openrouter/components/byokproviderslug.py index 38050fd..0447511 100644 --- a/src/openrouter/components/byokproviderslug.py +++ b/src/openrouter/components/byokproviderslug.py @@ -78,7 +78,7 @@ BYOKProviderSlug = Union[ "recraft", "reka", "relace", - "sakana-ai", + "sakana", "sambanova", "seed", "siliconflow", diff --git a/src/openrouter/components/imagegenerationrequest.py b/src/openrouter/components/imagegenerationrequest.py index fbb59ab..d1937b9 100644 --- a/src/openrouter/components/imagegenerationrequest.py +++ b/src/openrouter/components/imagegenerationrequest.py @@ -162,7 +162,7 @@ class ImageGenerationRequestOptionsTypedDict(TypedDict): reka: NotRequired[Dict[str, Nullable[Any]]] relace: NotRequired[Dict[str, Nullable[Any]]] replicate: NotRequired[Dict[str, Nullable[Any]]] - sakana_ai: NotRequired[Dict[str, Nullable[Any]]] + sakana: NotRequired[Dict[str, Nullable[Any]]] sambanova: NotRequired[Dict[str, Nullable[Any]]] sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] seed: NotRequired[Dict[str, Nullable[Any]]] @@ -422,9 +422,7 @@ class ImageGenerationRequestOptions(BaseModel): replicate: Optional[Dict[str, Nullable[Any]]] = None - sakana_ai: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sakana-ai") - ] = None + sakana: Optional[Dict[str, Nullable[Any]]] = None sambanova: Optional[Dict[str, Nullable[Any]]] = None @@ -579,7 +577,7 @@ class ImageGenerationRequestOptions(BaseModel): "reka", "relace", "replicate", - "sakana-ai", + "sakana", "sambanova", "sambanova-cloaked", "seed", diff --git a/src/openrouter/components/provideroptions.py b/src/openrouter/components/provideroptions.py index d84b93d..9ab5316 100644 --- a/src/openrouter/components/provideroptions.py +++ b/src/openrouter/components/provideroptions.py @@ -108,7 +108,7 @@ class ProviderOptionsTypedDict(TypedDict): reka: NotRequired[Dict[str, Nullable[Any]]] relace: NotRequired[Dict[str, Nullable[Any]]] replicate: NotRequired[Dict[str, Nullable[Any]]] - sakana_ai: NotRequired[Dict[str, Nullable[Any]]] + sakana: NotRequired[Dict[str, Nullable[Any]]] sambanova: NotRequired[Dict[str, Nullable[Any]]] sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] seed: NotRequired[Dict[str, Nullable[Any]]] @@ -368,9 +368,7 @@ class ProviderOptions(BaseModel): replicate: Optional[Dict[str, Nullable[Any]]] = None - sakana_ai: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sakana-ai") - ] = None + sakana: Optional[Dict[str, Nullable[Any]]] = None sambanova: Optional[Dict[str, Nullable[Any]]] = None @@ -525,7 +523,7 @@ class ProviderOptions(BaseModel): "reka", "relace", "replicate", - "sakana-ai", + "sakana", "sambanova", "sambanova-cloaked", "seed", diff --git a/src/openrouter/components/submitgenerationfeedbackrequest.py b/src/openrouter/components/submitgenerationfeedbackrequest.py new file mode 100644 index 0000000..c73cccc --- /dev/null +++ b/src/openrouter/components/submitgenerationfeedbackrequest.py @@ -0,0 +1,62 @@ +"""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 + + +Category = Union[ + Literal[ + "latency", + "incoherence", + "incorrect_response", + "formatting", + "billing", + "api_error", + "other", + ], + UnrecognizedStr, +] +r"""The category of feedback being reported""" + + +class SubmitGenerationFeedbackRequestTypedDict(TypedDict): + r"""Structured feedback about a specific generation""" + + category: Category + r"""The category of feedback being reported""" + generation_id: str + r"""The generation to submit feedback on""" + comment: NotRequired[str] + r"""An optional free-text comment describing the feedback""" + + +class SubmitGenerationFeedbackRequest(BaseModel): + r"""Structured feedback about a specific generation""" + + category: Category + r"""The category of feedback being reported""" + + generation_id: str + r"""The generation to submit feedback on""" + + comment: Optional[str] = None + r"""An optional free-text comment describing the feedback""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["comment"]) + 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/submitgenerationfeedbackresponse.py b/src/openrouter/components/submitgenerationfeedbackresponse.py new file mode 100644 index 0000000..139b0fc --- /dev/null +++ b/src/openrouter/components/submitgenerationfeedbackresponse.py @@ -0,0 +1,40 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class SubmitGenerationFeedbackResponseDataTypedDict(TypedDict): + success: Literal[True] + r"""Whether the feedback was recorded""" + + +class SubmitGenerationFeedbackResponseData(BaseModel): + SUCCESS: Annotated[ + Annotated[Literal[True], AfterValidator(validate_const(True))], + pydantic.Field(alias="success"), + ] = True + r"""Whether the feedback was recorded""" + + +class SubmitGenerationFeedbackResponseTypedDict(TypedDict): + r"""Confirmation that the feedback was recorded""" + + data: SubmitGenerationFeedbackResponseDataTypedDict + + +class SubmitGenerationFeedbackResponse(BaseModel): + r"""Confirmation that the feedback was recorded""" + + data: SubmitGenerationFeedbackResponseData + + +try: + SubmitGenerationFeedbackResponseData.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/videogenerationrequest.py b/src/openrouter/components/videogenerationrequest.py index 1f383a9..d96af08 100644 --- a/src/openrouter/components/videogenerationrequest.py +++ b/src/openrouter/components/videogenerationrequest.py @@ -127,7 +127,7 @@ class VideoGenerationRequestOptionsTypedDict(TypedDict): reka: NotRequired[Dict[str, Nullable[Any]]] relace: NotRequired[Dict[str, Nullable[Any]]] replicate: NotRequired[Dict[str, Nullable[Any]]] - sakana_ai: NotRequired[Dict[str, Nullable[Any]]] + sakana: NotRequired[Dict[str, Nullable[Any]]] sambanova: NotRequired[Dict[str, Nullable[Any]]] sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] seed: NotRequired[Dict[str, Nullable[Any]]] @@ -387,9 +387,7 @@ class VideoGenerationRequestOptions(BaseModel): replicate: Optional[Dict[str, Nullable[Any]]] = None - sakana_ai: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sakana-ai") - ] = None + sakana: Optional[Dict[str, Nullable[Any]]] = None sambanova: Optional[Dict[str, Nullable[Any]]] = None @@ -544,7 +542,7 @@ class VideoGenerationRequestOptions(BaseModel): "reka", "relace", "replicate", - "sakana-ai", + "sakana", "sambanova", "sambanova-cloaked", "seed", diff --git a/src/openrouter/generations.py b/src/openrouter/generations.py index cecdd21..f6dbf54 100644 --- a/src/openrouter/generations.py +++ b/src/openrouter/generations.py @@ -619,3 +619,313 @@ class Generations(BaseSDK): ) raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def submit_feedback( + self, + *, + category: components.Category, + generation_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + comment: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SubmitGenerationFeedbackResponse: + r"""Submit feedback for a generation + + Submit structured feedback on a generation the authenticated user made. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param category: The category of feedback being reported + :param generation_id: The generation to submit feedback on + :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 comment: An optional free-text comment describing the feedback + :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.SubmitGenerationFeedbackRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + submit_generation_feedback_request=components.SubmitGenerationFeedbackRequest( + category=category, + comment=comment, + generation_id=generation_id, + ), + ) + + req = self._build_request( + method="POST", + path="/generation/feedback", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + 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.SubmitGenerationFeedbackGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.submit_generation_feedback_request, + False, + False, + "json", + components.SubmitGenerationFeedbackRequest, + ), + 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="submitGenerationFeedback", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Generations"], + 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.SubmitGenerationFeedbackResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def submit_feedback_async( + self, + *, + category: components.Category, + generation_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + comment: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.SubmitGenerationFeedbackResponse: + r"""Submit feedback for a generation + + Submit structured feedback on a generation the authenticated user made. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param category: The category of feedback being reported + :param generation_id: The generation to submit feedback on + :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 comment: An optional free-text comment describing the feedback + :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.SubmitGenerationFeedbackRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + submit_generation_feedback_request=components.SubmitGenerationFeedbackRequest( + category=category, + comment=comment, + generation_id=generation_id, + ), + ) + + req = self._build_request_async( + method="POST", + path="/generation/feedback", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + 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.SubmitGenerationFeedbackGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.submit_generation_feedback_request, + False, + False, + "json", + components.SubmitGenerationFeedbackRequest, + ), + 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="submitGenerationFeedback", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Generations"], + 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.SubmitGenerationFeedbackResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res + ) + raise errors.TooManyRequestsResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index ab9fa9e..3ee6fd4 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -686,6 +686,12 @@ if TYPE_CHECKING: SendChatCompletionRequestResponse, SendChatCompletionRequestResponseTypedDict, ) + from .submitgenerationfeedback import ( + SubmitGenerationFeedbackGlobals, + SubmitGenerationFeedbackGlobalsTypedDict, + SubmitGenerationFeedbackRequest, + SubmitGenerationFeedbackRequestTypedDict, + ) from .updatebyokkey import ( UpdateBYOKKeyGlobals, UpdateBYOKKeyGlobalsTypedDict, @@ -1248,6 +1254,10 @@ __all__ = [ "SendChatCompletionRequestResponseTypedDict", "Source", "Subcategory", + "SubmitGenerationFeedbackGlobals", + "SubmitGenerationFeedbackGlobalsTypedDict", + "SubmitGenerationFeedbackRequest", + "SubmitGenerationFeedbackRequestTypedDict", "TaskType", "TimeRange", "TimeRangeTypedDict", @@ -1825,6 +1835,10 @@ _dynamic_imports: dict[str, str] = { "SendChatCompletionRequestRequestTypedDict": ".sendchatcompletionrequest", "SendChatCompletionRequestResponse": ".sendchatcompletionrequest", "SendChatCompletionRequestResponseTypedDict": ".sendchatcompletionrequest", + "SubmitGenerationFeedbackGlobals": ".submitgenerationfeedback", + "SubmitGenerationFeedbackGlobalsTypedDict": ".submitgenerationfeedback", + "SubmitGenerationFeedbackRequest": ".submitgenerationfeedback", + "SubmitGenerationFeedbackRequestTypedDict": ".submitgenerationfeedback", "UpdateBYOKKeyGlobals": ".updatebyokkey", "UpdateBYOKKeyGlobalsTypedDict": ".updatebyokkey", "UpdateBYOKKeyRequest": ".updatebyokkey", diff --git a/src/openrouter/operations/listbyokkeys.py b/src/openrouter/operations/listbyokkeys.py index 2ec0772..c3080ca 100644 --- a/src/openrouter/operations/listbyokkeys.py +++ b/src/openrouter/operations/listbyokkeys.py @@ -149,7 +149,7 @@ Provider = Union[ "recraft", "reka", "relace", - "sakana-ai", + "sakana", "sambanova", "seed", "siliconflow", diff --git a/src/openrouter/operations/submitgenerationfeedback.py b/src/openrouter/operations/submitgenerationfeedback.py new file mode 100644 index 0000000..878e3ec --- /dev/null +++ b/src/openrouter/operations/submitgenerationfeedback.py @@ -0,0 +1,146 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + submitgenerationfeedbackrequest as components_submitgenerationfeedbackrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, RequestMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class SubmitGenerationFeedbackGlobalsTypedDict(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 SubmitGenerationFeedbackGlobals(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 SubmitGenerationFeedbackRequestTypedDict(TypedDict): + submit_generation_feedback_request: components_submitgenerationfeedbackrequest.SubmitGenerationFeedbackRequestTypedDict + 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 SubmitGenerationFeedbackRequest(BaseModel): + submit_generation_feedback_request: Annotated[ + components_submitgenerationfeedbackrequest.SubmitGenerationFeedbackRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + 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 diff --git a/uv.lock b/uv.lock index 5722a13..852a1d8 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.16" +version = "0.11.17" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 0ade477fccf016ce2879f9bf922254a2b78667b2 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 01:17:33 +0000 Subject: [PATCH 31/62] chore: update OpenAPI spec from monorepo (#423) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 97 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 7e11f40..cf5725c 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -127,6 +127,102 @@ components: required: - data type: object + AdditionalToolsItem: + description: Additional tools made available to the model at this point in the input + example: + role: developer + tools: + - name: get_weather + parameters: + properties: + location: + type: string + type: object + type: function + type: additional_tools + properties: + id: + nullable: true + type: string + role: + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + type: string + tools: + items: + anyOf: + - allOf: + - $ref: '#/components/schemas/FunctionTool' + - properties: {} + type: object + description: Function tool definition + example: + description: Get the current weather in a location + name: get_weather + parameters: + properties: + location: + description: The city and state + type: string + unit: + enum: + - celsius + - fahrenheit + type: string + required: + - location + type: object + type: function + - $ref: '#/components/schemas/Preview_WebSearchServerTool' + - $ref: '#/components/schemas/Preview_20250311_WebSearchServerTool' + - $ref: '#/components/schemas/Legacy_WebSearchServerTool' + - $ref: '#/components/schemas/WebSearchServerTool' + - $ref: '#/components/schemas/FileSearchServerTool' + - $ref: '#/components/schemas/ComputerUseServerTool' + - $ref: '#/components/schemas/CodeInterpreterServerTool' + - $ref: '#/components/schemas/McpServerTool' + - $ref: '#/components/schemas/ImageGenerationServerTool' + - $ref: '#/components/schemas/CodexLocalShellTool' + - $ref: '#/components/schemas/ShellServerTool' + - $ref: '#/components/schemas/ApplyPatchServerTool' + - $ref: '#/components/schemas/CustomTool' + - $ref: '#/components/schemas/AdvisorServerTool_OpenRouter' + - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' + - $ref: '#/components/schemas/DatetimeServerTool' + - $ref: '#/components/schemas/FilesServerTool' + - $ref: '#/components/schemas/FusionServerTool_OpenRouter' + - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' + - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/WebFetchServerTool' + - $ref: '#/components/schemas/WebSearchServerTool_OpenRouter' + - $ref: '#/components/schemas/ApplyPatchServerTool_OpenRouter' + - $ref: '#/components/schemas/BashServerTool' + - $ref: '#/components/schemas/ShellServerTool_OpenRouter' + - additionalProperties: + nullable: true + properties: + type: + type: string + required: + - type + type: object + type: array + type: + enum: + - additional_tools + type: string + required: + - type + - role + - tools + type: object AdvisorNestedTool: additionalProperties: nullable: true @@ -10391,6 +10487,7 @@ components: - $ref: '#/components/schemas/CustomToolCallOutputItem' - $ref: '#/components/schemas/CompactionItem' - $ref: '#/components/schemas/ItemReferenceItem' + - $ref: '#/components/schemas/AdditionalToolsItem' type: array description: Input for a response request - can be a string or array of items example: From d78ff13303053cfd294473259ce28a1f97381a81 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 01:23:02 +0000 Subject: [PATCH 32/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.18=20(#424)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 66 ++-- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 99 ++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/additionaltoolsitem.mdx | 15 + docs/components/additionaltoolsitemrole.mdx | 26 ++ docs/components/additionaltoolsitemtool.mdx | 10 + .../additionaltoolsitemtoolfunction.mdx | 16 + .../additionaltoolsitemtoolunion.mdx | 168 +++++++++++ .../additionaltoolsitemtypefunction.mdx | 15 + docs/components/inputsunion1.mdx | 6 + docs/components/typeadditionaltools.mdx | 15 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 35 +++ .../components/additionaltoolsitem.py | 284 ++++++++++++++++++ src/openrouter/components/inputs_union.py | 83 ++--- uv.lock | 2 +- 19 files changed, 802 insertions(+), 68 deletions(-) create mode 100644 docs/components/additionaltoolsitem.mdx create mode 100644 docs/components/additionaltoolsitemrole.mdx create mode 100644 docs/components/additionaltoolsitemtool.mdx create mode 100644 docs/components/additionaltoolsitemtoolfunction.mdx create mode 100644 docs/components/additionaltoolsitemtoolunion.mdx create mode 100644 docs/components/additionaltoolsitemtypefunction.mdx create mode 100644 docs/components/typeadditionaltools.mdx create mode 100644 src/openrouter/components/additionaltoolsitem.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 803358a..4056cc7 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: ad7637a68c46f585f25b6a36b9dd0f64 + docChecksum: 16502ba1d37c69afff28bddd6d7626fa docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.17 - configChecksum: e1094fdca787104fc58b99c1a21f533d + releaseVersion: 0.11.18 + configChecksum: a2b5416af2f6e419e890e700ebff85b2 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: efe0a4c5-68bb-420f-acd6-9382a2e84419 - pristine_commit_hash: 2c5b8d0d8b460f97ba19d673e012040cb8cceddc - pristine_tree_hash: d8087e47e225e199329a004d366ac4e933efff90 + generation_id: 43c7e9de-e01c-454f-963f-fffefb852389 + pristine_commit_hash: 507fe1d22cb798a9ec68eac499ec65af7c93a995 + pristine_tree_hash: e7dc383135ed75f29c946b77f2965d61ec238f63 features: python: acceptHeaders: 3.0.0 @@ -108,6 +108,30 @@ trackedFiles: id: 5886155bc810 last_write_checksum: sha1:64acd6c3d2db5593d8359474c4e2e31e4db62453 pristine_git_object: 6edb98e874664ab4349034ca3d0c5874f761fe9a + docs/components/additionaltoolsitem.mdx: + id: 8658d14827df + last_write_checksum: sha1:e97ba3bc67c191d689dba7fe6ab66871a1cecf3c + pristine_git_object: 34d2291edf704988089189629166217cc45ab2b0 + docs/components/additionaltoolsitemrole.mdx: + id: b3d0b645d28d + last_write_checksum: sha1:a8df9099d85af44ca7547bba92435a4d93523dd3 + pristine_git_object: 2e7f805c00b56bbd6872d986beb5fa76cb0a6c28 + docs/components/additionaltoolsitemtool.mdx: + id: 075b8c61fc35 + last_write_checksum: sha1:e038792f2a5d489bc1994d81d6df101d376c53e8 + pristine_git_object: 9dcea23673cc79bb60efaf0b84299aa4b916e3ca + docs/components/additionaltoolsitemtoolfunction.mdx: + id: b8c1e4fcad3b + last_write_checksum: sha1:fd16181ea1f609dfcb8cc4bdc566011d2041faee + pristine_git_object: d78714317e328d9131e563de7807db0761bb3da1 + docs/components/additionaltoolsitemtoolunion.mdx: + id: b3e8598b1887 + last_write_checksum: sha1:930eb580f2512a07b58b830f588dedad8ecab631 + pristine_git_object: 5fc5576b0d88994c2e7d6996181e51e5fd63fa94 + docs/components/additionaltoolsitemtypefunction.mdx: + id: bf179b4008af + last_write_checksum: sha1:c0d4fee7d39fbd3d08c44bbe0e7b929350c5d7e8 + pristine_git_object: 00ce08abaaf149eb1713cc084e87a8b1efc8df81 docs/components/advisornestedtool.mdx: id: 71464b7dde39 last_write_checksum: sha1:85f6613d57b23cb14b06e5bd9ee717dd7a0076cb @@ -2410,8 +2434,8 @@ trackedFiles: pristine_git_object: 33aee92c61bf7ab9beded4e193f50a2c08462378 docs/components/inputsunion1.mdx: id: c216609d21ce - last_write_checksum: sha1:ccfecdbd5ad7a2719b2372c54e9eac1075b1f108 - pristine_git_object: 9d37626f96de3c19d39e4901d041ef41b01bdc98 + last_write_checksum: sha1:be2b2255aaaa200ee37b27ad64e428592f8065cd + pristine_git_object: be6efd1c3a0a797e8f00600fb2fb47fa00b4ddf4 docs/components/inputtext.mdx: id: c8a97322a50a last_write_checksum: sha1:58653e40ea0a33629dda40d2a11c8d21a75b0467 @@ -4672,6 +4696,10 @@ trackedFiles: id: ed021c787cd5 last_write_checksum: sha1:bb6b3619ca5b6877ddd66dda0a2cb799c989ad33 pristine_git_object: 01eae6d76ebf42187c1dcbeaa43288f5df94e8cb + docs/components/typeadditionaltools.mdx: + id: e9b8d6c3c36b + last_write_checksum: sha1:6b4730663782a2052103e741b926d4943319b269 + pristine_git_object: fd61616ce5a2764c026d48863bb671a79be3e824 docs/components/typeadvisor20260301.mdx: id: 6b8fbaf1abe6 last_write_checksum: sha1:a8d7df683cc00996868f4a8f16d43f5171f9786c @@ -6506,8 +6534,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:8564217ec020db72f0e9fdbc4cc2a9741aef8da8 - pristine_git_object: 1f53995948f1621cbe09a49eab44c5b08e538977 + last_write_checksum: sha1:bb8d05c87d2fce01ba7ea9fe811425844624c6d6 + pristine_git_object: b9fecdcfb5971da6721e949608d09ca07d77307c scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6534,8 +6562,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:24a6775af4e431ffa67c67f909015339440e6b0a - pristine_git_object: d07f58993aa7027d3e22432eeec9c887d991b7ea + last_write_checksum: sha1:109693a9a2f8aaa8302f4a8c79ca80d9f736ed4f + pristine_git_object: 040c27279c9bd92aa793b82352d5b0b986c6faf9 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6574,8 +6602,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:f4f8b839a539a8885447d5bbdadcc985553d65c8 - pristine_git_object: 25795f206171fcfa804e2e44c033713d99f52c21 + last_write_checksum: sha1:db6939dcf34a388b4111cb127e372fd434a437c0 + pristine_git_object: 2b758c9d3531925e091e70d3aeb1559ecfef10a2 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6588,6 +6616,10 @@ trackedFiles: id: 0bd8d79c3144 last_write_checksum: sha1:db8e3247cf9eb2c235d32949d36f7ae95870e8ed pristine_git_object: 1138e6f6bc025546a86877749ce83aca4c46499a + src/openrouter/components/additionaltoolsitem.py: + id: 2761ab789f41 + last_write_checksum: sha1:9156822bf7cf6b71f1351e12a03b7a659c0a2762 + pristine_git_object: 1bd74f0c42994da09935ed8a6a4c0baa49a0bc5e src/openrouter/components/advisornestedtool.py: id: 768fcc6bad2b last_write_checksum: sha1:9c4303eb7fbefd1d7200cd588e7ab7e55db791e8 @@ -7610,8 +7642,8 @@ trackedFiles: pristine_git_object: a3d84a96f4553a320f5eee5d63f6bc5c244ab446 src/openrouter/components/inputs_union.py: id: 17d6239cb6a7 - last_write_checksum: sha1:289d1c1eb23075d285491f8fab2bf4d8dc941c4b - pristine_git_object: 1371934ab909d77965b050958080277ca8988f09 + last_write_checksum: sha1:56b54bc88ad27ba75866fa7f548fa405650d689a + pristine_git_object: 138ccb8156df5fe2baa8b2b4b60dce353fd3cf7a src/openrouter/components/inputtext.py: id: a995ae96be99 last_write_checksum: sha1:f78a6a35792b704f18ee6e1312c24f78f38cca36 @@ -10877,4 +10909,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.tts.create_speech()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.stt.create_transcription()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.byok.list()`: \n * `request.provider` **Changed** (Breaking ⚠️)\n * `response.data[].provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.create()`: \n * `request.provider` **Changed** (Breaking ⚠️)\n * `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.get()`: `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.byok.update()`: `response.data.provider` **Changed** (Breaking ⚠️)\n* `open_router.images.generate()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.video_generation.generate()`: \n * `request.provider.options` **Changed** (Breaking ⚠️)\n* `open_router.generations.submit_feedback()`: **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index d85800f..20ab2ae 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.17 + version: 0.11.18 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 1a0c9ef..460cc29 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -149,6 +149,104 @@ components: required: - data type: object + AdditionalToolsItem: + description: Additional tools made available to the model at this point in the input + example: + role: developer + tools: + - name: get_weather + parameters: + properties: + location: + type: string + type: object + type: function + type: additional_tools + properties: + id: + nullable: true + type: string + role: + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + type: string + x-speakeasy-unknown-values: allow + tools: + items: + anyOf: + - allOf: + - $ref: '#/components/schemas/FunctionTool' + - properties: {} + type: object + description: Function tool definition + example: + description: Get the current weather in a location + name: get_weather + parameters: + properties: + location: + description: The city and state + type: string + unit: + enum: + - celsius + - fahrenheit + type: string + x-speakeasy-unknown-values: allow + required: + - location + type: object + type: function + - $ref: '#/components/schemas/Preview_WebSearchServerTool' + - $ref: '#/components/schemas/Preview_20250311_WebSearchServerTool' + - $ref: '#/components/schemas/Legacy_WebSearchServerTool' + - $ref: '#/components/schemas/WebSearchServerTool' + - $ref: '#/components/schemas/FileSearchServerTool' + - $ref: '#/components/schemas/ComputerUseServerTool' + - $ref: '#/components/schemas/CodeInterpreterServerTool' + - $ref: '#/components/schemas/McpServerTool' + - $ref: '#/components/schemas/ImageGenerationServerTool' + - $ref: '#/components/schemas/CodexLocalShellTool' + - $ref: '#/components/schemas/ShellServerTool' + - $ref: '#/components/schemas/ApplyPatchServerTool' + - $ref: '#/components/schemas/CustomTool' + - $ref: '#/components/schemas/AdvisorServerTool_OpenRouter' + - $ref: '#/components/schemas/SubagentServerTool_OpenRouter' + - $ref: '#/components/schemas/DatetimeServerTool' + - $ref: '#/components/schemas/FilesServerTool' + - $ref: '#/components/schemas/FusionServerTool_OpenRouter' + - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' + - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/WebFetchServerTool' + - $ref: '#/components/schemas/WebSearchServerTool_OpenRouter' + - $ref: '#/components/schemas/ApplyPatchServerTool_OpenRouter' + - $ref: '#/components/schemas/BashServerTool' + - $ref: '#/components/schemas/ShellServerTool_OpenRouter' + - additionalProperties: + nullable: true + properties: + type: + type: string + required: + - type + type: object + type: array + type: + enum: + - additional_tools + type: string + required: + - type + - role + - tools + type: object AdvisorNestedTool: additionalProperties: nullable: true @@ -10337,6 +10435,7 @@ components: - $ref: '#/components/schemas/CustomToolCallOutputItem' - $ref: '#/components/schemas/CompactionItem' - $ref: '#/components/schemas/ItemReferenceItem' + - $ref: '#/components/schemas/AdditionalToolsItem' type: array description: Input for a response request - can be a string or array of items example: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 4af3fa7..1f1f0a0 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:99649ad73bd44656a11c0f47bf5b52ff056911ce5543fdd487b1c7d835d4d01e - sourceBlobDigest: sha256:fb03e6ac1679e81970afc16a019748cc195bb2881a09f0e5dc0ae18934621701 + sourceRevisionDigest: sha256:5d92f9e16b58b6867b6333b47544046d8179ed6ee1ce9b9d289a5f5fc9ac13bf + sourceBlobDigest: sha256:59fc773016c0c02fc04da6c9785ff6cf5b572b30f5d22095b14564f1c4ff958b tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:99649ad73bd44656a11c0f47bf5b52ff056911ce5543fdd487b1c7d835d4d01e - sourceBlobDigest: sha256:fb03e6ac1679e81970afc16a019748cc195bb2881a09f0e5dc0ae18934621701 + sourceRevisionDigest: sha256:5d92f9e16b58b6867b6333b47544046d8179ed6ee1ce9b9d289a5f5fc9ac13bf + sourceBlobDigest: sha256:59fc773016c0c02fc04da6c9785ff6cf5b572b30f5d22095b14564f1c4ff958b codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:a6459b61a352d9d8512b16c634606461a35e4275e373904dec9cd85e245db64b + codeSamplesRevisionDigest: sha256:3770bb81a5566b8937f2c434e761c2a63e5c7f0507d7b3439ec0d1a87d53c673 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index bd0faa7..e1fac37 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -278,4 +278,14 @@ Based on: ### Generated - [python v0.11.17] . ### Releases -- [PyPI v0.11.17] https://pypi.org/project/openrouter/0.11.17 - . \ No newline at end of file +- [PyPI v0.11.17] https://pypi.org/project/openrouter/0.11.17 - . + +## 2026-07-10 01:18:52 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.18] . +### Releases +- [PyPI v0.11.18] https://pypi.org/project/openrouter/0.11.18 - . \ No newline at end of file diff --git a/docs/components/additionaltoolsitem.mdx b/docs/components/additionaltoolsitem.mdx new file mode 100644 index 0000000..34d2291 --- /dev/null +++ b/docs/components/additionaltoolsitem.mdx @@ -0,0 +1,15 @@ +--- +title: "AdditionalToolsItem" +--- + +Additional tools made available to the model at this point in the input + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `role` | [components.AdditionalToolsItemRole](../components/additionaltoolsitemrole.mdx) | :heavy_check_mark: | N/A | +| `tools` | List[[components.AdditionalToolsItemToolUnion](../components/additionaltoolsitemtoolunion.mdx)] | :heavy_check_mark: | N/A | +| `type` | [components.TypeAdditionalTools](../components/typeadditionaltools.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/additionaltoolsitemrole.mdx b/docs/components/additionaltoolsitemrole.mdx new file mode 100644 index 0000000..2e7f805 --- /dev/null +++ b/docs/components/additionaltoolsitemrole.mdx @@ -0,0 +1,26 @@ +--- +title: "AdditionalToolsItemRole" +--- + +## Example Usage + +```python +from openrouter.components import AdditionalToolsItemRole + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: AdditionalToolsItemRole = "unknown" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"unknown"` +- `"user"` +- `"assistant"` +- `"system"` +- `"critic"` +- `"discriminator"` +- `"developer"` +- `"tool"` diff --git a/docs/components/additionaltoolsitemtool.mdx b/docs/components/additionaltoolsitemtool.mdx new file mode 100644 index 0000000..9dcea23 --- /dev/null +++ b/docs/components/additionaltoolsitemtool.mdx @@ -0,0 +1,10 @@ +--- +title: "AdditionalToolsItemTool" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `type` | *str* | :heavy_check_mark: | N/A | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/additionaltoolsitemtoolfunction.mdx b/docs/components/additionaltoolsitemtoolfunction.mdx new file mode 100644 index 0000000..d787143 --- /dev/null +++ b/docs/components/additionaltoolsitemtoolfunction.mdx @@ -0,0 +1,16 @@ +--- +title: "AdditionalToolsItemToolFunction" +--- + +Function tool definition + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `name` | *str* | :heavy_check_mark: | N/A | +| `parameters` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | N/A | +| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | +| `type` | [components.AdditionalToolsItemTypeFunction](../components/additionaltoolsitemtypefunction.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/additionaltoolsitemtoolunion.mdx b/docs/components/additionaltoolsitemtoolunion.mdx new file mode 100644 index 0000000..5fc5576 --- /dev/null +++ b/docs/components/additionaltoolsitemtoolunion.mdx @@ -0,0 +1,168 @@ +--- +title: "AdditionalToolsItemToolUnion" +--- + +## Supported Types + +### `components.AdditionalToolsItemToolFunction` + +```python +value: components.AdditionalToolsItemToolFunction = /* values here */ +``` + +### `components.PreviewWebSearchServerTool` + +```python +value: components.PreviewWebSearchServerTool = /* values here */ +``` + +### `components.Preview20250311WebSearchServerTool` + +```python +value: components.Preview20250311WebSearchServerTool = /* values here */ +``` + +### `components.LegacyWebSearchServerTool` + +```python +value: components.LegacyWebSearchServerTool = /* values here */ +``` + +### `components.WebSearchServerTool` + +```python +value: components.WebSearchServerTool = /* values here */ +``` + +### `components.FileSearchServerTool` + +```python +value: components.FileSearchServerTool = /* values here */ +``` + +### `components.ComputerUseServerTool` + +```python +value: components.ComputerUseServerTool = /* values here */ +``` + +### `components.CodeInterpreterServerTool` + +```python +value: components.CodeInterpreterServerTool = /* values here */ +``` + +### `components.McpServerTool` + +```python +value: components.McpServerTool = /* values here */ +``` + +### `components.ImageGenerationServerTool` + +```python +value: components.ImageGenerationServerTool = /* values here */ +``` + +### `components.CodexLocalShellTool` + +```python +value: components.CodexLocalShellTool = /* values here */ +``` + +### `components.ShellServerTool` + +```python +value: components.ShellServerTool = /* values here */ +``` + +### `components.ApplyPatchServerTool` + +```python +value: components.ApplyPatchServerTool = /* values here */ +``` + +### `components.CustomTool` + +```python +value: components.CustomTool = /* values here */ +``` + +### `components.AdvisorServerToolOpenRouter` + +```python +value: components.AdvisorServerToolOpenRouter = /* values here */ +``` + +### `components.SubagentServerToolOpenRouter` + +```python +value: components.SubagentServerToolOpenRouter = /* values here */ +``` + +### `components.DatetimeServerTool` + +```python +value: components.DatetimeServerTool = /* values here */ +``` + +### `components.FilesServerTool` + +```python +value: components.FilesServerTool = /* values here */ +``` + +### `components.FusionServerToolOpenRouter` + +```python +value: components.FusionServerToolOpenRouter = /* values here */ +``` + +### `components.ImageGenerationServerToolOpenRouter` + +```python +value: components.ImageGenerationServerToolOpenRouter = /* values here */ +``` + +### `components.ChatSearchModelsServerTool` + +```python +value: components.ChatSearchModelsServerTool = /* values here */ +``` + +### `components.WebFetchServerTool` + +```python +value: components.WebFetchServerTool = /* values here */ +``` + +### `components.WebSearchServerToolOpenRouter` + +```python +value: components.WebSearchServerToolOpenRouter = /* values here */ +``` + +### `components.ApplyPatchServerToolOpenRouter` + +```python +value: components.ApplyPatchServerToolOpenRouter = /* values here */ +``` + +### `components.BashServerTool` + +```python +value: components.BashServerTool = /* values here */ +``` + +### `components.ShellServerToolOpenRouter` + +```python +value: components.ShellServerToolOpenRouter = /* values here */ +``` + +### `components.AdditionalToolsItemTool` + +```python +value: components.AdditionalToolsItemTool = /* values here */ +``` + diff --git a/docs/components/additionaltoolsitemtypefunction.mdx b/docs/components/additionaltoolsitemtypefunction.mdx new file mode 100644 index 0000000..00ce08a --- /dev/null +++ b/docs/components/additionaltoolsitemtypefunction.mdx @@ -0,0 +1,15 @@ +--- +title: "AdditionalToolsItemTypeFunction" +--- + +## Example Usage + +```python +from openrouter.components import AdditionalToolsItemTypeFunction +value: AdditionalToolsItemTypeFunction = "function" +``` + + +## Values + +- `"function"` diff --git a/docs/components/inputsunion1.mdx b/docs/components/inputsunion1.mdx index 9d37626..be6efd1 100644 --- a/docs/components/inputsunion1.mdx +++ b/docs/components/inputsunion1.mdx @@ -280,3 +280,9 @@ value: components.CompactionItem = /* values here */ value: components.ItemReferenceItem = /* values here */ ``` +### `components.AdditionalToolsItem` + +```python +value: components.AdditionalToolsItem = /* values here */ +``` + diff --git a/docs/components/typeadditionaltools.mdx b/docs/components/typeadditionaltools.mdx new file mode 100644 index 0000000..fd61616 --- /dev/null +++ b/docs/components/typeadditionaltools.mdx @@ -0,0 +1,15 @@ +--- +title: "TypeAdditionalTools" +--- + +## Example Usage + +```python +from openrouter.components import TypeAdditionalTools +value: TypeAdditionalTools = "additional_tools" +``` + + +## Values + +- `"additional_tools"` diff --git a/pyproject.toml b/pyproject.toml index 1f53995..b9fecdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.17" +version = "0.11.18" 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 d07f589..040c272 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.17" +__version__: str = "0.11.18" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.17 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.18 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 25795f2..2b758c9 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -8,6 +8,19 @@ if TYPE_CHECKING: from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict from .activityitem import ActivityItem, ActivityItemTypedDict from .activityresponse import ActivityResponse, ActivityResponseTypedDict + from .additionaltoolsitem import ( + AdditionalToolsItem, + AdditionalToolsItemRole, + AdditionalToolsItemTool, + AdditionalToolsItemToolFunction, + AdditionalToolsItemToolFunctionTypedDict, + AdditionalToolsItemToolTypedDict, + AdditionalToolsItemToolUnion, + AdditionalToolsItemToolUnionTypedDict, + AdditionalToolsItemTypeFunction, + AdditionalToolsItemTypedDict, + TypeAdditionalTools, + ) from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict from .advisorreasoning import ( AdvisorReasoning, @@ -2769,6 +2782,16 @@ __all__ = [ "ActivityItemTypedDict", "ActivityResponse", "ActivityResponseTypedDict", + "AdditionalToolsItem", + "AdditionalToolsItemRole", + "AdditionalToolsItemTool", + "AdditionalToolsItemToolFunction", + "AdditionalToolsItemToolFunctionTypedDict", + "AdditionalToolsItemToolTypedDict", + "AdditionalToolsItemToolUnion", + "AdditionalToolsItemToolUnionTypedDict", + "AdditionalToolsItemTypeFunction", + "AdditionalToolsItemTypedDict", "AdvisorNestedTool", "AdvisorNestedToolTypedDict", "AdvisorReasoning", @@ -4586,6 +4609,7 @@ __all__ = [ "Truncation", "Type", "TypeAdaptive", + "TypeAdditionalTools", "TypeAdvisor20260301", "TypeAny", "TypeBash20250124", @@ -4782,6 +4806,17 @@ _dynamic_imports: dict[str, str] = { "ActivityItemTypedDict": ".activityitem", "ActivityResponse": ".activityresponse", "ActivityResponseTypedDict": ".activityresponse", + "AdditionalToolsItem": ".additionaltoolsitem", + "AdditionalToolsItemRole": ".additionaltoolsitem", + "AdditionalToolsItemTool": ".additionaltoolsitem", + "AdditionalToolsItemToolFunction": ".additionaltoolsitem", + "AdditionalToolsItemToolFunctionTypedDict": ".additionaltoolsitem", + "AdditionalToolsItemToolTypedDict": ".additionaltoolsitem", + "AdditionalToolsItemToolUnion": ".additionaltoolsitem", + "AdditionalToolsItemToolUnionTypedDict": ".additionaltoolsitem", + "AdditionalToolsItemTypeFunction": ".additionaltoolsitem", + "AdditionalToolsItemTypedDict": ".additionaltoolsitem", + "TypeAdditionalTools": ".additionaltoolsitem", "AdvisorNestedTool": ".advisornestedtool", "AdvisorNestedToolTypedDict": ".advisornestedtool", "AdvisorReasoning": ".advisorreasoning", diff --git a/src/openrouter/components/additionaltoolsitem.py b/src/openrouter/components/additionaltoolsitem.py new file mode 100644 index 0000000..1bd74f0 --- /dev/null +++ b/src/openrouter/components/additionaltoolsitem.py @@ -0,0 +1,284 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .advisorservertool_openrouter import ( + AdvisorServerToolOpenRouter, + AdvisorServerToolOpenRouterTypedDict, +) +from .applypatchservertool import ApplyPatchServerTool, ApplyPatchServerToolTypedDict +from .applypatchservertool_openrouter import ( + ApplyPatchServerToolOpenRouter, + ApplyPatchServerToolOpenRouterTypedDict, +) +from .bashservertool import BashServerTool, BashServerToolTypedDict +from .chatsearchmodelsservertool import ( + ChatSearchModelsServerTool, + ChatSearchModelsServerToolTypedDict, +) +from .codeinterpreterservertool import ( + CodeInterpreterServerTool, + CodeInterpreterServerToolTypedDict, +) +from .codexlocalshelltool import CodexLocalShellTool, CodexLocalShellToolTypedDict +from .computeruseservertool import ComputerUseServerTool, ComputerUseServerToolTypedDict +from .customtool import CustomTool, CustomToolTypedDict +from .datetimeservertool import DatetimeServerTool, DatetimeServerToolTypedDict +from .filesearchservertool import FileSearchServerTool, FileSearchServerToolTypedDict +from .filesservertool import FilesServerTool, FilesServerToolTypedDict +from .fusionservertool_openrouter import ( + FusionServerToolOpenRouter, + FusionServerToolOpenRouterTypedDict, +) +from .imagegenerationservertool import ( + ImageGenerationServerTool, + ImageGenerationServerToolTypedDict, +) +from .imagegenerationservertool_openrouter import ( + ImageGenerationServerToolOpenRouter, + ImageGenerationServerToolOpenRouterTypedDict, +) +from .legacy_websearchservertool import ( + LegacyWebSearchServerTool, + LegacyWebSearchServerToolTypedDict, +) +from .mcpservertool import McpServerTool, McpServerToolTypedDict +from .preview_20250311_websearchservertool import ( + Preview20250311WebSearchServerTool, + Preview20250311WebSearchServerToolTypedDict, +) +from .preview_websearchservertool import ( + PreviewWebSearchServerTool, + PreviewWebSearchServerToolTypedDict, +) +from .shellservertool import ShellServerTool, ShellServerToolTypedDict +from .shellservertool_openrouter import ( + ShellServerToolOpenRouter, + ShellServerToolOpenRouterTypedDict, +) +from .subagentservertool_openrouter import ( + SubagentServerToolOpenRouter, + SubagentServerToolOpenRouterTypedDict, +) +from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict +from .websearchservertool import WebSearchServerTool, WebSearchServerToolTypedDict +from .websearchservertool_openrouter import ( + WebSearchServerToolOpenRouter, + WebSearchServerToolOpenRouterTypedDict, +) +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict, List, Literal, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +AdditionalToolsItemRole = Union[ + Literal[ + "unknown", + "user", + "assistant", + "system", + "critic", + "discriminator", + "developer", + "tool", + ], + UnrecognizedStr, +] + + +class AdditionalToolsItemToolTypedDict(TypedDict): + type: str + + +class AdditionalToolsItemTool(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + type: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +AdditionalToolsItemTypeFunction = Literal["function",] + + +class AdditionalToolsItemToolFunctionTypedDict(TypedDict): + r"""Function tool definition""" + + name: str + parameters: Nullable[Dict[str, Nullable[Any]]] + type: AdditionalToolsItemTypeFunction + description: NotRequired[Nullable[str]] + strict: NotRequired[Nullable[bool]] + + +class AdditionalToolsItemToolFunction(BaseModel): + r"""Function tool definition""" + + name: str + + parameters: Nullable[Dict[str, Nullable[Any]]] + + type: AdditionalToolsItemTypeFunction + + description: OptionalNullable[str] = UNSET + + strict: OptionalNullable[bool] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["description", "strict"]) + nullable_fields = set(["description", "parameters", "strict"]) + 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 + + +AdditionalToolsItemToolUnionTypedDict = TypeAliasType( + "AdditionalToolsItemToolUnionTypedDict", + Union[ + CodexLocalShellToolTypedDict, + ApplyPatchServerToolTypedDict, + ShellServerToolTypedDict, + FusionServerToolOpenRouterTypedDict, + ImageGenerationServerToolOpenRouterTypedDict, + AdditionalToolsItemToolTypedDict, + ShellServerToolOpenRouterTypedDict, + CodeInterpreterServerToolTypedDict, + BashServerToolTypedDict, + ApplyPatchServerToolOpenRouterTypedDict, + WebSearchServerToolOpenRouterTypedDict, + WebFetchServerToolTypedDict, + ChatSearchModelsServerToolTypedDict, + FilesServerToolTypedDict, + AdvisorServerToolOpenRouterTypedDict, + SubagentServerToolOpenRouterTypedDict, + DatetimeServerToolTypedDict, + CustomToolTypedDict, + ComputerUseServerToolTypedDict, + AdditionalToolsItemToolFunctionTypedDict, + FileSearchServerToolTypedDict, + WebSearchServerToolTypedDict, + PreviewWebSearchServerToolTypedDict, + Preview20250311WebSearchServerToolTypedDict, + LegacyWebSearchServerToolTypedDict, + McpServerToolTypedDict, + ImageGenerationServerToolTypedDict, + ], +) + + +AdditionalToolsItemToolUnion = TypeAliasType( + "AdditionalToolsItemToolUnion", + Union[ + CodexLocalShellTool, + ApplyPatchServerTool, + ShellServerTool, + FusionServerToolOpenRouter, + ImageGenerationServerToolOpenRouter, + AdditionalToolsItemTool, + ShellServerToolOpenRouter, + CodeInterpreterServerTool, + BashServerTool, + ApplyPatchServerToolOpenRouter, + WebSearchServerToolOpenRouter, + WebFetchServerTool, + ChatSearchModelsServerTool, + FilesServerTool, + AdvisorServerToolOpenRouter, + SubagentServerToolOpenRouter, + DatetimeServerTool, + CustomTool, + ComputerUseServerTool, + AdditionalToolsItemToolFunction, + FileSearchServerTool, + WebSearchServerTool, + PreviewWebSearchServerTool, + Preview20250311WebSearchServerTool, + LegacyWebSearchServerTool, + McpServerTool, + ImageGenerationServerTool, + ], +) + + +TypeAdditionalTools = Literal["additional_tools",] + + +class AdditionalToolsItemTypedDict(TypedDict): + r"""Additional tools made available to the model at this point in the input""" + + role: AdditionalToolsItemRole + tools: List[AdditionalToolsItemToolUnionTypedDict] + type: TypeAdditionalTools + id: NotRequired[Nullable[str]] + + +class AdditionalToolsItem(BaseModel): + r"""Additional tools made available to the model at this point in the input""" + + role: AdditionalToolsItemRole + + tools: List[AdditionalToolsItemToolUnion] + + type: TypeAdditionalTools + + id: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id"]) + nullable_fields = set(["id"]) + 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/components/inputs_union.py b/src/openrouter/components/inputs_union.py index 1371934..138ccb8 100644 --- a/src/openrouter/components/inputs_union.py +++ b/src/openrouter/components/inputs_union.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .additionaltoolsitem import AdditionalToolsItem, AdditionalToolsItemTypedDict from .applypatchcallitem import ApplyPatchCallItem, ApplyPatchCallItemTypedDict from .applypatchcalloutputitem import ( ApplyPatchCallOutputItem, @@ -375,40 +376,41 @@ InputsUnion1TypedDict = TypeAliasType( Union[ ItemReferenceItemTypedDict, CompactionItemTypedDict, - OutputFileSearchCallItemTypedDict, - EasyInputMessageTypedDict, - InputMessageItemTypedDict, + AdditionalToolsItemTypedDict, + OutputImageGenerationCallItemTypedDict, LocalShellCallOutputItemTypedDict, OutputToolSearchServerToolItemTypedDict, OutputFileSearchServerToolItemTypedDict, - OutputWebSearchServerToolItemTypedDict, CustomToolCallOutputItemTypedDict, - OutputImageGenerationCallItemTypedDict, + InputMessageItemTypedDict, + EasyInputMessageTypedDict, + OutputWebSearchServerToolItemTypedDict, OutputWebSearchCallItemTypedDict, + OutputFileSearchCallItemTypedDict, OutputDatetimeItemTypedDict, - OutputMcpServerToolItemTypedDict, - FunctionCallOutputItemTypedDict, - OutputSearchModelsServerToolItemTypedDict, - LocalShellCallItemTypedDict, - ApplyPatchCallItemTypedDict, - McpListToolsItemTypedDict, - ApplyPatchCallOutputItemTypedDict, - McpApprovalResponseItemTypedDict, - OutputBrowserUseServerToolItemTypedDict, - McpApprovalRequestItemTypedDict, - OutputTextEditorServerToolItemTypedDict, OutputApplyPatchServerToolItemTypedDict, + FunctionCallOutputItemTypedDict, + LocalShellCallItemTypedDict, + McpListToolsItemTypedDict, + OutputSearchModelsServerToolItemTypedDict, + ApplyPatchCallOutputItemTypedDict, + OutputMcpServerToolItemTypedDict, + OutputBrowserUseServerToolItemTypedDict, + McpApprovalResponseItemTypedDict, + OutputTextEditorServerToolItemTypedDict, + ApplyPatchCallItemTypedDict, + McpApprovalRequestItemTypedDict, + OutputCodeInterpreterCallItemTypedDict, + OutputMemoryServerToolItemTypedDict, CustomToolCallItemTypedDict, InputsMessageTypedDict, - OutputMemoryServerToolItemTypedDict, OutputCustomToolCallItemTypedDict, - OutputComputerCallItemTypedDict, ShellCallOutputItemTypedDict, ShellCallItemTypedDict, - OutputCodeInterpreterCallItemTypedDict, + OutputComputerCallItemTypedDict, OutputBashServerToolItemTypedDict, - OutputImageGenerationServerToolItemTypedDict, McpCallItemTypedDict, + OutputImageGenerationServerToolItemTypedDict, OutputFunctionCallItemTypedDict, FunctionCallItemTypedDict, OutputFilesServerToolItemTypedDict, @@ -428,40 +430,41 @@ InputsUnion1 = TypeAliasType( Union[ ItemReferenceItem, CompactionItem, - OutputFileSearchCallItem, - EasyInputMessage, - InputMessageItem, + AdditionalToolsItem, + OutputImageGenerationCallItem, LocalShellCallOutputItem, OutputToolSearchServerToolItem, OutputFileSearchServerToolItem, - OutputWebSearchServerToolItem, CustomToolCallOutputItem, - OutputImageGenerationCallItem, + InputMessageItem, + EasyInputMessage, + OutputWebSearchServerToolItem, OutputWebSearchCallItem, + OutputFileSearchCallItem, OutputDatetimeItem, - OutputMcpServerToolItem, - FunctionCallOutputItem, - OutputSearchModelsServerToolItem, - LocalShellCallItem, - ApplyPatchCallItem, - McpListToolsItem, - ApplyPatchCallOutputItem, - McpApprovalResponseItem, - OutputBrowserUseServerToolItem, - McpApprovalRequestItem, - OutputTextEditorServerToolItem, OutputApplyPatchServerToolItem, + FunctionCallOutputItem, + LocalShellCallItem, + McpListToolsItem, + OutputSearchModelsServerToolItem, + ApplyPatchCallOutputItem, + OutputMcpServerToolItem, + OutputBrowserUseServerToolItem, + McpApprovalResponseItem, + OutputTextEditorServerToolItem, + ApplyPatchCallItem, + McpApprovalRequestItem, + OutputCodeInterpreterCallItem, + OutputMemoryServerToolItem, CustomToolCallItem, InputsMessage, - OutputMemoryServerToolItem, OutputCustomToolCallItem, - OutputComputerCallItem, ShellCallOutputItem, ShellCallItem, - OutputCodeInterpreterCallItem, + OutputComputerCallItem, OutputBashServerToolItem, - OutputImageGenerationServerToolItem, McpCallItem, + OutputImageGenerationServerToolItem, OutputFunctionCallItem, FunctionCallItem, OutputFilesServerToolItem, diff --git a/uv.lock b/uv.lock index 852a1d8..61e791f 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.17" +version = "0.11.18" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 83c16a17c684373f1e1c4fc781012a564a8adf60 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:40:13 +0000 Subject: [PATCH 33/62] chore: update OpenAPI spec from monorepo (#425) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 91 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index cf5725c..0fea2ab 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -359,6 +359,72 @@ components: $ref: '#/components/schemas/AdvisorNestedTool' type: array type: object + AgentMessageItem: + additionalProperties: + nullable: true + description: A message routed between agents in a multi-agent session + example: + author: /root/worker + content: + - text: Task complete. + type: input_text + recipient: /root + type: agent_message + properties: + agent: + additionalProperties: + nullable: true + nullable: true + properties: + agent_name: + type: string + required: + - agent_name + type: object + author: + type: string + content: + items: + oneOf: + - $ref: '#/components/schemas/InputText' + - allOf: + - $ref: '#/components/schemas/InputImage' + - properties: {} + type: object + description: Image input content item + example: + detail: auto + image_url: https://example.com/image.jpg + type: input_image + - additionalProperties: + nullable: true + properties: + encrypted_content: + type: string + type: + enum: + - encrypted_content + type: string + required: + - type + - encrypted_content + type: object + type: array + id: + nullable: true + type: string + recipient: + type: string + type: + enum: + - agent_message + type: string + required: + - type + - author + - recipient + - content + type: object AnnotationAddedEvent: allOf: - $ref: '#/components/schemas/BaseAnnotationAddedEvent' @@ -5874,6 +5940,8 @@ components: - type type: object CompactionItem: + additionalProperties: + nullable: true description: A context compaction marker with encrypted summary example: encrypted_content: enc_abc123... @@ -6321,6 +6389,27 @@ components: - type - video_url type: object + ContextCompactionItem: + additionalProperties: + nullable: true + description: A context compaction marker with an optional encrypted summary + example: + encrypted_content: enc_abc123... + type: context_compaction + properties: + encrypted_content: + nullable: true + type: string + id: + nullable: true + type: string + type: + enum: + - context_compaction + type: string + required: + - type + type: object ContextCompressionEngine: description: The compression engine to use. Defaults to "middle-out". enum: @@ -10486,8 +10575,10 @@ components: - $ref: '#/components/schemas/CustomToolCallItem' - $ref: '#/components/schemas/CustomToolCallOutputItem' - $ref: '#/components/schemas/CompactionItem' + - $ref: '#/components/schemas/ContextCompactionItem' - $ref: '#/components/schemas/ItemReferenceItem' - $ref: '#/components/schemas/AdditionalToolsItem' + - $ref: '#/components/schemas/AgentMessageItem' type: array description: Input for a response request - can be a string or array of items example: From 8d8b3557fdd5d76830080129a4656e55fd4cde45 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:45:53 +0000 Subject: [PATCH 34/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.19=20(#426)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 94 ++++++-- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 91 ++++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/agent.mdx | 10 + docs/components/agentmessageitem.mdx | 18 ++ .../agentmessageitemcontentinputimage.mdx | 14 ++ .../agentmessageitemcontentunion.mdx | 24 ++ docs/components/agentmessageitemdetail.mdx | 22 ++ .../agentmessageitemtypeinputimage.mdx | 15 ++ docs/components/compactionitem.mdx | 11 +- docs/components/contentencryptedcontent.mdx | 11 + docs/components/contextcompactionitem.mdx | 15 ++ docs/components/contextcompactionitemtype.mdx | 15 ++ docs/components/inputsunion1.mdx | 12 + docs/components/typeagentmessage.mdx | 15 ++ docs/components/typeencryptedcontent.mdx | 15 ++ pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 55 +++++ src/openrouter/components/agentmessageitem.py | 213 ++++++++++++++++++ src/openrouter/components/compactionitem.py | 21 +- .../components/contextcompactionitem.py | 76 +++++++ src/openrouter/components/inputs_union.py | 118 +++++----- uv.lock | 2 +- 26 files changed, 802 insertions(+), 95 deletions(-) create mode 100644 docs/components/agent.mdx create mode 100644 docs/components/agentmessageitem.mdx create mode 100644 docs/components/agentmessageitemcontentinputimage.mdx create mode 100644 docs/components/agentmessageitemcontentunion.mdx create mode 100644 docs/components/agentmessageitemdetail.mdx create mode 100644 docs/components/agentmessageitemtypeinputimage.mdx create mode 100644 docs/components/contentencryptedcontent.mdx create mode 100644 docs/components/contextcompactionitem.mdx create mode 100644 docs/components/contextcompactionitemtype.mdx create mode 100644 docs/components/typeagentmessage.mdx create mode 100644 docs/components/typeencryptedcontent.mdx create mode 100644 src/openrouter/components/agentmessageitem.py create mode 100644 src/openrouter/components/contextcompactionitem.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 4056cc7..5b24086 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: 16502ba1d37c69afff28bddd6d7626fa + docChecksum: 5e32c54953ba574d9ee698feec69132b docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.18 - configChecksum: a2b5416af2f6e419e890e700ebff85b2 + releaseVersion: 0.11.19 + configChecksum: 68995e9d0f9c16d2db0f9967edfb3af3 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 43c7e9de-e01c-454f-963f-fffefb852389 - pristine_commit_hash: 507fe1d22cb798a9ec68eac499ec65af7c93a995 - pristine_tree_hash: e7dc383135ed75f29c946b77f2965d61ec238f63 + generation_id: 1d141ee6-3f2d-4871-9848-c0b44ce3fc81 + pristine_commit_hash: 5d90a57f4c2fe856a5bdf25892ac7645ace722dc + pristine_tree_hash: 79eec5b9a9eebb656a47a973193134b0f2f61d67 features: python: acceptHeaders: 3.0.0 @@ -156,6 +156,30 @@ trackedFiles: id: 037d49b1a02c last_write_checksum: sha1:1ef65dad1b6f74dad67829f8b67d65da6144922b pristine_git_object: 95bf97c81f4b519b1abf0b8ef96d5344140ac182 + docs/components/agent.mdx: + id: a9ece83c3330 + last_write_checksum: sha1:6aa5ec348e98fe755fa241b09b94e9316f130a5a + pristine_git_object: d0300461c7036764ce02b5ad12748485406a018f + docs/components/agentmessageitem.mdx: + id: 207b0f2bd32f + last_write_checksum: sha1:11acb80bcbb86196a5fa991843bce2ffa8ce1f88 + pristine_git_object: f50b6f364c0b9deddd755f43d68af8f032bc8298 + docs/components/agentmessageitemcontentinputimage.mdx: + id: a491c3154b29 + last_write_checksum: sha1:ae00600fdb044ef6055b821ea9e1c6ed1984059e + pristine_git_object: 67e9a2411f1fb7ed3dd9d20900ea39cca3c90536 + docs/components/agentmessageitemcontentunion.mdx: + id: 1059ca11299e + last_write_checksum: sha1:772f5e3f8bd01d99bddc12160bf5e3b448bbf8a6 + pristine_git_object: 0ffa1e9e09f27fe2e3fa668316ee29271a6ce46c + docs/components/agentmessageitemdetail.mdx: + id: fe0d57b4e1d7 + last_write_checksum: sha1:3c38eb440eb62672a2543017bb57d2f9277ddbbc + pristine_git_object: 1e49ee6a692735eeaab980d66640a8212fb24152 + docs/components/agentmessageitemtypeinputimage.mdx: + id: d16eed88b27f + last_write_checksum: sha1:f1b71145d88842c0b61651b24f1b7245ece6620d + pristine_git_object: 4acb9c2305ede0ba0e6596e3c2b8d261ff24e12d docs/components/allowedtools.mdx: id: bc9b06183311 last_write_checksum: sha1:9b19ddb249037404d76b5c8f7cd8b40e20cf598d @@ -1146,8 +1170,8 @@ trackedFiles: pristine_git_object: 8a2adc33e4a201f48cc802d12dd0154dfa674aa9 docs/components/compactionitem.mdx: id: 26c52557072b - last_write_checksum: sha1:5d5e9a7ece815c6cc9aea6cb3b484e8d3a7e0321 - pristine_git_object: 7fb1a632309091019e4f2622225c07f926e42b1b + last_write_checksum: sha1:f8c0deb4eb10c507ec77d2be7669a96bb81c2a1b + pristine_git_object: 52161ac34082b508dbc5da7e8ec8a380ab813c99 docs/components/compactionitemtype.mdx: id: 688981b39855 last_write_checksum: sha1:70bb56c5e1b6352f709a63c98103e99c379fc86c @@ -1208,6 +1232,10 @@ trackedFiles: id: 1923f9db3cff last_write_checksum: sha1:59526732df9d4b5a69f3a79d1210493dff8d8898 pristine_git_object: 39acf3a7dc4de67d2eb07a4e21e33e6cfdd2091f + docs/components/contentencryptedcontent.mdx: + id: 0dc55809c394 + last_write_checksum: sha1:97675b67fb3cdb6c892bbe01d2cd9e6bab5e4dec + pristine_git_object: f6d3a51c9fa32b15dd589583fd07b835f76f0ecc docs/components/contentfilteraction.mdx: id: 11728ebb9679 last_write_checksum: sha1:c2e70a8136e1af5a9a0e2abd930e5cd3bdb880a1 @@ -1340,6 +1368,14 @@ trackedFiles: id: e53d83e87e2b last_write_checksum: sha1:22dd4ec3f699feb7d8f22abff79623b427292e35 pristine_git_object: c944724a99b7f7d4a9b5de4dc478f1e15643e20a + docs/components/contextcompactionitem.mdx: + id: 4e12480f54d6 + last_write_checksum: sha1:b3491d872cda856a3c9e338cf9121af0e68f1be0 + pristine_git_object: 4410f499ce362b79b38a3ea450e03913cfafc984 + docs/components/contextcompactionitemtype.mdx: + id: 393257938ed7 + last_write_checksum: sha1:28b03a5e14d3ab558cd6379fa25a4481e05e3016 + pristine_git_object: a8256a82a3cc87a83ac240f2bd3971b29af436cf docs/components/contextcompressionengine.mdx: id: 684ea7e73a30 last_write_checksum: sha1:b093510814e6d7a1911104a6a5911e789b689759 @@ -2434,8 +2470,8 @@ trackedFiles: pristine_git_object: 33aee92c61bf7ab9beded4e193f50a2c08462378 docs/components/inputsunion1.mdx: id: c216609d21ce - last_write_checksum: sha1:be2b2255aaaa200ee37b27ad64e428592f8065cd - pristine_git_object: be6efd1c3a0a797e8f00600fb2fb47fa00b4ddf4 + last_write_checksum: sha1:38d513739703efb245bb9c09606aacc35651ad92 + pristine_git_object: 2e56403330ecae1d43fd2e4d23976dfe5330c38d docs/components/inputtext.mdx: id: c8a97322a50a last_write_checksum: sha1:58653e40ea0a33629dda40d2a11c8d21a75b0467 @@ -4704,6 +4740,10 @@ trackedFiles: id: 6b8fbaf1abe6 last_write_checksum: sha1:a8d7df683cc00996868f4a8f16d43f5171f9786c pristine_git_object: 92220371000c3ec2476ecbeaccc4f095d25a997e + docs/components/typeagentmessage.mdx: + id: 806319bb3eee + last_write_checksum: sha1:486521730ba37bb9393665797e1f1cc775766874 + pristine_git_object: b03f1ab2115442904e357d6aee81e6656a6b6f15 docs/components/typeany.mdx: id: b3bd6b0de96e last_write_checksum: sha1:7d4c65b6740216e057d36ea498509249d9c97354 @@ -4744,6 +4784,10 @@ trackedFiles: id: 2107f66972cb last_write_checksum: sha1:47c1d819d31519b3d19a87f3389786d5c23206d4 pristine_git_object: 52ed7b166a48116cbd5a6f950a50f3f180c62a84 + docs/components/typeencryptedcontent.mdx: + id: 7e29de8a1874 + last_write_checksum: sha1:19b66fd2808ce791e8ec41203dd91bf1eeb9a996 + pristine_git_object: 62d36e211de192914adac3fd60dc58b52956f57a docs/components/typeexec.mdx: id: bdffae9225e9 last_write_checksum: sha1:adcee4778c3a095280c7e3541c1bfec21eba0139 @@ -6534,8 +6578,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:bb8d05c87d2fce01ba7ea9fe811425844624c6d6 - pristine_git_object: b9fecdcfb5971da6721e949608d09ca07d77307c + last_write_checksum: sha1:cbe4db46712b81214486e0f26d72f9384a264b7e + pristine_git_object: 9c5d4bfdf21ef61dcb7441889ce4f49cbdba7881 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6562,8 +6606,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:109693a9a2f8aaa8302f4a8c79ca80d9f736ed4f - pristine_git_object: 040c27279c9bd92aa793b82352d5b0b986c6faf9 + last_write_checksum: sha1:fac5e109f7e32666cc375872e0a411749b13533e + pristine_git_object: 085782e387bd5ce779b4220e2c549eb621a203f3 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6602,8 +6646,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:db6939dcf34a388b4111cb127e372fd434a437c0 - pristine_git_object: 2b758c9d3531925e091e70d3aeb1559ecfef10a2 + last_write_checksum: sha1:7da528c3b443bbc59febd9ba816c068802b8f5dd + pristine_git_object: 0aa62516217cf61492f33d953c54956fbfeb4124 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6636,6 +6680,10 @@ trackedFiles: id: 683887bb9db3 last_write_checksum: sha1:3a801b02cc92e02a00f0e26f377fb93a6893641a pristine_git_object: d92e19f8e9bec36933cd3e5d7ccc1690f14b168f + src/openrouter/components/agentmessageitem.py: + id: 6dbe0c8e2c79 + last_write_checksum: sha1:cdc92eac94cf3a35a412c95f894345c7a362afeb + pristine_git_object: 612d33983cd731ce83f33949fb2e9ab05b89f43b src/openrouter/components/annotationaddedevent.py: id: dc032c9ad744 last_write_checksum: sha1:8e5d49d2b57114df7f4559b611d40769e65f9f78 @@ -7122,8 +7170,8 @@ trackedFiles: pristine_git_object: ea86f79f7e10d7584621fb804ac56e7bb79578ba src/openrouter/components/compactionitem.py: id: f1535c3a68c3 - last_write_checksum: sha1:c344678bd27fea9bae0da60dae93aff484483a20 - pristine_git_object: 0c6d74912168fc04a0d756e9fac3b914e0ca6106 + last_write_checksum: sha1:877b1856696c67229c1f0bc9c39e98d79c11120f + pristine_git_object: fd2fa67f5ed2630c005e33123ec291065ee5b6ff src/openrouter/components/compoundfilter.py: id: 0cab72c7a3bc last_write_checksum: sha1:7bc0251dcf6c06f0fd00c9cadee2fa6a1e88ea82 @@ -7200,6 +7248,10 @@ trackedFiles: id: 2dbef15bd5df last_write_checksum: sha1:34ee6609ef4171a4d54b52e41b781970edcf8fa8 pristine_git_object: 50bdff02f1430696b08d5bb5dc38ba67704dad61 + src/openrouter/components/contextcompactionitem.py: + id: 0212b34610c0 + last_write_checksum: sha1:e4f65d722d166d4818afffe5a4d2e2756b810dba + pristine_git_object: 591e51c49354f87abbaaa20e6b7d9bdb10a2be69 src/openrouter/components/contextcompressionengine.py: id: a3965275d07f last_write_checksum: sha1:8aeacab427a9277db44ef731fd7a38a58752a64f @@ -7642,8 +7694,8 @@ trackedFiles: pristine_git_object: a3d84a96f4553a320f5eee5d63f6bc5c244ab446 src/openrouter/components/inputs_union.py: id: 17d6239cb6a7 - last_write_checksum: sha1:56b54bc88ad27ba75866fa7f548fa405650d689a - pristine_git_object: 138ccb8156df5fe2baa8b2b4b60dce353fd3cf7a + last_write_checksum: sha1:8f82753fd340ed60d3314a63e913500c3281d686 + pristine_git_object: 39681f4c16af7831a14dcccf7447e742c8a2b43b src/openrouter/components/inputtext.py: id: a995ae96be99 last_write_checksum: sha1:f78a6a35792b704f18ee6e1312c24f78f38cca36 @@ -10909,4 +10961,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem)` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[]` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 20ab2ae..fccd8e6 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.18 + version: 0.11.19 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 460cc29..cd49a8b 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -364,6 +364,72 @@ components: $ref: '#/components/schemas/AdvisorNestedTool' type: array type: object + AgentMessageItem: + additionalProperties: + nullable: true + description: A message routed between agents in a multi-agent session + example: + author: /root/worker + content: + - text: Task complete. + type: input_text + recipient: /root + type: agent_message + properties: + agent: + additionalProperties: + nullable: true + nullable: true + properties: + agent_name: + type: string + required: + - agent_name + type: object + author: + type: string + content: + items: + oneOf: + - $ref: '#/components/schemas/InputText' + - allOf: + - $ref: '#/components/schemas/InputImage' + - properties: {} + type: object + description: Image input content item + example: + detail: auto + image_url: https://example.com/image.jpg + type: input_image + - additionalProperties: + nullable: true + properties: + encrypted_content: + type: string + type: + enum: + - encrypted_content + type: string + required: + - type + - encrypted_content + type: object + type: array + id: + nullable: true + type: string + recipient: + type: string + type: + enum: + - agent_message + type: string + required: + - type + - author + - recipient + - content + type: object AnnotationAddedEvent: allOf: - $ref: '#/components/schemas/BaseAnnotationAddedEvent' @@ -5854,6 +5920,8 @@ components: - type type: object CompactionItem: + additionalProperties: + nullable: true description: A context compaction marker with encrypted summary example: encrypted_content: enc_abc123... @@ -6302,6 +6370,27 @@ components: - type - video_url type: object + ContextCompactionItem: + additionalProperties: + nullable: true + description: A context compaction marker with an optional encrypted summary + example: + encrypted_content: enc_abc123... + type: context_compaction + properties: + encrypted_content: + nullable: true + type: string + id: + nullable: true + type: string + type: + enum: + - context_compaction + type: string + required: + - type + type: object ContextCompressionEngine: description: The compression engine to use. Defaults to "middle-out". enum: @@ -10434,8 +10523,10 @@ components: - $ref: '#/components/schemas/CustomToolCallItem' - $ref: '#/components/schemas/CustomToolCallOutputItem' - $ref: '#/components/schemas/CompactionItem' + - $ref: '#/components/schemas/ContextCompactionItem' - $ref: '#/components/schemas/ItemReferenceItem' - $ref: '#/components/schemas/AdditionalToolsItem' + - $ref: '#/components/schemas/AgentMessageItem' type: array description: Input for a response request - can be a string or array of items example: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 1f1f0a0..c9ecd11 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:5d92f9e16b58b6867b6333b47544046d8179ed6ee1ce9b9d289a5f5fc9ac13bf - sourceBlobDigest: sha256:59fc773016c0c02fc04da6c9785ff6cf5b572b30f5d22095b14564f1c4ff958b + sourceRevisionDigest: sha256:046e876891ba57af72f3f26e8394a517ea258cecf8c2d8f885357e7796516f2d + sourceBlobDigest: sha256:a38421ec1aa0fb81cf260b96096fb44a9f31543b4b49d700280b2b58460671d1 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:5d92f9e16b58b6867b6333b47544046d8179ed6ee1ce9b9d289a5f5fc9ac13bf - sourceBlobDigest: sha256:59fc773016c0c02fc04da6c9785ff6cf5b572b30f5d22095b14564f1c4ff958b + sourceRevisionDigest: sha256:046e876891ba57af72f3f26e8394a517ea258cecf8c2d8f885357e7796516f2d + sourceBlobDigest: sha256:a38421ec1aa0fb81cf260b96096fb44a9f31543b4b49d700280b2b58460671d1 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:3770bb81a5566b8937f2c434e761c2a63e5c7f0507d7b3439ec0d1a87d53c673 + codeSamplesRevisionDigest: sha256:0eccbc2f8f6e176d5a67e24ec42aee8a70ef63fdf3da3c2a2fbb8b78587bfd8b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index e1fac37..127b4ff 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -288,4 +288,14 @@ Based on: ### Generated - [python v0.11.18] . ### Releases -- [PyPI v0.11.18] https://pypi.org/project/openrouter/0.11.18 - . \ No newline at end of file +- [PyPI v0.11.18] https://pypi.org/project/openrouter/0.11.18 - . + +## 2026-07-10 15:41:48 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.19] . +### Releases +- [PyPI v0.11.19] https://pypi.org/project/openrouter/0.11.19 - . \ No newline at end of file diff --git a/docs/components/agent.mdx b/docs/components/agent.mdx new file mode 100644 index 0000000..d030046 --- /dev/null +++ b/docs/components/agent.mdx @@ -0,0 +1,10 @@ +--- +title: "Agent" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `agent_name` | *str* | :heavy_check_mark: | N/A | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/agentmessageitem.mdx b/docs/components/agentmessageitem.mdx new file mode 100644 index 0000000..f50b6f3 --- /dev/null +++ b/docs/components/agentmessageitem.mdx @@ -0,0 +1,18 @@ +--- +title: "AgentMessageItem" +--- + +A message routed between agents in a multi-agent session + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `agent` | [OptionalNullable[components.Agent]](../components/agent.mdx) | :heavy_minus_sign: | N/A | | +| `author` | *str* | :heavy_check_mark: | N/A | | +| `content` | List[[components.AgentMessageItemContentUnion](../components/agentmessageitemcontentunion.mdx)] | :heavy_check_mark: | N/A | | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `recipient` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeAgentMessage](../components/typeagentmessage.mdx) | :heavy_check_mark: | N/A | | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \{
"author": "/root/worker",
"content": [
\{
"text": "Task complete.",
"type": "input_text"
}
],
"recipient": "/root",
"type": "agent_message"
} | \ No newline at end of file diff --git a/docs/components/agentmessageitemcontentinputimage.mdx b/docs/components/agentmessageitemcontentinputimage.mdx new file mode 100644 index 0000000..67e9a24 --- /dev/null +++ b/docs/components/agentmessageitemcontentinputimage.mdx @@ -0,0 +1,14 @@ +--- +title: "AgentMessageItemContentInputImage" +--- + +Image input content item + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `detail` | [components.AgentMessageItemDetail](../components/agentmessageitemdetail.mdx) | :heavy_check_mark: | N/A | +| `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `type` | [components.AgentMessageItemTypeInputImage](../components/agentmessageitemtypeinputimage.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/agentmessageitemcontentunion.mdx b/docs/components/agentmessageitemcontentunion.mdx new file mode 100644 index 0000000..0ffa1e9 --- /dev/null +++ b/docs/components/agentmessageitemcontentunion.mdx @@ -0,0 +1,24 @@ +--- +title: "AgentMessageItemContentUnion" +--- + +## Supported Types + +### `components.InputText` + +```python +value: components.InputText = /* values here */ +``` + +### `components.AgentMessageItemContentInputImage` + +```python +value: components.AgentMessageItemContentInputImage = /* values here */ +``` + +### `components.ContentEncryptedContent` + +```python +value: components.ContentEncryptedContent = /* values here */ +``` + diff --git a/docs/components/agentmessageitemdetail.mdx b/docs/components/agentmessageitemdetail.mdx new file mode 100644 index 0000000..1e49ee6 --- /dev/null +++ b/docs/components/agentmessageitemdetail.mdx @@ -0,0 +1,22 @@ +--- +title: "AgentMessageItemDetail" +--- + +## Example Usage + +```python +from openrouter.components import AgentMessageItemDetail + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: AgentMessageItemDetail = "auto" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"auto"` +- `"high"` +- `"low"` +- `"original"` diff --git a/docs/components/agentmessageitemtypeinputimage.mdx b/docs/components/agentmessageitemtypeinputimage.mdx new file mode 100644 index 0000000..4acb9c2 --- /dev/null +++ b/docs/components/agentmessageitemtypeinputimage.mdx @@ -0,0 +1,15 @@ +--- +title: "AgentMessageItemTypeInputImage" +--- + +## Example Usage + +```python +from openrouter.components import AgentMessageItemTypeInputImage +value: AgentMessageItemTypeInputImage = "input_image" +``` + + +## Values + +- `"input_image"` diff --git a/docs/components/compactionitem.mdx b/docs/components/compactionitem.mdx index 7fb1a63..52161ac 100644 --- a/docs/components/compactionitem.mdx +++ b/docs/components/compactionitem.mdx @@ -7,8 +7,9 @@ A context compaction marker with encrypted summary ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `encrypted_content` | *str* | :heavy_check_mark: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `type` | [components.CompactionItemType](../components/compactionitemtype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `encrypted_content` | *str* | :heavy_check_mark: | N/A | | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `type` | [components.CompactionItemType](../components/compactionitemtype.mdx) | :heavy_check_mark: | N/A | | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \{
"encrypted_content": "enc_abc123...",
"type": "compaction"
} | \ No newline at end of file diff --git a/docs/components/contentencryptedcontent.mdx b/docs/components/contentencryptedcontent.mdx new file mode 100644 index 0000000..f6d3a51 --- /dev/null +++ b/docs/components/contentencryptedcontent.mdx @@ -0,0 +1,11 @@ +--- +title: "ContentEncryptedContent" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `encrypted_content` | *str* | :heavy_check_mark: | N/A | +| `type` | [components.TypeEncryptedContent](../components/typeencryptedcontent.mdx) | :heavy_check_mark: | N/A | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/contextcompactionitem.mdx b/docs/components/contextcompactionitem.mdx new file mode 100644 index 0000000..4410f49 --- /dev/null +++ b/docs/components/contextcompactionitem.mdx @@ -0,0 +1,15 @@ +--- +title: "ContextCompactionItem" +--- + +A context compaction marker with an optional encrypted summary + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `encrypted_content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `type` | [components.ContextCompactionItemType](../components/contextcompactionitemtype.mdx) | :heavy_check_mark: | N/A | | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \{
"encrypted_content": "enc_abc123...",
"type": "context_compaction"
} | \ No newline at end of file diff --git a/docs/components/contextcompactionitemtype.mdx b/docs/components/contextcompactionitemtype.mdx new file mode 100644 index 0000000..a8256a8 --- /dev/null +++ b/docs/components/contextcompactionitemtype.mdx @@ -0,0 +1,15 @@ +--- +title: "ContextCompactionItemType" +--- + +## Example Usage + +```python +from openrouter.components import ContextCompactionItemType +value: ContextCompactionItemType = "context_compaction" +``` + + +## Values + +- `"context_compaction"` diff --git a/docs/components/inputsunion1.mdx b/docs/components/inputsunion1.mdx index be6efd1..2e56403 100644 --- a/docs/components/inputsunion1.mdx +++ b/docs/components/inputsunion1.mdx @@ -274,6 +274,12 @@ value: components.CustomToolCallOutputItem = /* values here */ value: components.CompactionItem = /* values here */ ``` +### `components.ContextCompactionItem` + +```python +value: components.ContextCompactionItem = /* values here */ +``` + ### `components.ItemReferenceItem` ```python @@ -286,3 +292,9 @@ value: components.ItemReferenceItem = /* values here */ value: components.AdditionalToolsItem = /* values here */ ``` +### `components.AgentMessageItem` + +```python +value: components.AgentMessageItem = /* values here */ +``` + diff --git a/docs/components/typeagentmessage.mdx b/docs/components/typeagentmessage.mdx new file mode 100644 index 0000000..b03f1ab --- /dev/null +++ b/docs/components/typeagentmessage.mdx @@ -0,0 +1,15 @@ +--- +title: "TypeAgentMessage" +--- + +## Example Usage + +```python +from openrouter.components import TypeAgentMessage +value: TypeAgentMessage = "agent_message" +``` + + +## Values + +- `"agent_message"` diff --git a/docs/components/typeencryptedcontent.mdx b/docs/components/typeencryptedcontent.mdx new file mode 100644 index 0000000..62d36e2 --- /dev/null +++ b/docs/components/typeencryptedcontent.mdx @@ -0,0 +1,15 @@ +--- +title: "TypeEncryptedContent" +--- + +## Example Usage + +```python +from openrouter.components import TypeEncryptedContent +value: TypeEncryptedContent = "encrypted_content" +``` + + +## Values + +- `"encrypted_content"` diff --git a/pyproject.toml b/pyproject.toml index b9fecdc..9c5d4bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.18" +version = "0.11.19" 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 040c272..085782e 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.18" +__version__: str = "0.11.19" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.18 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.19 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 2b758c9..0aa6251 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -36,6 +36,22 @@ if TYPE_CHECKING: AdvisorServerToolConfig, AdvisorServerToolConfigTypedDict, ) + from .agentmessageitem import ( + Agent, + AgentMessageItem, + AgentMessageItemContentInputImage, + AgentMessageItemContentInputImageTypedDict, + AgentMessageItemContentUnion, + AgentMessageItemContentUnionTypedDict, + AgentMessageItemDetail, + AgentMessageItemTypeInputImage, + AgentMessageItemTypedDict, + AgentTypedDict, + ContentEncryptedContent, + ContentEncryptedContentTypedDict, + TypeAgentMessage, + TypeEncryptedContent, + ) from .annotationaddedevent import ( AnnotationAddedEvent, AnnotationAddedEventType, @@ -711,6 +727,11 @@ if TYPE_CHECKING: VideoURL, VideoURLTypedDict, ) + from .contextcompactionitem import ( + ContextCompactionItem, + ContextCompactionItemType, + ContextCompactionItemTypedDict, + ) from .contextcompressionengine import ContextCompressionEngine from .contextcompressionplugin import ( ContextCompressionPlugin, @@ -2802,6 +2823,16 @@ __all__ = [ "AdvisorServerToolOpenRouter", "AdvisorServerToolOpenRouterType", "AdvisorServerToolOpenRouterTypedDict", + "Agent", + "AgentMessageItem", + "AgentMessageItemContentInputImage", + "AgentMessageItemContentInputImageTypedDict", + "AgentMessageItemContentUnion", + "AgentMessageItemContentUnionTypedDict", + "AgentMessageItemDetail", + "AgentMessageItemTypeInputImage", + "AgentMessageItemTypedDict", + "AgentTypedDict", "AllowedTools", "AllowedToolsTypedDict", "AllowedToolsUnion", @@ -3221,6 +3252,8 @@ __all__ = [ "ContainerTypedDict", "ContentCompaction", "ContentCompactionTypedDict", + "ContentEncryptedContent", + "ContentEncryptedContentTypedDict", "ContentFilterAction", "ContentFilterBuiltinAction", "ContentFilterBuiltinEntry", @@ -3276,6 +3309,9 @@ __all__ = [ "ContentWebSearchToolResultError", "ContentWebSearchToolResultErrorTypedDict", "ContentWebSearchToolResultTypedDict", + "ContextCompactionItem", + "ContextCompactionItemType", + "ContextCompactionItemTypedDict", "ContextCompressionEngine", "ContextCompressionPlugin", "ContextCompressionPluginID", @@ -4611,6 +4647,7 @@ __all__ = [ "TypeAdaptive", "TypeAdditionalTools", "TypeAdvisor20260301", + "TypeAgentMessage", "TypeAny", "TypeBash20250124", "TypeClearThinking20251015", @@ -4621,6 +4658,7 @@ __all__ = [ "TypeDisabled", "TypeDocument", "TypeEnabled", + "TypeEncryptedContent", "TypeExec", "TypeExit", "TypeFileSearch", @@ -4827,6 +4865,20 @@ _dynamic_imports: dict[str, str] = { "AdvisorServerToolOpenRouterTypedDict": ".advisorservertool_openrouter", "AdvisorServerToolConfig": ".advisorservertoolconfig", "AdvisorServerToolConfigTypedDict": ".advisorservertoolconfig", + "Agent": ".agentmessageitem", + "AgentMessageItem": ".agentmessageitem", + "AgentMessageItemContentInputImage": ".agentmessageitem", + "AgentMessageItemContentInputImageTypedDict": ".agentmessageitem", + "AgentMessageItemContentUnion": ".agentmessageitem", + "AgentMessageItemContentUnionTypedDict": ".agentmessageitem", + "AgentMessageItemDetail": ".agentmessageitem", + "AgentMessageItemTypeInputImage": ".agentmessageitem", + "AgentMessageItemTypedDict": ".agentmessageitem", + "AgentTypedDict": ".agentmessageitem", + "ContentEncryptedContent": ".agentmessageitem", + "ContentEncryptedContentTypedDict": ".agentmessageitem", + "TypeAgentMessage": ".agentmessageitem", + "TypeEncryptedContent": ".agentmessageitem", "AnnotationAddedEvent": ".annotationaddedevent", "AnnotationAddedEventType": ".annotationaddedevent", "AnnotationAddedEventTypedDict": ".annotationaddedevent", @@ -5290,6 +5342,9 @@ _dynamic_imports: dict[str, str] = { "ContentPartVideoTypedDict": ".contentpartvideo", "VideoURL": ".contentpartvideo", "VideoURLTypedDict": ".contentpartvideo", + "ContextCompactionItem": ".contextcompactionitem", + "ContextCompactionItemType": ".contextcompactionitem", + "ContextCompactionItemTypedDict": ".contextcompactionitem", "ContextCompressionEngine": ".contextcompressionengine", "ContextCompressionPlugin": ".contextcompressionplugin", "ContextCompressionPluginID": ".contextcompressionplugin", diff --git a/src/openrouter/components/agentmessageitem.py b/src/openrouter/components/agentmessageitem.py new file mode 100644 index 0000000..612d339 --- /dev/null +++ b/src/openrouter/components/agentmessageitem.py @@ -0,0 +1,213 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .inputtext import InputText, InputTextTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import get_discriminator +import pydantic +from pydantic import ConfigDict, Discriminator, Tag, model_serializer +from typing import Any, Dict, List, Literal, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class AgentTypedDict(TypedDict): + agent_name: str + + +class Agent(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + agent_name: str + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +TypeEncryptedContent = Literal["encrypted_content",] + + +class ContentEncryptedContentTypedDict(TypedDict): + encrypted_content: str + type: TypeEncryptedContent + + +class ContentEncryptedContent(BaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + encrypted_content: str + + type: TypeEncryptedContent + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + +AgentMessageItemDetail = Union[ + Literal[ + "auto", + "high", + "low", + "original", + ], + UnrecognizedStr, +] + + +AgentMessageItemTypeInputImage = Literal["input_image",] + + +class AgentMessageItemContentInputImageTypedDict(TypedDict): + r"""Image input content item""" + + detail: AgentMessageItemDetail + type: AgentMessageItemTypeInputImage + image_url: NotRequired[Nullable[str]] + + +class AgentMessageItemContentInputImage(BaseModel): + r"""Image input content item""" + + detail: AgentMessageItemDetail + + type: AgentMessageItemTypeInputImage + + image_url: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["image_url"]) + nullable_fields = set(["image_url"]) + 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 + + +AgentMessageItemContentUnionTypedDict = TypeAliasType( + "AgentMessageItemContentUnionTypedDict", + Union[ + InputTextTypedDict, + AgentMessageItemContentInputImageTypedDict, + ContentEncryptedContentTypedDict, + ], +) + + +AgentMessageItemContentUnion = Annotated[ + Union[ + Annotated[InputText, Tag("input_text")], + Annotated[AgentMessageItemContentInputImage, Tag("input_image")], + Annotated[ContentEncryptedContent, Tag("encrypted_content")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] + + +TypeAgentMessage = Literal["agent_message",] + + +class AgentMessageItemTypedDict(TypedDict): + r"""A message routed between agents in a multi-agent session""" + + author: str + content: List[AgentMessageItemContentUnionTypedDict] + recipient: str + type: TypeAgentMessage + agent: NotRequired[Nullable[AgentTypedDict]] + id: NotRequired[Nullable[str]] + + +class AgentMessageItem(BaseModel): + r"""A message routed between agents in a multi-agent session""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + author: str + + content: List[AgentMessageItemContentUnion] + + recipient: str + + type: TypeAgentMessage + + agent: OptionalNullable[Agent] = UNSET + + id: OptionalNullable[str] = UNSET + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["agent", "id"]) + nullable_fields = set(["agent", "id"]) + 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)) + serialized.pop(k, serialized.pop(n, None)) + 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 + for k, v in serialized.items(): + m[k] = v + + return m diff --git a/src/openrouter/components/compactionitem.py b/src/openrouter/components/compactionitem.py index 0c6d749..fd2fa67 100644 --- a/src/openrouter/components/compactionitem.py +++ b/src/openrouter/components/compactionitem.py @@ -8,8 +8,9 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from pydantic import model_serializer -from typing import Literal +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict, Literal from typing_extensions import NotRequired, TypedDict @@ -27,12 +28,25 @@ class CompactionItemTypedDict(TypedDict): class CompactionItem(BaseModel): r"""A context compaction marker with encrypted summary""" + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + encrypted_content: str type: CompactionItemType id: OptionalNullable[str] = UNSET + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["id"]) @@ -43,6 +57,7 @@ class CompactionItem(BaseModel): for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + serialized.pop(k, serialized.pop(n, None)) is_nullable_and_explicitly_set = ( k in nullable_fields and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member @@ -55,5 +70,7 @@ class CompactionItem(BaseModel): or is_nullable_and_explicitly_set ): m[k] = val + for k, v in serialized.items(): + m[k] = v return m diff --git a/src/openrouter/components/contextcompactionitem.py b/src/openrouter/components/contextcompactionitem.py new file mode 100644 index 0000000..591e51c --- /dev/null +++ b/src/openrouter/components/contextcompactionitem.py @@ -0,0 +1,76 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import ConfigDict, model_serializer +from typing import Any, Dict, Literal +from typing_extensions import NotRequired, TypedDict + + +ContextCompactionItemType = Literal["context_compaction",] + + +class ContextCompactionItemTypedDict(TypedDict): + r"""A context compaction marker with an optional encrypted summary""" + + type: ContextCompactionItemType + encrypted_content: NotRequired[Nullable[str]] + id: NotRequired[Nullable[str]] + + +class ContextCompactionItem(BaseModel): + r"""A context compaction marker with an optional encrypted summary""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + type: ContextCompactionItemType + + encrypted_content: OptionalNullable[str] = UNSET + + id: OptionalNullable[str] = UNSET + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["encrypted_content", "id"]) + nullable_fields = set(["encrypted_content", "id"]) + 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)) + serialized.pop(k, serialized.pop(n, None)) + 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 + for k, v in serialized.items(): + m[k] = v + + return m diff --git a/src/openrouter/components/inputs_union.py b/src/openrouter/components/inputs_union.py index 138ccb8..39681f4 100644 --- a/src/openrouter/components/inputs_union.py +++ b/src/openrouter/components/inputs_union.py @@ -2,12 +2,14 @@ from __future__ import annotations from .additionaltoolsitem import AdditionalToolsItem, AdditionalToolsItemTypedDict +from .agentmessageitem import AgentMessageItem, AgentMessageItemTypedDict from .applypatchcallitem import ApplyPatchCallItem, ApplyPatchCallItemTypedDict from .applypatchcalloutputitem import ( ApplyPatchCallOutputItem, ApplyPatchCallOutputItemTypedDict, ) from .compactionitem import CompactionItem, CompactionItemTypedDict +from .contextcompactionitem import ContextCompactionItem, ContextCompactionItemTypedDict from .customtoolcallitem import CustomToolCallItem, CustomToolCallItemTypedDict from .customtoolcalloutputitem import ( CustomToolCallOutputItem, @@ -376,50 +378,52 @@ InputsUnion1TypedDict = TypeAliasType( Union[ ItemReferenceItemTypedDict, CompactionItemTypedDict, + InputMessageItemTypedDict, AdditionalToolsItemTypedDict, - OutputImageGenerationCallItemTypedDict, + EasyInputMessageTypedDict, + ContextCompactionItemTypedDict, + OutputWebSearchServerToolItemTypedDict, + CustomToolCallOutputItemTypedDict, LocalShellCallOutputItemTypedDict, OutputToolSearchServerToolItemTypedDict, OutputFileSearchServerToolItemTypedDict, - CustomToolCallOutputItemTypedDict, - InputMessageItemTypedDict, - EasyInputMessageTypedDict, - OutputWebSearchServerToolItemTypedDict, OutputWebSearchCallItemTypedDict, OutputFileSearchCallItemTypedDict, - OutputDatetimeItemTypedDict, + OutputImageGenerationCallItemTypedDict, OutputApplyPatchServerToolItemTypedDict, - FunctionCallOutputItemTypedDict, - LocalShellCallItemTypedDict, - McpListToolsItemTypedDict, - OutputSearchModelsServerToolItemTypedDict, - ApplyPatchCallOutputItemTypedDict, - OutputMcpServerToolItemTypedDict, - OutputBrowserUseServerToolItemTypedDict, - McpApprovalResponseItemTypedDict, - OutputTextEditorServerToolItemTypedDict, - ApplyPatchCallItemTypedDict, McpApprovalRequestItemTypedDict, - OutputCodeInterpreterCallItemTypedDict, - OutputMemoryServerToolItemTypedDict, + OutputDatetimeItemTypedDict, + FunctionCallOutputItemTypedDict, + ApplyPatchCallItemTypedDict, + ApplyPatchCallOutputItemTypedDict, + McpApprovalResponseItemTypedDict, + OutputBrowserUseServerToolItemTypedDict, + McpListToolsItemTypedDict, + OutputTextEditorServerToolItemTypedDict, + LocalShellCallItemTypedDict, + OutputSearchModelsServerToolItemTypedDict, + OutputMcpServerToolItemTypedDict, CustomToolCallItemTypedDict, - InputsMessageTypedDict, - OutputCustomToolCallItemTypedDict, - ShellCallOutputItemTypedDict, - ShellCallItemTypedDict, OutputComputerCallItemTypedDict, + OutputCodeInterpreterCallItemTypedDict, + OutputCustomToolCallItemTypedDict, + InputsMessageTypedDict, + OutputMemoryServerToolItemTypedDict, + ShellCallItemTypedDict, + ShellCallOutputItemTypedDict, OutputBashServerToolItemTypedDict, McpCallItemTypedDict, - OutputImageGenerationServerToolItemTypedDict, OutputFunctionCallItemTypedDict, + AgentMessageItemTypedDict, FunctionCallItemTypedDict, - OutputFilesServerToolItemTypedDict, + OutputImageGenerationServerToolItemTypedDict, OutputSubagentServerToolItemTypedDict, - OutputAdvisorServerToolItemTypedDict, - OutputWebFetchServerToolItemTypedDict, - ReasoningItemTypedDict, - OutputCodeInterpreterServerToolItemTypedDict, InputsReasoningTypedDict, + OutputAdvisorServerToolItemTypedDict, + OutputCodeInterpreterServerToolItemTypedDict, + OutputWebFetchServerToolItemTypedDict, + OutputFilesServerToolItemTypedDict, + ReasoningItemTypedDict, OutputFusionServerToolItemTypedDict, ], ) @@ -430,50 +434,52 @@ InputsUnion1 = TypeAliasType( Union[ ItemReferenceItem, CompactionItem, + InputMessageItem, AdditionalToolsItem, - OutputImageGenerationCallItem, + EasyInputMessage, + ContextCompactionItem, + OutputWebSearchServerToolItem, + CustomToolCallOutputItem, LocalShellCallOutputItem, OutputToolSearchServerToolItem, OutputFileSearchServerToolItem, - CustomToolCallOutputItem, - InputMessageItem, - EasyInputMessage, - OutputWebSearchServerToolItem, OutputWebSearchCallItem, OutputFileSearchCallItem, - OutputDatetimeItem, + OutputImageGenerationCallItem, OutputApplyPatchServerToolItem, - FunctionCallOutputItem, - LocalShellCallItem, - McpListToolsItem, - OutputSearchModelsServerToolItem, - ApplyPatchCallOutputItem, - OutputMcpServerToolItem, - OutputBrowserUseServerToolItem, - McpApprovalResponseItem, - OutputTextEditorServerToolItem, - ApplyPatchCallItem, McpApprovalRequestItem, - OutputCodeInterpreterCallItem, - OutputMemoryServerToolItem, + OutputDatetimeItem, + FunctionCallOutputItem, + ApplyPatchCallItem, + ApplyPatchCallOutputItem, + McpApprovalResponseItem, + OutputBrowserUseServerToolItem, + McpListToolsItem, + OutputTextEditorServerToolItem, + LocalShellCallItem, + OutputSearchModelsServerToolItem, + OutputMcpServerToolItem, CustomToolCallItem, - InputsMessage, - OutputCustomToolCallItem, - ShellCallOutputItem, - ShellCallItem, OutputComputerCallItem, + OutputCodeInterpreterCallItem, + OutputCustomToolCallItem, + InputsMessage, + OutputMemoryServerToolItem, + ShellCallItem, + ShellCallOutputItem, OutputBashServerToolItem, McpCallItem, - OutputImageGenerationServerToolItem, OutputFunctionCallItem, + AgentMessageItem, FunctionCallItem, - OutputFilesServerToolItem, + OutputImageGenerationServerToolItem, OutputSubagentServerToolItem, - OutputAdvisorServerToolItem, - OutputWebFetchServerToolItem, - ReasoningItem, - OutputCodeInterpreterServerToolItem, InputsReasoning, + OutputAdvisorServerToolItem, + OutputCodeInterpreterServerToolItem, + OutputWebFetchServerToolItem, + OutputFilesServerToolItem, + ReasoningItem, OutputFusionServerToolItem, ], ) diff --git a/uv.lock b/uv.lock index 61e791f..405c5a6 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.18" +version = "0.11.19" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 64ad023f725adca29c7efdc376d36afd95647a2a Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 20:13:35 +0000 Subject: [PATCH 35/62] chore: update OpenAPI spec from monorepo (#427) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 81 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 0fea2ab..f5f9352 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -24074,6 +24074,87 @@ paths: start: '2025-01-01T00:00:00Z' schema: properties: + classifier_dimensions: + description: >- + Group results by custom classifier tags, breaking down metrics by the specified dimension values. + Requires an active classifier on the workspace. + properties: + classifier_id: + description: UUID of the classifier whose tags to group by. + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + dimension_names: + items: + description: >- + Classifier dimension name (snake_case identifier). When exactly one name is provided, the + response uses it as the column key; with multiple names or none, the response uses + `clf_dimension_name`/`clf_dimension_value` columns. + example: department + type: string + maxItems: 10 + type: array + include_nulls: + description: >- + When true, also include generations that have no tag from this classifier. Defaults to false, + which returns only classified generations. + type: boolean + required: + - classifier_id + type: object + classifier_filters: + description: >- + Filter results to generations with specific classifier tag values. Can be combined with + classifier_dimensions (must use the same classifier_id) or used independently with standard + dimensions. + properties: + classifier_id: + description: >- + UUID of the classifier whose tags to filter by. Must match classifier_dimensions.classifier_id + when both are specified. + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + filters: + items: + properties: + field: + description: >- + Classifier dimension name to filter on (snake_case identifier, e.g. "department", + "work_type"). + example: department + type: string + operator: + description: >- + Filter operator. Only equality/set operators are supported (eq, neq, in, not_in) — ordered + comparisons are not available because classification values are strings. + example: eq + type: string + value: + anyOf: + - type: string + - format: double + type: number + - items: + anyOf: + - type: string + - format: double + type: number + type: array + description: Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in. + example: Engineering + required: + - field + - operator + - value + type: object + maxItems: 10 + minItems: 1 + type: array + required: + - classifier_id + - filters + type: object dimensions: items: description: Dimension to group by (up to 2). Use the /meta endpoint for available dimensions. From 02a24c5cae43932b4a9ec2a54fc87addc22acf83 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 20:19:22 +0000 Subject: [PATCH 36/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.20=20(#428)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 64 +++++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 72 ++++++++++++ .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/operations/classifierdimensions.mdx | 14 +++ docs/operations/classifierfilters.mdx | 13 +++ docs/operations/classifierfiltersfilter.mdx | 11 ++ docs/operations/classifierfiltersvalue.mdx | 27 +++++ docs/operations/queryanalyticsrequestbody.mdx | 2 + docs/operations/valueclassifierfilters.mdx | 18 +++ docs/sdks/betaanalytics/README.mdx | 2 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/beta_analytics.py | 34 ++++++ src/openrouter/operations/__init__.py | 30 +++++ src/openrouter/operations/queryanalytics.py | 108 ++++++++++++++++++ uv.lock | 2 +- 18 files changed, 395 insertions(+), 32 deletions(-) create mode 100644 docs/operations/classifierdimensions.mdx create mode 100644 docs/operations/classifierfilters.mdx create mode 100644 docs/operations/classifierfiltersfilter.mdx create mode 100644 docs/operations/classifierfiltersvalue.mdx create mode 100644 docs/operations/valueclassifierfilters.mdx diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 5b24086..0f009fa 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: 5e32c54953ba574d9ee698feec69132b + docChecksum: eafdf0a15ea851c11321f795d9eaeae6 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.19 - configChecksum: 68995e9d0f9c16d2db0f9967edfb3af3 + releaseVersion: 0.11.20 + configChecksum: 5415321126f7b1b42de92ec1c213d0d4 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 1d141ee6-3f2d-4871-9848-c0b44ce3fc81 - pristine_commit_hash: 5d90a57f4c2fe856a5bdf25892ac7645ace722dc - pristine_tree_hash: 79eec5b9a9eebb656a47a973193134b0f2f61d67 + generation_id: 11b03c28-423b-4cf5-8a75-334f53189839 + pristine_commit_hash: 78f9f7be2b502d7c7b11ec27fd701fa26a7834b2 + pristine_tree_hash: a0a6f9597055f659340cba4c2f03acf2a76d857a features: python: acceptHeaders: 3.0.0 @@ -5312,6 +5312,22 @@ trackedFiles: id: db4a10e02011 last_write_checksum: sha1:07a2b233999d732b3559f431337d40cbfb8acb18 pristine_git_object: de22a4c7b44e291012ca85daacc77bde58afbfa4 + docs/operations/classifierdimensions.mdx: + id: 5e48dede0ae4 + last_write_checksum: sha1:9aea7af347af4565daaebcfced2f96f8957dfd1a + pristine_git_object: f7cf34faf7a89ceaeb2c20f9fd37f76e102defba + docs/operations/classifierfilters.mdx: + id: bf2b4d539ad0 + last_write_checksum: sha1:882166611599b6921a6ec342986fe18bf78cf524 + pristine_git_object: db4dbe946e875ad7189725a020f7ea2631a8adf3 + docs/operations/classifierfiltersfilter.mdx: + id: 4c60b258249e + last_write_checksum: sha1:98efc2e7262b521d268dd591b08cb90a3406fabc + pristine_git_object: f09e983a0daa403ee6d2cfca1604906f44a42ee2 + docs/operations/classifierfiltersvalue.mdx: + id: 0701a4bb73c4 + last_write_checksum: sha1:077df057506e544243ecc2e6ab055cadee049035 + pristine_git_object: 47e7dc4e537b1c7392c04f36a7c6c8f45847ee29 docs/operations/content.mdx: id: 6f64feb2d798 last_write_checksum: sha1:329d9719c9e25478666963df7b79710aa626d988 @@ -6286,8 +6302,8 @@ trackedFiles: pristine_git_object: 5b3c7c98d8cee9aa77138996c3d9af3e2bd3127a docs/operations/queryanalyticsrequestbody.mdx: id: 1b8d33b6ac1b - last_write_checksum: sha1:bd5e4998875dd2b73f5b04749ae013f108119a50 - pristine_git_object: 79876b7e840eb330cecb69b748c1dc80bbb7d14e + last_write_checksum: sha1:b100dcb3db6adf543fddf53977874d3d793c99b4 + pristine_git_object: ceec61fa2f3ad3a903475827003f6b4bbfd771c8 docs/operations/queryanalyticsresponse.mdx: id: 26c4b637ce33 last_write_checksum: sha1:3f778b3125815a89ceae9aaa735ffc846fef3de8 @@ -6452,6 +6468,10 @@ trackedFiles: id: ebf32fddf22e last_write_checksum: sha1:18f440dbfdcb2498771fe53a98b054d4d76f283c pristine_git_object: f72dd54a6f1db3e758a924691b07ec17f38bc01e + docs/operations/valueclassifierfilters.mdx: + id: 258cd046e559 + last_write_checksum: sha1:013f0a03f199fa6d2b2a256acd8af403fdd51c5a + pristine_git_object: 9280541b880980bbf528c00ea7c3eb3cc7b4f54c docs/operations/valuetype.mdx: id: 29a8210305d2 last_write_checksum: sha1:5ea5c9a100089970356c552e3d9792c6657d0143 @@ -6478,8 +6498,8 @@ trackedFiles: pristine_git_object: 072d78b5b5aedcdc34724557e76cc0fa03994fba docs/sdks/betaanalytics/README.mdx: id: 239279ebf01b - last_write_checksum: sha1:721b90a76008fa9876ce046a84a7b54bae0dcef8 - pristine_git_object: 716e4631b3b48e11081ed70ca5acc5826b8a6383 + last_write_checksum: sha1:5a76d28d77f68efe34ebbcb72850e6a87c74d3b1 + pristine_git_object: 6e4b06ff97f02da5d31d78f478094db32dfdaa6f docs/sdks/byok/README.mdx: id: 17792f3b180d last_write_checksum: sha1:18692d1b1454837b1592113fe1aaba1b1d37a805 @@ -6578,8 +6598,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:cbe4db46712b81214486e0f26d72f9384a264b7e - pristine_git_object: 9c5d4bfdf21ef61dcb7441889ce4f49cbdba7881 + last_write_checksum: sha1:8914993a8cce928e2718682d649405beb44a32de + pristine_git_object: 91166b893131a18020578ab19889176d7a128370 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6606,8 +6626,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:fac5e109f7e32666cc375872e0a411749b13533e - pristine_git_object: 085782e387bd5ce779b4220e2c549eb621a203f3 + last_write_checksum: sha1:2c94535d48a1494c22eff12e1255c7528b1aa324 + pristine_git_object: f5a0e56d914e266d29449c5d3e1a7ec635f26424 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6630,8 +6650,8 @@ trackedFiles: pristine_git_object: 9c02cc64163adf027507af763e7b612d3b704adb src/openrouter/beta_analytics.py: id: 81988b170188 - last_write_checksum: sha1:91cc3d033be8ad49f3d2a67e9dd1ead470c4016f - pristine_git_object: bcf5829eba6df16f8984b756a46c8836b799dc98 + last_write_checksum: sha1:517ca1b0d4b94343e7728f156230e653f43c4641 + pristine_git_object: 1b01f0c081ffc8a42fa56d335f95ec3121e4b5e6 src/openrouter/byok.py: id: bec352462ae1 last_write_checksum: sha1:14ffff34cdb97e81dd5ef9d7ba0f105b09b7ba48 @@ -8982,8 +9002,8 @@ trackedFiles: pristine_git_object: a1dea9b45650cc42a6f60447c032fa46b102839a src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:23cba14efcf42e3a94779c6c259362a6f8a97deb - pristine_git_object: 3ee6fd4deecd7fcc382a5256db8e43c6f7e719ca + last_write_checksum: sha1:d5a5875a32fab4fc32e68a7c4036483701797944 + pristine_git_object: 134f9b320535b89c7904427ca69322f9507e7ac2 src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -9298,8 +9318,8 @@ trackedFiles: pristine_git_object: a242ff323f23dfadad254b76440114e66db4e744 src/openrouter/operations/queryanalytics.py: id: d76c63ff66f6 - last_write_checksum: sha1:7866c71f371c0dbf9e1cda9be336bbf1d0e30ac5 - pristine_git_object: 705a3eaf0ce3e1b7cc9af6f96dbbed4fe0f67f50 + last_write_checksum: sha1:b184adfb9d438f443c1fd6c4e749aff3188e9496 + pristine_git_object: 23f2f9398884b3ab38b7e3ade20cafee40dc97f3 src/openrouter/operations/sendchatcompletionrequest.py: id: d9fee71bb577 last_write_checksum: sha1:0cba4011b8e305270ac30f88cb7ab59b6aefe619 @@ -10961,4 +10981,6 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[]` **Changed**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[]` **Changed**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.beta.analytics.query_analytics()`: `request` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index fccd8e6..ba5806d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.19 + version: 0.11.20 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index cd49a8b..5cf1144 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -23893,6 +23893,78 @@ paths: start: '2025-01-01T00:00:00Z' schema: properties: + classifier_dimensions: + description: >- + Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. + properties: + classifier_id: + description: UUID of the classifier whose tags to group by. + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + dimension_names: + items: + description: >- + Classifier dimension name (snake_case identifier). When exactly one name is provided, the response uses it as the column key; with multiple names or none, the response uses `clf_dimension_name`/`clf_dimension_value` columns. + example: department + type: string + maxItems: 10 + type: array + include_nulls: + description: >- + When true, also include generations that have no tag from this classifier. Defaults to false, which returns only classified generations. + type: boolean + required: + - classifier_id + type: object + classifier_filters: + description: >- + Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. + properties: + classifier_id: + description: >- + UUID of the classifier whose tags to filter by. Must match classifier_dimensions.classifier_id when both are specified. + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + filters: + items: + properties: + field: + description: >- + Classifier dimension name to filter on (snake_case identifier, e.g. "department", "work_type"). + example: department + type: string + operator: + description: >- + Filter operator. Only equality/set operators are supported (eq, neq, in, not_in) — ordered comparisons are not available because classification values are strings. + example: eq + type: string + value: + anyOf: + - type: string + - format: double + type: number + - items: + anyOf: + - type: string + - format: double + type: number + type: array + description: Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in. + example: Engineering + required: + - field + - operator + - value + type: object + maxItems: 10 + minItems: 1 + type: array + required: + - classifier_id + - filters + type: object dimensions: items: description: Dimension to group by (up to 2). Use the /meta endpoint for available dimensions. diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index c9ecd11..c41786d 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:046e876891ba57af72f3f26e8394a517ea258cecf8c2d8f885357e7796516f2d - sourceBlobDigest: sha256:a38421ec1aa0fb81cf260b96096fb44a9f31543b4b49d700280b2b58460671d1 + sourceRevisionDigest: sha256:0244558823b6088d1e3032984eebb7034080c88012d9246accc6d9e62ff608e2 + sourceBlobDigest: sha256:639b41e906b5ebc304974d4516f56048e8243c71765c59435484287dad1a05ac tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:046e876891ba57af72f3f26e8394a517ea258cecf8c2d8f885357e7796516f2d - sourceBlobDigest: sha256:a38421ec1aa0fb81cf260b96096fb44a9f31543b4b49d700280b2b58460671d1 + sourceRevisionDigest: sha256:0244558823b6088d1e3032984eebb7034080c88012d9246accc6d9e62ff608e2 + sourceBlobDigest: sha256:639b41e906b5ebc304974d4516f56048e8243c71765c59435484287dad1a05ac codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:0eccbc2f8f6e176d5a67e24ec42aee8a70ef63fdf3da3c2a2fbb8b78587bfd8b + codeSamplesRevisionDigest: sha256:a012a1304c56f93a4aeaea74f847db642667113fb8489a88981091d34fc6e4ab workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 127b4ff..f2ca288 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -298,4 +298,14 @@ Based on: ### Generated - [python v0.11.19] . ### Releases -- [PyPI v0.11.19] https://pypi.org/project/openrouter/0.11.19 - . \ No newline at end of file +- [PyPI v0.11.19] https://pypi.org/project/openrouter/0.11.19 - . + +## 2026-07-10 20:14:59 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.20] . +### Releases +- [PyPI v0.11.20] https://pypi.org/project/openrouter/0.11.20 - . \ No newline at end of file diff --git a/docs/operations/classifierdimensions.mdx b/docs/operations/classifierdimensions.mdx new file mode 100644 index 0000000..f7cf34f --- /dev/null +++ b/docs/operations/classifierdimensions.mdx @@ -0,0 +1,14 @@ +--- +title: "ClassifierDimensions" +--- + +Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `classifier_id` | *str* | :heavy_check_mark: | UUID of the classifier whose tags to group by. | 550e8400-e29b-41d4-a716-446655440000 | +| `dimension_names` | List[*str*] | :heavy_minus_sign: | N/A | | +| `include_nulls` | *Optional[bool]* | :heavy_minus_sign: | When true, also include generations that have no tag from this classifier. Defaults to false, which returns only classified generations. | | \ No newline at end of file diff --git a/docs/operations/classifierfilters.mdx b/docs/operations/classifierfilters.mdx new file mode 100644 index 0000000..db4dbe9 --- /dev/null +++ b/docs/operations/classifierfilters.mdx @@ -0,0 +1,13 @@ +--- +title: "ClassifierFilters" +--- + +Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `classifier_id` | *str* | :heavy_check_mark: | UUID of the classifier whose tags to filter by. Must match classifier_dimensions.classifier_id when both are specified. | 550e8400-e29b-41d4-a716-446655440000 | +| `filters` | List[[operations.ClassifierFiltersFilter](../operations/classifierfiltersfilter.mdx)] | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/operations/classifierfiltersfilter.mdx b/docs/operations/classifierfiltersfilter.mdx new file mode 100644 index 0000000..f09e983 --- /dev/null +++ b/docs/operations/classifierfiltersfilter.mdx @@ -0,0 +1,11 @@ +--- +title: "ClassifierFiltersFilter" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `field` | *str* | :heavy_check_mark: | Classifier dimension name to filter on (snake_case identifier, e.g. "department", "work_type"). | department | +| `operator` | *str* | :heavy_check_mark: | Filter operator. Only equality/set operators are supported (eq, neq, in, not_in) — ordered comparisons are not available because classification values are strings. | eq | +| `value` | [operations.ClassifierFiltersValue](../operations/classifierfiltersvalue.mdx) | :heavy_check_mark: | Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in. | Engineering | \ No newline at end of file diff --git a/docs/operations/classifierfiltersvalue.mdx b/docs/operations/classifierfiltersvalue.mdx new file mode 100644 index 0000000..47e7dc4 --- /dev/null +++ b/docs/operations/classifierfiltersvalue.mdx @@ -0,0 +1,27 @@ +--- +title: "ClassifierFiltersValue" +--- + +Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `float` + +```python +value: float = /* values here */ +``` + +### `List[operations.ValueClassifierFilters]` + +```python +value: List[operations.ValueClassifierFilters] = /* values here */ +``` + diff --git a/docs/operations/queryanalyticsrequestbody.mdx b/docs/operations/queryanalyticsrequestbody.mdx index 79876b7..ceec61f 100644 --- a/docs/operations/queryanalyticsrequestbody.mdx +++ b/docs/operations/queryanalyticsrequestbody.mdx @@ -6,6 +6,8 @@ title: "QueryAnalyticsRequestBody" | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `classifier_dimensions` | [Optional[operations.ClassifierDimensions]](../operations/classifierdimensions.mdx) | :heavy_minus_sign: | Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. | | +| `classifier_filters` | [Optional[operations.ClassifierFilters]](../operations/classifierfilters.mdx) | :heavy_minus_sign: | Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. | | | `dimensions` | List[*str*] | :heavy_minus_sign: | N/A | | | `filters` | List[[operations.Filter](../operations/filter_.mdx)] | :heavy_minus_sign: | N/A | | | `granularity` | *Optional[str]* | :heavy_minus_sign: | Time granularity | day | diff --git a/docs/operations/valueclassifierfilters.mdx b/docs/operations/valueclassifierfilters.mdx new file mode 100644 index 0000000..9280541 --- /dev/null +++ b/docs/operations/valueclassifierfilters.mdx @@ -0,0 +1,18 @@ +--- +title: "ValueClassifierFilters" +--- + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `float` + +```python +value: float = /* values here */ +``` + diff --git a/docs/sdks/betaanalytics/README.mdx b/docs/sdks/betaanalytics/README.mdx index 716e463..6e4b06f 100644 --- a/docs/sdks/betaanalytics/README.mdx +++ b/docs/sdks/betaanalytics/README.mdx @@ -100,6 +100,8 @@ with OpenRouter( | `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.
| | +| `classifier_dimensions` | [Optional[operations.ClassifierDimensions]](../../operations/classifierdimensions.mdx) | :heavy_minus_sign: | Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. | | +| `classifier_filters` | [Optional[operations.ClassifierFilters]](../../operations/classifierfilters.mdx) | :heavy_minus_sign: | Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. | | | `dimensions` | List[*str*] | :heavy_minus_sign: | N/A | | | `filters` | List[[operations.Filter](../../operations/filter_.mdx)] | :heavy_minus_sign: | N/A | | | `granularity` | *Optional[str]* | :heavy_minus_sign: | Time granularity | day | diff --git a/pyproject.toml b/pyproject.toml index 9c5d4bf..91166b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.19" +version = "0.11.20" 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 085782e..f5a0e56 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.19" +__version__: str = "0.11.20" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.19 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.20 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/beta_analytics.py b/src/openrouter/beta_analytics.py index bcf5829..1b01f0c 100644 --- a/src/openrouter/beta_analytics.py +++ b/src/openrouter/beta_analytics.py @@ -273,6 +273,15 @@ class BetaAnalytics(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + classifier_dimensions: Optional[ + Union[ + operations.ClassifierDimensions, + operations.ClassifierDimensionsTypedDict, + ] + ] = None, + classifier_filters: Optional[ + Union[operations.ClassifierFilters, operations.ClassifierFiltersTypedDict] + ] = None, dimensions: Optional[Iterable[str]] = None, filters: Optional[ Union[Iterable[operations.Filter], Iterable[operations.FilterTypedDict]] @@ -303,6 +312,8 @@ class BetaAnalytics(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param classifier_dimensions: Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. + :param classifier_filters: Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. :param dimensions: :param filters: :param granularity: Time granularity @@ -330,6 +341,12 @@ class BetaAnalytics(BaseSDK): x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, request_body=operations.QueryAnalyticsRequestBody( + classifier_dimensions=utils.get_pydantic_model( + classifier_dimensions, Optional[operations.ClassifierDimensions] + ), + classifier_filters=utils.get_pydantic_model( + classifier_filters, Optional[operations.ClassifierFilters] + ), dimensions=utils.unmarshal(dimensions, Optional[List[str]]), filters=utils.get_pydantic_model( filters, Optional[List[operations.Filter]] @@ -453,6 +470,15 @@ class BetaAnalytics(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + classifier_dimensions: Optional[ + Union[ + operations.ClassifierDimensions, + operations.ClassifierDimensionsTypedDict, + ] + ] = None, + classifier_filters: Optional[ + Union[operations.ClassifierFilters, operations.ClassifierFiltersTypedDict] + ] = None, dimensions: Optional[Iterable[str]] = None, filters: Optional[ Union[Iterable[operations.Filter], Iterable[operations.FilterTypedDict]] @@ -483,6 +509,8 @@ class BetaAnalytics(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + :param classifier_dimensions: Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace. + :param classifier_filters: Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions. :param dimensions: :param filters: :param granularity: Time granularity @@ -510,6 +538,12 @@ class BetaAnalytics(BaseSDK): x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, request_body=operations.QueryAnalyticsRequestBody( + classifier_dimensions=utils.get_pydantic_model( + classifier_dimensions, Optional[operations.ClassifierDimensions] + ), + classifier_filters=utils.get_pydantic_model( + classifier_filters, Optional[operations.ClassifierFilters] + ), dimensions=utils.unmarshal(dimensions, Optional[List[str]]), filters=utils.get_pydantic_model( filters, Optional[List[operations.Filter]] diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 3ee6fd4..134f9b3 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -652,6 +652,14 @@ if TYPE_CHECKING: ListWorkspacesResponseTypedDict, ) from .queryanalytics import ( + ClassifierDimensions, + ClassifierDimensionsTypedDict, + ClassifierFilters, + ClassifierFiltersFilter, + ClassifierFiltersFilterTypedDict, + ClassifierFiltersTypedDict, + ClassifierFiltersValue, + ClassifierFiltersValueTypedDict, Direction, Filter, FilterTypedDict, @@ -677,6 +685,8 @@ if TYPE_CHECKING: Value1TypedDict, Value2, Value2TypedDict, + ValueClassifierFilters, + ValueClassifierFiltersTypedDict, ) from .sendchatcompletionrequest import ( SendChatCompletionRequestGlobals, @@ -772,6 +782,14 @@ __all__ = [ "BulkUnassignMembersFromGuardrailGlobalsTypedDict", "BulkUnassignMembersFromGuardrailRequest", "BulkUnassignMembersFromGuardrailRequestTypedDict", + "ClassifierDimensions", + "ClassifierDimensionsTypedDict", + "ClassifierFilters", + "ClassifierFiltersFilter", + "ClassifierFiltersFilterTypedDict", + "ClassifierFiltersTypedDict", + "ClassifierFiltersValue", + "ClassifierFiltersValueTypedDict", "Content", "ContentImageURL", "ContentImageURLTypedDict", @@ -1308,6 +1326,8 @@ __all__ = [ "Value1TypedDict", "Value2", "Value2TypedDict", + "ValueClassifierFilters", + "ValueClassifierFiltersTypedDict", "ValueType", "Window", "Zdr", @@ -1804,6 +1824,14 @@ _dynamic_imports: dict[str, str] = { "ListWorkspacesRequestTypedDict": ".listworkspaces", "ListWorkspacesResponse": ".listworkspaces", "ListWorkspacesResponseTypedDict": ".listworkspaces", + "ClassifierDimensions": ".queryanalytics", + "ClassifierDimensionsTypedDict": ".queryanalytics", + "ClassifierFilters": ".queryanalytics", + "ClassifierFiltersFilter": ".queryanalytics", + "ClassifierFiltersFilterTypedDict": ".queryanalytics", + "ClassifierFiltersTypedDict": ".queryanalytics", + "ClassifierFiltersValue": ".queryanalytics", + "ClassifierFiltersValueTypedDict": ".queryanalytics", "Direction": ".queryanalytics", "Filter": ".queryanalytics", "FilterTypedDict": ".queryanalytics", @@ -1829,6 +1857,8 @@ _dynamic_imports: dict[str, str] = { "Value1TypedDict": ".queryanalytics", "Value2": ".queryanalytics", "Value2TypedDict": ".queryanalytics", + "ValueClassifierFilters": ".queryanalytics", + "ValueClassifierFiltersTypedDict": ".queryanalytics", "SendChatCompletionRequestGlobals": ".sendchatcompletionrequest", "SendChatCompletionRequestGlobalsTypedDict": ".sendchatcompletionrequest", "SendChatCompletionRequestRequest": ".sendchatcompletionrequest", diff --git a/src/openrouter/operations/queryanalytics.py b/src/openrouter/operations/queryanalytics.py index 705a3ea..23f2f93 100644 --- a/src/openrouter/operations/queryanalytics.py +++ b/src/openrouter/operations/queryanalytics.py @@ -74,6 +74,102 @@ class QueryAnalyticsGlobals(BaseModel): return m +class ClassifierDimensionsTypedDict(TypedDict): + r"""Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace.""" + + classifier_id: str + r"""UUID of the classifier whose tags to group by.""" + dimension_names: NotRequired[List[str]] + include_nulls: NotRequired[bool] + r"""When true, also include generations that have no tag from this classifier. Defaults to false, which returns only classified generations.""" + + +class ClassifierDimensions(BaseModel): + r"""Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace.""" + + classifier_id: str + r"""UUID of the classifier whose tags to group by.""" + + dimension_names: Optional[List[str]] = None + + include_nulls: Optional[bool] = None + r"""When true, also include generations that have no tag from this classifier. Defaults to false, which returns only classified generations.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["dimension_names", "include_nulls"]) + 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 + + +ValueClassifierFiltersTypedDict = TypeAliasType( + "ValueClassifierFiltersTypedDict", Union[str, float] +) + + +ValueClassifierFilters = TypeAliasType("ValueClassifierFilters", Union[str, float]) + + +ClassifierFiltersValueTypedDict = TypeAliasType( + "ClassifierFiltersValueTypedDict", + Union[str, float, List[ValueClassifierFiltersTypedDict]], +) +r"""Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in.""" + + +ClassifierFiltersValue = TypeAliasType( + "ClassifierFiltersValue", Union[str, float, List[ValueClassifierFilters]] +) +r"""Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in.""" + + +class ClassifierFiltersFilterTypedDict(TypedDict): + field: str + r"""Classifier dimension name to filter on (snake_case identifier, e.g. \"department\", \"work_type\").""" + operator: str + r"""Filter operator. Only equality/set operators are supported (eq, neq, in, not_in) — ordered comparisons are not available because classification values are strings.""" + value: ClassifierFiltersValueTypedDict + r"""Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in.""" + + +class ClassifierFiltersFilter(BaseModel): + field: str + r"""Classifier dimension name to filter on (snake_case identifier, e.g. \"department\", \"work_type\").""" + + operator: str + r"""Filter operator. Only equality/set operators are supported (eq, neq, in, not_in) — ordered comparisons are not available because classification values are strings.""" + + value: ClassifierFiltersValue + r"""Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in.""" + + +class ClassifierFiltersTypedDict(TypedDict): + r"""Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions.""" + + classifier_id: str + r"""UUID of the classifier whose tags to filter by. Must match classifier_dimensions.classifier_id when both are specified.""" + filters: List[ClassifierFiltersFilterTypedDict] + + +class ClassifierFilters(BaseModel): + r"""Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions.""" + + classifier_id: str + r"""UUID of the classifier whose tags to filter by. Must match classifier_dimensions.classifier_id when both are specified.""" + + filters: List[ClassifierFiltersFilter] + + Value2TypedDict = TypeAliasType("Value2TypedDict", Union[str, float]) @@ -145,6 +241,10 @@ class TimeRange(BaseModel): class QueryAnalyticsRequestBodyTypedDict(TypedDict): metrics: List[str] + classifier_dimensions: NotRequired[ClassifierDimensionsTypedDict] + r"""Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace.""" + classifier_filters: NotRequired[ClassifierFiltersTypedDict] + r"""Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions.""" dimensions: NotRequired[List[str]] filters: NotRequired[List[FilterTypedDict]] granularity: NotRequired[str] @@ -160,6 +260,12 @@ class QueryAnalyticsRequestBodyTypedDict(TypedDict): class QueryAnalyticsRequestBody(BaseModel): metrics: List[str] + classifier_dimensions: Optional[ClassifierDimensions] = None + r"""Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace.""" + + classifier_filters: Optional[ClassifierFilters] = None + r"""Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions.""" + dimensions: Optional[List[str]] = None filters: Optional[List[Filter]] = None @@ -181,6 +287,8 @@ class QueryAnalyticsRequestBody(BaseModel): def serialize_model(self, handler): optional_fields = set( [ + "classifier_dimensions", + "classifier_filters", "dimensions", "filters", "granularity", diff --git a/uv.lock b/uv.lock index 405c5a6..783d413 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.19" +version = "0.11.20" source = { editable = "." } dependencies = [ { name = "httpcore" }, From dcad3a24362b1cb68775e7674af773e89e61d31e Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 23:00:15 +0000 Subject: [PATCH 37/62] chore: update OpenAPI spec from monorepo (#429) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index f5f9352..74cadfe 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -4167,6 +4167,7 @@ components: - crusoe - darkbloom - decart + - deepgram - deepinfra - deepseek - dekallm @@ -12764,6 +12765,7 @@ components: - Crusoe - Darkbloom - Decart + - Deepgram - DeepInfra - DeepSeek - DekaLLM @@ -18269,6 +18271,7 @@ components: - Crusoe - Darkbloom - Decart + - Deepgram - DeepInfra - DeepSeek - DekaLLM @@ -18468,6 +18471,10 @@ components: additionalProperties: nullable: true type: object + deepgram: + additionalProperties: + nullable: true + type: object deepinfra: additionalProperties: nullable: true @@ -19088,6 +19095,7 @@ components: - Crusoe - Darkbloom - Decart + - Deepgram - DeepInfra - DeepSeek - DekaLLM @@ -25168,6 +25176,7 @@ paths: - crusoe - darkbloom - decart + - deepgram - deepinfra - deepseek - dekallm From 268945a4e9336fe35aea8883adfdb67c67606ec8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 23:06:04 +0000 Subject: [PATCH 38/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.21=20(#430)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 80 +++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 9 +++ .speakeasy/workflow.lock | 10 +-- RELEASES.md | 12 ++- docs/components/byokproviderslug.mdx | 1 + .../imagegenerationrequestoptions.mdx | 1 + docs/components/providername.mdx | 1 + docs/components/provideroptions.mdx | 1 + .../providerresponseprovidername.mdx | 1 + .../videogenerationrequestoptions.mdx | 1 + docs/operations/provider.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/byokproviderslug.py | 1 + .../components/imagegenerationrequest.py | 4 + src/openrouter/components/providername.py | 1 + src/openrouter/components/provideroptions.py | 4 + src/openrouter/components/providerresponse.py | 1 + .../components/videogenerationrequest.py | 4 + src/openrouter/operations/listbyokkeys.py | 1 + uv.lock | 2 +- 22 files changed, 92 insertions(+), 52 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 0f009fa..f4e860c 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: eafdf0a15ea851c11321f795d9eaeae6 + docChecksum: 8d031575ae3f2be637b509fdc86adc85 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.20 - configChecksum: 5415321126f7b1b42de92ec1c213d0d4 + releaseVersion: 0.11.21 + configChecksum: 9727c6e42f728b1c0c481e7eea4726a4 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 11b03c28-423b-4cf5-8a75-334f53189839 - pristine_commit_hash: 78f9f7be2b502d7c7b11ec27fd701fa26a7834b2 - pristine_tree_hash: a0a6f9597055f659340cba4c2f03acf2a76d857a + generation_id: 32ee90d1-63ca-429a-ada9-91115acc181c + pristine_commit_hash: 4085cc9f874c47588eacf4192a1b17bdc74c1f63 + pristine_tree_hash: 4b8fe704c6235b5df678fd99704276eab811cbc5 features: python: acceptHeaders: 3.0.0 @@ -750,8 +750,8 @@ trackedFiles: pristine_git_object: 151dd8398dc818ff4d26d6859d25efd202d03917 docs/components/byokproviderslug.mdx: id: 6ea70819f6d8 - last_write_checksum: sha1:195859204474448ffacfda46106c4c529cc05a4e - pristine_git_object: 619d8a0909e742416ef893c01e0093ab5cc5c686 + last_write_checksum: sha1:eed4c5d188137a35589503b0fdd6f8697dd4ea9e + pristine_git_object: f6a8d82996d9f25598da92708a793066adb82820 docs/components/caching.mdx: id: edc8a0f8f37f last_write_checksum: sha1:b4e6619f389c1440555ec567fbdcddbc9976e63e @@ -2146,8 +2146,8 @@ trackedFiles: pristine_git_object: 8501680bcfebabb3af52b518c01f732d18282120 docs/components/imagegenerationrequestoptions.mdx: id: 2245ece0aaf8 - last_write_checksum: sha1:d6ca724147440eda6fe039b29ab5495824ae5c0a - pristine_git_object: b6426f4b8f4549a0e1e3e931b0cc467012c7d512 + last_write_checksum: sha1:feec51e178c169d3550ef010a94c69c16e137afc + pristine_git_object: 39c52366e3516de4554c93613d8bbbc8b64a8a5a docs/components/imagegenerationrequestoutputformat.mdx: id: 380f12bf77bd last_write_checksum: sha1:afb479dc34118828e988888a8f49e7a5a50a45ab @@ -3878,12 +3878,12 @@ trackedFiles: pristine_git_object: 1d91d32cd0bf4b64699bbbf05a7e95ab835b10cf docs/components/providername.mdx: id: aa3a4904b228 - last_write_checksum: sha1:0ed72fc077d1a2641c8013c782fa7797282337e8 - pristine_git_object: f7cde44d7ed6638b63f3f5c3921096cd368c1b1e + last_write_checksum: sha1:f1e40895dff06a9a8c16d40133d1183f0bd5a344 + pristine_git_object: 27d1ebafd80a7d3b3d30fa9d7ae2cc85df452068 docs/components/provideroptions.mdx: id: 2697807524fe - last_write_checksum: sha1:f0ee004496e6067b61305a24191eecb3c7444dbb - pristine_git_object: c9df643ff81878c93f6d6f363f622be76442f13a + last_write_checksum: sha1:a5900d110161c668aae14628bf109eadce276995 + pristine_git_object: 692215d0dfe4a5b0c8054e36c5de3935717ad2ce docs/components/provideroverloadedresponseerrordata.mdx: id: dc500cd14889 last_write_checksum: sha1:6c1d551db4083f1d0bc429baa1ce472d2c085331 @@ -3898,8 +3898,8 @@ trackedFiles: pristine_git_object: dd376f0952fa0517dd83b06ed7afc2c856123dbc docs/components/providerresponseprovidername.mdx: id: 2fc17b61e546 - last_write_checksum: sha1:3c9ef87051135f7aa37e89b7b952aed3b8e2c13a - pristine_git_object: 85c97ab96bd1c209a131187986528ea636e81256 + last_write_checksum: sha1:64454d1cd35449c9f73f9eca55ff084d0678dea5 + pristine_git_object: e7fb2111e14cd066c973885287724022677f3ab0 docs/components/providersort.mdx: id: d73fa13eeb95 last_write_checksum: sha1:b7e9e6842741e3433d705bd576f2ac5383f00134 @@ -5014,8 +5014,8 @@ trackedFiles: pristine_git_object: 67f56887bb4758559189e3e9e6123dff9a38df81 docs/components/videogenerationrequestoptions.mdx: id: 1d67160e7e7a - last_write_checksum: sha1:5212fca896119c2cbede7f2efbc0855d007e68d1 - pristine_git_object: c1d338ae75a61869d4e8b5110b2a85d5e624da1e + last_write_checksum: sha1:4c19959913429416ca1b6982963e0825fa15ed38 + pristine_git_object: 003eb8e132056a3d7bd592b3ce7916d210cbc7ce docs/components/videogenerationrequestprovider.mdx: id: d6424dd5de9d last_write_checksum: sha1:72aa46a3335220b579db56574ea179d150dbe2b6 @@ -6282,8 +6282,8 @@ trackedFiles: pristine_git_object: 0f0b54e43577a8a835cd971f82e48c3921e3d88e docs/operations/provider.mdx: id: c75b3bbeeaa0 - last_write_checksum: sha1:050746e3c160daa03b108e45aed42aadf82d641f - pristine_git_object: 139a0786eebb659c9b410f430efac3115759d5ae + last_write_checksum: sha1:854c43630b490027e930e03f27e30c544e4a1fb2 + pristine_git_object: ca7cbceeff39e8537e8b400d729548d091cae55c docs/operations/queryanalyticsdata1.mdx: id: 0e41beea77d0 last_write_checksum: sha1:f9a349b4fee07f786180e94b45f92002bfae0e56 @@ -6598,8 +6598,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:8914993a8cce928e2718682d649405beb44a32de - pristine_git_object: 91166b893131a18020578ab19889176d7a128370 + last_write_checksum: sha1:49c5cef7bfae1a99b3748b7f0d4849e3f5bc1586 + pristine_git_object: fcb7c71336e11a790eb0ca957afc61d7487d5cca scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6626,8 +6626,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:2c94535d48a1494c22eff12e1255c7528b1aa324 - pristine_git_object: f5a0e56d914e266d29449c5d3e1a7ec635f26424 + last_write_checksum: sha1:d2c83542eb03318722265f88a4567fd5fb24eb23 + pristine_git_object: e50399dbcba8bace7c102c95017bb41abbeca582 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -7002,8 +7002,8 @@ trackedFiles: pristine_git_object: 47ef267b5e0f7b615b0cd66018728e3f47440a66 src/openrouter/components/byokproviderslug.py: id: 6738a8516caf - last_write_checksum: sha1:a5a6e1a2e7709f0afb9d97347c5d76457fea7d3e - pristine_git_object: 044751122a1397e7624e0e3abd867286dc96c6fc + last_write_checksum: sha1:c4f20773997e0d5ffc61b151007e833c53a24fbb + pristine_git_object: 3ecc6201b85562fe1c2c94f978e488ed2ba40aae src/openrouter/components/capabilitydescriptor.py: id: 368790a86f10 last_write_checksum: sha1:a167551924ee82b4b5876a0ab698a45fe8c87a95 @@ -7614,8 +7614,8 @@ trackedFiles: pristine_git_object: 6b9a8990973466285f9b49b366bbc5fc1ae42e41 src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 - last_write_checksum: sha1:8a1e549056b8ef856f89c75182b49e3386c410fd - pristine_git_object: d1937b9c35752d03b04098295ea5dadb1804dafb + last_write_checksum: sha1:348c6aa7d1b7a02694e44396e51ab56e20853bb9 + pristine_git_object: 9866560ee4d4d61c0bec89e276bb0a39f6d215ad src/openrouter/components/imagegenerationresponse.py: id: 53354cd0cbfc last_write_checksum: sha1:53f1cde7b8bfe4f9e786a76f6e57b0a1f76aced2 @@ -8270,12 +8270,12 @@ trackedFiles: pristine_git_object: 170ae25c582bb8decd74e1c69bfa8353bd44e86d src/openrouter/components/providername.py: id: fcc722fa2fce - last_write_checksum: sha1:b6d26b4ce3e92121a80cb351962e89593951962d - pristine_git_object: 009c1401a29123f18887b48c03f9c2a8b11ca2b5 + last_write_checksum: sha1:6e915e5bc7fa9fff848600fccf35e754a62e7c64 + pristine_git_object: 2624f640bdecad277b64865d0b6dea1176102b87 src/openrouter/components/provideroptions.py: id: 73dde6c8f359 - last_write_checksum: sha1:72fe38a2faab604e52a16eec0b5d1273b3eda64d - pristine_git_object: 9ab53163a6884a4fbf41c87391903f013eead544 + last_write_checksum: sha1:16c9861c644b04fc742114a47a4966e7eda87e94 + pristine_git_object: d6e1dfcdcaf3d49f138a34bfcfd011083002bd79 src/openrouter/components/provideroverloadedresponseerrordata.py: id: 5b693682570e last_write_checksum: sha1:1ebc4527736f1e174ab37c84bea8a169fda9f8b8 @@ -8286,8 +8286,8 @@ trackedFiles: pristine_git_object: abbb3cb3d7d8946aabdbd5e6b07b2e45954f6948 src/openrouter/components/providerresponse.py: id: ad3887be54c5 - last_write_checksum: sha1:2db05f9a797fe78377f5f7ff426f51a47a998be8 - pristine_git_object: ccc9f82da58ced9e49b6f14f0f73075efcb84307 + last_write_checksum: sha1:b8868ce7950808be5b37e964607abab8348e2ab6 + pristine_git_object: 9382e92c4777f3a0c46afb007fda317d41baec2c src/openrouter/components/providersort.py: id: 348e382bf494 last_write_checksum: sha1:57551507f95cd2e16ef995e1c13f859fd0726152 @@ -8750,8 +8750,8 @@ trackedFiles: pristine_git_object: 572d04f457607099ae7e041922de146de10e2eae src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c - last_write_checksum: sha1:ded4141016409c0ee6bdde4061c704f8b006c84c - pristine_git_object: d96af0892419695a7fe096e045490a9a4ff13b8f + last_write_checksum: sha1:5dfb79ba40785ce3a31b00f66b5fba956dca1f0d + pristine_git_object: 1c1bcd48aacbdbb0a343c723eb525393caba109a src/openrouter/components/videogenerationresponse.py: id: 541f1321b072 last_write_checksum: sha1:18c3aa7845f63a9614286b1a27b6098eae1c4951 @@ -9218,8 +9218,8 @@ trackedFiles: pristine_git_object: cc90375e9aac23107e57e18e6adecc38f544e185 src/openrouter/operations/listbyokkeys.py: id: b6dd42b3e05f - last_write_checksum: sha1:7f5d32c8e8d9dc55fe7c5e8bf8fd71ed6406e10a - pristine_git_object: c3080ca256a625e437d85da39c703d0c3b495049 + last_write_checksum: sha1:f7f299b70e4dcea2ba38b6956984d77326820d96 + pristine_git_object: f1fb2eee06028e71b863ef5599693f7e6826e0a6 src/openrouter/operations/listembeddingsmodels.py: id: bf749a1f23d6 last_write_checksum: sha1:19ed80a098e6e1b43bedfcccb11b4c8d8794541c @@ -10981,6 +10981,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.beta.analytics.query_analytics()`: `request` **Changed** +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.tts.create_speech()`: \n * `request.provider.options.deepgram` **Added**\n* `open_router.stt.create_transcription()`: \n * `request.provider.options.deepgram` **Added**\n* `open_router.byok.list()`: \n * `request.provider` **Changed**\n * `response.data[].provider.enum(deepgram)` **Added**\n* `open_router.byok.create()`: \n * `request.provider.enum(deepgram)` **Added**\n * `response.data.provider.enum(deepgram)` **Added**\n* `open_router.byok.get()`: `response.data.provider.enum(deepgram)` **Added**\n* `open_router.byok.update()`: `response.data.provider.enum(deepgram)` **Added**\n* `open_router.chat.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.embeddings.generate()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `response.data[].provider_name.enum(deepgram)` **Added**\n* `open_router.endpoints.list()`: `response.data.endpoints[].provider_name.enum(deepgram)` **Added**\n* `open_router.generations.get_generation()`: `response.data.provider_responses[].provider_name.enum(deepgram)` **Added**\n* `open_router.images.generate()`: \n * `request.provider.options.deepgram` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.rerank.rerank()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.video_generation.generate()`: \n * `request.provider.options.deepgram` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index ba5806d..36b48ca 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.20 + version: 0.11.21 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 5cf1144..90ff720 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -4165,6 +4165,7 @@ components: - crusoe - darkbloom - decart + - deepgram - deepinfra - deepseek - dekallm @@ -12702,6 +12703,7 @@ components: - Crusoe - Darkbloom - Decart + - Deepgram - DeepInfra - DeepSeek - DekaLLM @@ -18167,6 +18169,7 @@ components: - Crusoe - Darkbloom - Decart + - Deepgram - DeepInfra - DeepSeek - DekaLLM @@ -18366,6 +18369,10 @@ components: additionalProperties: nullable: true type: object + deepgram: + additionalProperties: + nullable: true + type: object deepinfra: additionalProperties: nullable: true @@ -18977,6 +18984,7 @@ components: - Crusoe - Darkbloom - Decart + - Deepgram - DeepInfra - DeepSeek - DekaLLM @@ -24979,6 +24987,7 @@ paths: - crusoe - darkbloom - decart + - deepgram - deepinfra - deepseek - dekallm diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index c41786d..497ccb9 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:0244558823b6088d1e3032984eebb7034080c88012d9246accc6d9e62ff608e2 - sourceBlobDigest: sha256:639b41e906b5ebc304974d4516f56048e8243c71765c59435484287dad1a05ac + sourceRevisionDigest: sha256:41318d8c03cd40a9e160325e59d8d0646c1f6b84cb4a0983a1178b114d6c6117 + sourceBlobDigest: sha256:d67de2fc367e6671e6ce00ff6033b63486ab63c3bee40624c465e469d44d4f2d tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:0244558823b6088d1e3032984eebb7034080c88012d9246accc6d9e62ff608e2 - sourceBlobDigest: sha256:639b41e906b5ebc304974d4516f56048e8243c71765c59435484287dad1a05ac + sourceRevisionDigest: sha256:41318d8c03cd40a9e160325e59d8d0646c1f6b84cb4a0983a1178b114d6c6117 + sourceBlobDigest: sha256:d67de2fc367e6671e6ce00ff6033b63486ab63c3bee40624c465e469d44d4f2d codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:a012a1304c56f93a4aeaea74f847db642667113fb8489a88981091d34fc6e4ab + codeSamplesRevisionDigest: sha256:04f667000b2d9028ee26ed37b8e521ae1a33ef134fe039f74da01ac333407e87 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index f2ca288..71f8952 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -308,4 +308,14 @@ Based on: ### Generated - [python v0.11.20] . ### Releases -- [PyPI v0.11.20] https://pypi.org/project/openrouter/0.11.20 - . \ No newline at end of file +- [PyPI v0.11.20] https://pypi.org/project/openrouter/0.11.20 - . + +## 2026-07-10 23:01:43 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.21] . +### Releases +- [PyPI v0.11.21] https://pypi.org/project/openrouter/0.11.21 - . \ No newline at end of file diff --git a/docs/components/byokproviderslug.mdx b/docs/components/byokproviderslug.mdx index 619d8a0..f6a8d82 100644 --- a/docs/components/byokproviderslug.mdx +++ b/docs/components/byokproviderslug.mdx @@ -43,6 +43,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"crusoe"` - `"darkbloom"` - `"decart"` +- `"deepgram"` - `"deepinfra"` - `"deepseek"` - `"dekallm"` diff --git a/docs/components/imagegenerationrequestoptions.mdx b/docs/components/imagegenerationrequestoptions.mdx index b6426f4..39c5236 100644 --- a/docs/components/imagegenerationrequestoptions.mdx +++ b/docs/components/imagegenerationrequestoptions.mdx @@ -40,6 +40,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `crusoe` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `darkbloom` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `decart` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `deepgram` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `deepinfra` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `deepseek` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `dekallm` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/providername.mdx b/docs/components/providername.mdx index f7cde44..27d1eba 100644 --- a/docs/components/providername.mdx +++ b/docs/components/providername.mdx @@ -42,6 +42,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Crusoe"` - `"Darkbloom"` - `"Decart"` +- `"Deepgram"` - `"DeepInfra"` - `"DeepSeek"` - `"DekaLLM"` diff --git a/docs/components/provideroptions.mdx b/docs/components/provideroptions.mdx index c9df643..692215d 100644 --- a/docs/components/provideroptions.mdx +++ b/docs/components/provideroptions.mdx @@ -40,6 +40,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `crusoe` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `darkbloom` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `decart` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `deepgram` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `deepinfra` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `deepseek` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `dekallm` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/providerresponseprovidername.mdx b/docs/components/providerresponseprovidername.mdx index 85c97ab..e7fb211 100644 --- a/docs/components/providerresponseprovidername.mdx +++ b/docs/components/providerresponseprovidername.mdx @@ -73,6 +73,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Crusoe"` - `"Darkbloom"` - `"Decart"` +- `"Deepgram"` - `"DeepInfra"` - `"DeepSeek"` - `"DekaLLM"` diff --git a/docs/components/videogenerationrequestoptions.mdx b/docs/components/videogenerationrequestoptions.mdx index c1d338a..003eb8e 100644 --- a/docs/components/videogenerationrequestoptions.mdx +++ b/docs/components/videogenerationrequestoptions.mdx @@ -40,6 +40,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `crusoe` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `darkbloom` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `decart` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `deepgram` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `deepinfra` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `deepseek` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `dekallm` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/operations/provider.mdx b/docs/operations/provider.mdx index 139a078..ca7cbce 100644 --- a/docs/operations/provider.mdx +++ b/docs/operations/provider.mdx @@ -43,6 +43,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"crusoe"` - `"darkbloom"` - `"decart"` +- `"deepgram"` - `"deepinfra"` - `"deepseek"` - `"dekallm"` diff --git a/pyproject.toml b/pyproject.toml index 91166b8..fcb7c71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.20" +version = "0.11.21" 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 f5a0e56..e50399d 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.20" +__version__: str = "0.11.21" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.20 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.21 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/byokproviderslug.py b/src/openrouter/components/byokproviderslug.py index 0447511..3ecc620 100644 --- a/src/openrouter/components/byokproviderslug.py +++ b/src/openrouter/components/byokproviderslug.py @@ -32,6 +32,7 @@ BYOKProviderSlug = Union[ "crusoe", "darkbloom", "decart", + "deepgram", "deepinfra", "deepseek", "dekallm", diff --git a/src/openrouter/components/imagegenerationrequest.py b/src/openrouter/components/imagegenerationrequest.py index d1937b9..9866560 100644 --- a/src/openrouter/components/imagegenerationrequest.py +++ b/src/openrouter/components/imagegenerationrequest.py @@ -96,6 +96,7 @@ class ImageGenerationRequestOptionsTypedDict(TypedDict): crusoe: NotRequired[Dict[str, Nullable[Any]]] darkbloom: NotRequired[Dict[str, Nullable[Any]]] decart: NotRequired[Dict[str, Nullable[Any]]] + deepgram: NotRequired[Dict[str, Nullable[Any]]] deepinfra: NotRequired[Dict[str, Nullable[Any]]] deepseek: NotRequired[Dict[str, Nullable[Any]]] dekallm: NotRequired[Dict[str, Nullable[Any]]] @@ -266,6 +267,8 @@ class ImageGenerationRequestOptions(BaseModel): decart: Optional[Dict[str, Nullable[Any]]] = None + deepgram: Optional[Dict[str, Nullable[Any]]] = None + deepinfra: Optional[Dict[str, Nullable[Any]]] = None deepseek: Optional[Dict[str, Nullable[Any]]] = None @@ -511,6 +514,7 @@ class ImageGenerationRequestOptions(BaseModel): "crusoe", "darkbloom", "decart", + "deepgram", "deepinfra", "deepseek", "dekallm", diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index 009c140..2624f64 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -33,6 +33,7 @@ ProviderName = Union[ "Crusoe", "Darkbloom", "Decart", + "Deepgram", "DeepInfra", "DeepSeek", "DekaLLM", diff --git a/src/openrouter/components/provideroptions.py b/src/openrouter/components/provideroptions.py index 9ab5316..d6e1dfc 100644 --- a/src/openrouter/components/provideroptions.py +++ b/src/openrouter/components/provideroptions.py @@ -42,6 +42,7 @@ class ProviderOptionsTypedDict(TypedDict): crusoe: NotRequired[Dict[str, Nullable[Any]]] darkbloom: NotRequired[Dict[str, Nullable[Any]]] decart: NotRequired[Dict[str, Nullable[Any]]] + deepgram: NotRequired[Dict[str, Nullable[Any]]] deepinfra: NotRequired[Dict[str, Nullable[Any]]] deepseek: NotRequired[Dict[str, Nullable[Any]]] dekallm: NotRequired[Dict[str, Nullable[Any]]] @@ -212,6 +213,8 @@ class ProviderOptions(BaseModel): decart: Optional[Dict[str, Nullable[Any]]] = None + deepgram: Optional[Dict[str, Nullable[Any]]] = None + deepinfra: Optional[Dict[str, Nullable[Any]]] = None deepseek: Optional[Dict[str, Nullable[Any]]] = None @@ -457,6 +460,7 @@ class ProviderOptions(BaseModel): "crusoe", "darkbloom", "decart", + "deepgram", "deepinfra", "deepseek", "dekallm", diff --git a/src/openrouter/components/providerresponse.py b/src/openrouter/components/providerresponse.py index ccc9f82..9382e92 100644 --- a/src/openrouter/components/providerresponse.py +++ b/src/openrouter/components/providerresponse.py @@ -64,6 +64,7 @@ ProviderResponseProviderName = Union[ "Crusoe", "Darkbloom", "Decart", + "Deepgram", "DeepInfra", "DeepSeek", "DekaLLM", diff --git a/src/openrouter/components/videogenerationrequest.py b/src/openrouter/components/videogenerationrequest.py index d96af08..1c1bcd4 100644 --- a/src/openrouter/components/videogenerationrequest.py +++ b/src/openrouter/components/videogenerationrequest.py @@ -61,6 +61,7 @@ class VideoGenerationRequestOptionsTypedDict(TypedDict): crusoe: NotRequired[Dict[str, Nullable[Any]]] darkbloom: NotRequired[Dict[str, Nullable[Any]]] decart: NotRequired[Dict[str, Nullable[Any]]] + deepgram: NotRequired[Dict[str, Nullable[Any]]] deepinfra: NotRequired[Dict[str, Nullable[Any]]] deepseek: NotRequired[Dict[str, Nullable[Any]]] dekallm: NotRequired[Dict[str, Nullable[Any]]] @@ -231,6 +232,8 @@ class VideoGenerationRequestOptions(BaseModel): decart: Optional[Dict[str, Nullable[Any]]] = None + deepgram: Optional[Dict[str, Nullable[Any]]] = None + deepinfra: Optional[Dict[str, Nullable[Any]]] = None deepseek: Optional[Dict[str, Nullable[Any]]] = None @@ -476,6 +479,7 @@ class VideoGenerationRequestOptions(BaseModel): "crusoe", "darkbloom", "decart", + "deepgram", "deepinfra", "deepseek", "dekallm", diff --git a/src/openrouter/operations/listbyokkeys.py b/src/openrouter/operations/listbyokkeys.py index c3080ca..f1fb2ee 100644 --- a/src/openrouter/operations/listbyokkeys.py +++ b/src/openrouter/operations/listbyokkeys.py @@ -103,6 +103,7 @@ Provider = Union[ "crusoe", "darkbloom", "decart", + "deepgram", "deepinfra", "deepseek", "dekallm", diff --git a/uv.lock b/uv.lock index 783d413..9ca25ac 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.20" +version = "0.11.21" source = { editable = "." } dependencies = [ { name = "httpcore" }, From b78df646e1151b054c00d5b4627807de010a7401 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 03:18:00 +0000 Subject: [PATCH 39/62] chore: update OpenAPI spec from monorepo (#431) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 74cadfe..61e02b5 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -4191,6 +4191,7 @@ components: - liquid - mancer - mara + - meta - minimax - mistral - modelrun @@ -18245,6 +18246,7 @@ components: type: string ProviderName: enum: + - Meta - AkashML - AI21 - AionLabs @@ -25200,6 +25202,7 @@ paths: - liquid - mancer - mara + - meta - minimax - mistral - modelrun From 219a0b863e15d55946524212047aa921fbbb84e6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 03:23:16 +0000 Subject: [PATCH 40/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.22=20(#432)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 46 +++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 3 ++ .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 ++++- docs/components/byokproviderslug.mdx | 1 + docs/components/providername.mdx | 3 +- docs/operations/provider.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/byokproviderslug.py | 1 + src/openrouter/components/providername.py | 1 + src/openrouter/operations/listbyokkeys.py | 1 + uv.lock | 2 +- 14 files changed, 54 insertions(+), 35 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index f4e860c..21dc6cd 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: 8d031575ae3f2be637b509fdc86adc85 + docChecksum: 586e37e63acb262548506265e19ac727 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.21 - configChecksum: 9727c6e42f728b1c0c481e7eea4726a4 + releaseVersion: 0.11.22 + configChecksum: 5cb684d8aabef4d0e06789941dbd06eb repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 32ee90d1-63ca-429a-ada9-91115acc181c - pristine_commit_hash: 4085cc9f874c47588eacf4192a1b17bdc74c1f63 - pristine_tree_hash: 4b8fe704c6235b5df678fd99704276eab811cbc5 + generation_id: c1a5429a-8cf6-496c-a2b0-bc500ddc6e22 + pristine_commit_hash: 8919d336a9bbdf8bdde22ce38e28085278390cf0 + pristine_tree_hash: 30bee8bd0cc198f68b8899cbeb999576145f5493 features: python: acceptHeaders: 3.0.0 @@ -750,8 +750,8 @@ trackedFiles: pristine_git_object: 151dd8398dc818ff4d26d6859d25efd202d03917 docs/components/byokproviderslug.mdx: id: 6ea70819f6d8 - last_write_checksum: sha1:eed4c5d188137a35589503b0fdd6f8697dd4ea9e - pristine_git_object: f6a8d82996d9f25598da92708a793066adb82820 + last_write_checksum: sha1:dd9de0bc49b47e4c49878f4e4b1684b6bbd43e0e + pristine_git_object: a7472d01b6de43fedfa76a9e608d67202a7ec529 docs/components/caching.mdx: id: edc8a0f8f37f last_write_checksum: sha1:b4e6619f389c1440555ec567fbdcddbc9976e63e @@ -3878,8 +3878,8 @@ trackedFiles: pristine_git_object: 1d91d32cd0bf4b64699bbbf05a7e95ab835b10cf docs/components/providername.mdx: id: aa3a4904b228 - last_write_checksum: sha1:f1e40895dff06a9a8c16d40133d1183f0bd5a344 - pristine_git_object: 27d1ebafd80a7d3b3d30fa9d7ae2cc85df452068 + last_write_checksum: sha1:be6fb41ed23d0e54e63d5f10678182ec5eae6027 + pristine_git_object: 95533adfa2f939083c8df84451ca31650d3f34f4 docs/components/provideroptions.mdx: id: 2697807524fe last_write_checksum: sha1:a5900d110161c668aae14628bf109eadce276995 @@ -6282,8 +6282,8 @@ trackedFiles: pristine_git_object: 0f0b54e43577a8a835cd971f82e48c3921e3d88e docs/operations/provider.mdx: id: c75b3bbeeaa0 - last_write_checksum: sha1:854c43630b490027e930e03f27e30c544e4a1fb2 - pristine_git_object: ca7cbceeff39e8537e8b400d729548d091cae55c + last_write_checksum: sha1:f3f959b689f60e1bc8dc84e16cae8f603076da39 + pristine_git_object: 87d0a5181c68a8520c2f33472cde1f70ae47517a docs/operations/queryanalyticsdata1.mdx: id: 0e41beea77d0 last_write_checksum: sha1:f9a349b4fee07f786180e94b45f92002bfae0e56 @@ -6598,8 +6598,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:49c5cef7bfae1a99b3748b7f0d4849e3f5bc1586 - pristine_git_object: fcb7c71336e11a790eb0ca957afc61d7487d5cca + last_write_checksum: sha1:83fda8e0d22a9e98c001a57ae2b979e138982e1c + pristine_git_object: 93ce03b87a33bacca825a80068c0f35031bee5aa scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6626,8 +6626,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:d2c83542eb03318722265f88a4567fd5fb24eb23 - pristine_git_object: e50399dbcba8bace7c102c95017bb41abbeca582 + last_write_checksum: sha1:b1160bf575302810a304f12f55b90ef8c9c6c52f + pristine_git_object: 2310169385ee80282e62878e83ef079a52994708 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -7002,8 +7002,8 @@ trackedFiles: pristine_git_object: 47ef267b5e0f7b615b0cd66018728e3f47440a66 src/openrouter/components/byokproviderslug.py: id: 6738a8516caf - last_write_checksum: sha1:c4f20773997e0d5ffc61b151007e833c53a24fbb - pristine_git_object: 3ecc6201b85562fe1c2c94f978e488ed2ba40aae + last_write_checksum: sha1:1cf43faf3a5fcfdac985e26b6cc3e29a9a958ae6 + pristine_git_object: 81fee367601cd550521fce7ea60a8324c9825f8b src/openrouter/components/capabilitydescriptor.py: id: 368790a86f10 last_write_checksum: sha1:a167551924ee82b4b5876a0ab698a45fe8c87a95 @@ -8270,8 +8270,8 @@ trackedFiles: pristine_git_object: 170ae25c582bb8decd74e1c69bfa8353bd44e86d src/openrouter/components/providername.py: id: fcc722fa2fce - last_write_checksum: sha1:6e915e5bc7fa9fff848600fccf35e754a62e7c64 - pristine_git_object: 2624f640bdecad277b64865d0b6dea1176102b87 + last_write_checksum: sha1:5aaf14cf939df3daffca2ca3185ae8028c403bf2 + pristine_git_object: f77081e7c30b015b7ea03ad64da044263883bad6 src/openrouter/components/provideroptions.py: id: 73dde6c8f359 last_write_checksum: sha1:16c9861c644b04fc742114a47a4966e7eda87e94 @@ -9218,8 +9218,8 @@ trackedFiles: pristine_git_object: cc90375e9aac23107e57e18e6adecc38f544e185 src/openrouter/operations/listbyokkeys.py: id: b6dd42b3e05f - last_write_checksum: sha1:f7f299b70e4dcea2ba38b6956984d77326820d96 - pristine_git_object: f1fb2eee06028e71b863ef5599693f7e6826e0a6 + last_write_checksum: sha1:09b5ddfd1b3558638199bf268b5a931a74094012 + pristine_git_object: 67d30bcc6c66aa56f40f3b56b94c2a31879f50d6 src/openrouter/operations/listembeddingsmodels.py: id: bf749a1f23d6 last_write_checksum: sha1:19ed80a098e6e1b43bedfcccb11b4c8d8794541c @@ -10981,4 +10981,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.tts.create_speech()`: \n * `request.provider.options.deepgram` **Added**\n* `open_router.stt.create_transcription()`: \n * `request.provider.options.deepgram` **Added**\n* `open_router.byok.list()`: \n * `request.provider` **Changed**\n * `response.data[].provider.enum(deepgram)` **Added**\n* `open_router.byok.create()`: \n * `request.provider.enum(deepgram)` **Added**\n * `response.data.provider.enum(deepgram)` **Added**\n* `open_router.byok.get()`: `response.data.provider.enum(deepgram)` **Added**\n* `open_router.byok.update()`: `response.data.provider.enum(deepgram)` **Added**\n* `open_router.chat.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.embeddings.generate()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `response.data[].provider_name.enum(deepgram)` **Added**\n* `open_router.endpoints.list()`: `response.data.endpoints[].provider_name.enum(deepgram)` **Added**\n* `open_router.generations.get_generation()`: `response.data.provider_responses[].provider_name.enum(deepgram)` **Added**\n* `open_router.images.generate()`: \n * `request.provider.options.deepgram` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.rerank.rerank()`: \n * `request.provider.ignore[].union(ProviderName).enum(deepgram)` **Added**\n* `open_router.video_generation.generate()`: \n * `request.provider.options.deepgram` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.byok.list()`: \n * `request.provider` **Changed**\n * `response.data[].provider.enum(meta)` **Added**\n* `open_router.byok.create()`: \n * `request.provider.enum(meta)` **Added**\n * `response.data.provider.enum(meta)` **Added**\n* `open_router.byok.get()`: `response.data.provider.enum(meta)` **Added**\n* `open_router.byok.update()`: `response.data.provider.enum(meta)` **Added**\n* `open_router.chat.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.embeddings.generate()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `response.data[].provider_name.enum(meta)` **Added**\n* `open_router.endpoints.list()`: `response.data.endpoints[].provider_name.enum(meta)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.rerank.rerank()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 36b48ca..4797430 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.21 + version: 0.11.22 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 90ff720..1eb104c 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -4189,6 +4189,7 @@ components: - liquid - mancer - mara + - meta - minimax - mistral - modelrun @@ -18143,6 +18144,7 @@ components: x-speakeasy-unknown-values: allow ProviderName: enum: + - Meta - AkashML - AI21 - AionLabs @@ -25011,6 +25013,7 @@ paths: - liquid - mancer - mara + - meta - minimax - mistral - modelrun diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 497ccb9..45ab314 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:41318d8c03cd40a9e160325e59d8d0646c1f6b84cb4a0983a1178b114d6c6117 - sourceBlobDigest: sha256:d67de2fc367e6671e6ce00ff6033b63486ab63c3bee40624c465e469d44d4f2d + sourceRevisionDigest: sha256:de69b2f9b07e26db9104e074f6c2efe678f98a34d8ad38f2c49e19979748896a + sourceBlobDigest: sha256:84fbbf832a15ad74f1815d7bceec21fec641147b3845a4b07810f1787bcc5625 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:41318d8c03cd40a9e160325e59d8d0646c1f6b84cb4a0983a1178b114d6c6117 - sourceBlobDigest: sha256:d67de2fc367e6671e6ce00ff6033b63486ab63c3bee40624c465e469d44d4f2d + sourceRevisionDigest: sha256:de69b2f9b07e26db9104e074f6c2efe678f98a34d8ad38f2c49e19979748896a + sourceBlobDigest: sha256:84fbbf832a15ad74f1815d7bceec21fec641147b3845a4b07810f1787bcc5625 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:04f667000b2d9028ee26ed37b8e521ae1a33ef134fe039f74da01ac333407e87 + codeSamplesRevisionDigest: sha256:f5f3107951a498aed04ec33877a0e8ec5dc1fcecf169f70fd3a3ce1db66f8dad workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 71f8952..2728fbf 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -318,4 +318,14 @@ Based on: ### Generated - [python v0.11.21] . ### Releases -- [PyPI v0.11.21] https://pypi.org/project/openrouter/0.11.21 - . \ No newline at end of file +- [PyPI v0.11.21] https://pypi.org/project/openrouter/0.11.21 - . + +## 2026-07-11 03:19:26 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.22] . +### Releases +- [PyPI v0.11.22] https://pypi.org/project/openrouter/0.11.22 - . \ No newline at end of file diff --git a/docs/components/byokproviderslug.mdx b/docs/components/byokproviderslug.mdx index f6a8d82..a7472d0 100644 --- a/docs/components/byokproviderslug.mdx +++ b/docs/components/byokproviderslug.mdx @@ -67,6 +67,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"liquid"` - `"mancer"` - `"mara"` +- `"meta"` - `"minimax"` - `"mistral"` - `"modelrun"` diff --git a/docs/components/providername.mdx b/docs/components/providername.mdx index 27d1eba..95533ad 100644 --- a/docs/components/providername.mdx +++ b/docs/components/providername.mdx @@ -8,7 +8,7 @@ title: "ProviderName" from openrouter.components import ProviderName # Open enum: unrecognized values are captured as UnrecognizedStr -value: ProviderName = "AkashML" +value: ProviderName = "Meta" ``` @@ -16,6 +16,7 @@ value: ProviderName = "AkashML" This is an open enum. Unrecognized values will not fail type checks. +- `"Meta"` - `"AkashML"` - `"AI21"` - `"AionLabs"` diff --git a/docs/operations/provider.mdx b/docs/operations/provider.mdx index ca7cbce..87d0a51 100644 --- a/docs/operations/provider.mdx +++ b/docs/operations/provider.mdx @@ -67,6 +67,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"liquid"` - `"mancer"` - `"mara"` +- `"meta"` - `"minimax"` - `"mistral"` - `"modelrun"` diff --git a/pyproject.toml b/pyproject.toml index fcb7c71..93ce03b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.21" +version = "0.11.22" 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 e50399d..2310169 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.21" +__version__: str = "0.11.22" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.21 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.22 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/byokproviderslug.py b/src/openrouter/components/byokproviderslug.py index 3ecc620..81fee36 100644 --- a/src/openrouter/components/byokproviderslug.py +++ b/src/openrouter/components/byokproviderslug.py @@ -56,6 +56,7 @@ BYOKProviderSlug = Union[ "liquid", "mancer", "mara", + "meta", "minimax", "mistral", "modelrun", diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index 2624f64..f77081e 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -7,6 +7,7 @@ from typing import Literal, Union ProviderName = Union[ Literal[ + "Meta", "AkashML", "AI21", "AionLabs", diff --git a/src/openrouter/operations/listbyokkeys.py b/src/openrouter/operations/listbyokkeys.py index f1fb2ee..67d30bc 100644 --- a/src/openrouter/operations/listbyokkeys.py +++ b/src/openrouter/operations/listbyokkeys.py @@ -127,6 +127,7 @@ Provider = Union[ "liquid", "mancer", "mara", + "meta", "minimax", "mistral", "modelrun", diff --git a/uv.lock b/uv.lock index 9ca25ac..63bad3f 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.21" +version = "0.11.22" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 0a856983507f98a613cabab6e60af47ebf0aa817 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 16:35:38 +0000 Subject: [PATCH 41/62] chore: update OpenAPI spec from monorepo (#433) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 61e02b5..dec6619 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -20662,10 +20662,10 @@ components: description: Text-to-speech request input example: input: Hello world - model: elevenlabs/eleven-turbo-v2 + model: mistralai/voxtral-mini-tts-2603 response_format: pcm speed: 1 - voice: alloy + voice: en_paul_neutral properties: input: description: Text to synthesize @@ -20673,7 +20673,7 @@ components: type: string model: description: TTS model identifier - example: elevenlabs/eleven-turbo-v2 + example: mistralai/voxtral-mini-tts-2603 type: string provider: description: Provider-specific passthrough configuration @@ -20698,7 +20698,7 @@ components: type: number voice: description: Voice identifier (provider-specific). - example: alloy + example: en_paul_neutral type: string required: - model @@ -24384,10 +24384,10 @@ paths: application/json: example: input: Hello world - model: elevenlabs/eleven-turbo-v2 + model: mistralai/voxtral-mini-tts-2603 response_format: pcm speed: 1 - voice: alloy + voice: en_paul_neutral schema: $ref: '#/components/schemas/SpeechRequest' required: true From 30053d89b3a2b4275011cf08cd6e39890e049a52 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 16:41:12 +0000 Subject: [PATCH 42/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.23=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 35 ++++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 12 +++---- .speakeasy/workflow.lock | 10 +++--- RELEASES.md | 12 ++++++- docs/components/speechrequest.mdx | 4 +-- docs/operations/createaudiospeechrequest.mdx | 2 +- docs/sdks/tts/README.mdx | 6 ++-- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +-- uv.lock | 2 +- 11 files changed, 50 insertions(+), 41 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 21dc6cd..febf4bd 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: 586e37e63acb262548506265e19ac727 + docChecksum: b5664b53681fb6403943916bb9b110bc docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.22 - configChecksum: 5cb684d8aabef4d0e06789941dbd06eb + releaseVersion: 0.11.23 + configChecksum: 47c73c3494869121d190f901e061e5d9 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c1a5429a-8cf6-496c-a2b0-bc500ddc6e22 - pristine_commit_hash: 8919d336a9bbdf8bdde22ce38e28085278390cf0 - pristine_tree_hash: 30bee8bd0cc198f68b8899cbeb999576145f5493 + generation_id: e4b4974f-8771-44db-babf-659fe2ac2518 + pristine_commit_hash: f72edbf6eebf0c3406c03b3a608aacb71c6122ce + pristine_tree_hash: 42c1bd10666bf80d49c870acf57dafbe7ffc6913 features: python: acceptHeaders: 3.0.0 @@ -4342,8 +4342,8 @@ trackedFiles: pristine_git_object: 5d617cac37f7b364f4dd0640246e97c34351d824 docs/components/speechrequest.mdx: id: 06e81b0433f6 - last_write_checksum: sha1:f56d694567b45d6656c3bf4e84a19283d526014c - pristine_git_object: b16289c3fc9ba1db2880a5e3e6de9b747e2acdb8 + last_write_checksum: sha1:76fa6d5d3d316f4c7b205f656b4cebe4c15c8bea + pristine_git_object: de4caacffca57c3d03275206dd4288335fe6c532 docs/components/speechrequestprovider.mdx: id: 4f78ed0394c4 last_write_checksum: sha1:99d94c6b01dbd3e875c213584f97c7dca545a6a9 @@ -5354,8 +5354,8 @@ trackedFiles: pristine_git_object: 78fe3a35c7c813e4554c8b8d3e403f4902a17c32 docs/operations/createaudiospeechrequest.mdx: id: 097a81eed964 - last_write_checksum: sha1:1a773adccf87e107b0648cc0034e97613378f47f - pristine_git_object: 176fe2508bf060b22bf9f2c8c8fd158a96fef19e + last_write_checksum: sha1:ed83c321078683a0cffabd503750b31a30927c72 + pristine_git_object: a9aaac38a7f70c589c212a1ed00d95196d285117 docs/operations/createaudiotranscriptionsglobals.mdx: id: 3a50c3fec9de last_write_checksum: sha1:df0aebe1971befd5930236620a6ea94dbec73898 @@ -6582,8 +6582,8 @@ trackedFiles: pristine_git_object: 003f85994a515547fe80dcc316ccc19d81c5322d docs/sdks/tts/README.mdx: id: cd1132543884 - last_write_checksum: sha1:d28728db90dbab11f336d772b27544bb41ecceee - pristine_git_object: dca713aa3629e162924844de964be74e9b4ed081 + last_write_checksum: sha1:748da68a8d8e057dabb7af4297b5d8adf737f8b0 + pristine_git_object: f02ae88383dec340e4cd0f20d82363155bc08852 docs/sdks/videogeneration/README.mdx: id: 9a8fa04c3872 last_write_checksum: sha1:7d3c54cf2daa98e25df18bc27cc4ca30b2b1f03f @@ -6598,8 +6598,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:83fda8e0d22a9e98c001a57ae2b979e138982e1c - pristine_git_object: 93ce03b87a33bacca825a80068c0f35031bee5aa + last_write_checksum: sha1:5d3a57b654b24aa3e1d864860193cd49e30c8158 + pristine_git_object: 6c7ed425b8481808595bc0c2ea6bf15eead35678 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6626,8 +6626,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:b1160bf575302810a304f12f55b90ef8c9c6c52f - pristine_git_object: 2310169385ee80282e62878e83ef079a52994708 + last_write_checksum: sha1:01c911de175165f5a511285a446e1bb9b86fc01a + pristine_git_object: 400898618adb2f15eac43a4e6b1cb1f093b04c2d src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -10175,7 +10175,7 @@ examples: createAudioSpeech: speakeasy-default-create-audio-speech: requestBody: - application/json: {"input": "Hello world", "model": "elevenlabs/eleven-turbo-v2", "response_format": "pcm", "voice": "alloy"} + application/json: {"input": "Hello world", "model": "mistralai/voxtral-mini-tts-2603", "response_format": "pcm", "voice": "en_paul_neutral"} responses: "200": audio/*: "" @@ -10981,4 +10981,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.byok.list()`: \n * `request.provider` **Changed**\n * `response.data[].provider.enum(meta)` **Added**\n* `open_router.byok.create()`: \n * `request.provider.enum(meta)` **Added**\n * `response.data.provider.enum(meta)` **Added**\n* `open_router.byok.get()`: `response.data.provider.enum(meta)` **Added**\n* `open_router.byok.update()`: `response.data.provider.enum(meta)` **Added**\n* `open_router.chat.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.embeddings.generate()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `response.data[].provider_name.enum(meta)` **Added**\n* `open_router.endpoints.list()`: `response.data.endpoints[].provider_name.enum(meta)` **Added**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n* `open_router.rerank.rerank()`: \n * `request.provider.ignore[].union(ProviderName).enum(meta)` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4797430..b0c9bfe 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.22 + version: 0.11.23 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 1eb104c..0423eaf 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -20531,10 +20531,10 @@ components: description: Text-to-speech request input example: input: Hello world - model: elevenlabs/eleven-turbo-v2 + model: mistralai/voxtral-mini-tts-2603 response_format: pcm speed: 1 - voice: alloy + voice: en_paul_neutral properties: input: description: Text to synthesize @@ -20542,7 +20542,7 @@ components: type: string model: description: TTS model identifier - example: elevenlabs/eleven-turbo-v2 + example: mistralai/voxtral-mini-tts-2603 type: string provider: description: Provider-specific passthrough configuration @@ -20567,7 +20567,7 @@ components: type: number voice: description: Voice identifier (provider-specific). - example: alloy + example: en_paul_neutral type: string required: - model @@ -24185,10 +24185,10 @@ paths: application/json: example: input: Hello world - model: elevenlabs/eleven-turbo-v2 + model: mistralai/voxtral-mini-tts-2603 response_format: pcm speed: 1 - voice: alloy + voice: en_paul_neutral schema: $ref: '#/components/schemas/SpeechRequest' required: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 45ab314..ac79a9f 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:de69b2f9b07e26db9104e074f6c2efe678f98a34d8ad38f2c49e19979748896a - sourceBlobDigest: sha256:84fbbf832a15ad74f1815d7bceec21fec641147b3845a4b07810f1787bcc5625 + sourceRevisionDigest: sha256:91baf68600b99a1acb7cb48770bd8c65f2b52078522d9da36800b7643cafc19f + sourceBlobDigest: sha256:02edebbb16b70cdfd1a10bb719ff1031e41efca6d359d06417af23a8aea281cf tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:de69b2f9b07e26db9104e074f6c2efe678f98a34d8ad38f2c49e19979748896a - sourceBlobDigest: sha256:84fbbf832a15ad74f1815d7bceec21fec641147b3845a4b07810f1787bcc5625 + sourceRevisionDigest: sha256:91baf68600b99a1acb7cb48770bd8c65f2b52078522d9da36800b7643cafc19f + sourceBlobDigest: sha256:02edebbb16b70cdfd1a10bb719ff1031e41efca6d359d06417af23a8aea281cf codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f5f3107951a498aed04ec33877a0e8ec5dc1fcecf169f70fd3a3ce1db66f8dad + codeSamplesRevisionDigest: sha256:4d79cd30506971bb612d61d9874f75ba05d12922734d2c246672e3607f98b17b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 2728fbf..28a3ac2 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -328,4 +328,14 @@ Based on: ### Generated - [python v0.11.22] . ### Releases -- [PyPI v0.11.22] https://pypi.org/project/openrouter/0.11.22 - . \ No newline at end of file +- [PyPI v0.11.22] https://pypi.org/project/openrouter/0.11.22 - . + +## 2026-07-12 16:36:57 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.23] . +### Releases +- [PyPI v0.11.23] https://pypi.org/project/openrouter/0.11.23 - . \ No newline at end of file diff --git a/docs/components/speechrequest.mdx b/docs/components/speechrequest.mdx index b16289c..de4caac 100644 --- a/docs/components/speechrequest.mdx +++ b/docs/components/speechrequest.mdx @@ -10,8 +10,8 @@ Text-to-speech request input | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | -| `model` | *str* | :heavy_check_mark: | TTS model identifier | elevenlabs/eleven-turbo-v2 | +| `model` | *str* | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | | `provider` | [Optional[components.SpeechRequestProvider]](../components/speechrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | | `response_format` | [Optional[components.SpeechRequestResponseFormat]](../components/speechrequestresponseformat.mdx) | :heavy_minus_sign: | Audio output format | pcm | | `speed` | *Optional[float]* | :heavy_minus_sign: | Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers. | 1 | -| `voice` | *str* | :heavy_check_mark: | Voice identifier (provider-specific). | alloy | \ No newline at end of file +| `voice` | *str* | :heavy_check_mark: | Voice identifier (provider-specific). | en_paul_neutral | \ No newline at end of file diff --git a/docs/operations/createaudiospeechrequest.mdx b/docs/operations/createaudiospeechrequest.mdx index 176fe25..a9aaac3 100644 --- a/docs/operations/createaudiospeechrequest.mdx +++ b/docs/operations/createaudiospeechrequest.mdx @@ -9,4 +9,4 @@ title: "CreateAudioSpeechRequest" | `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.
| | -| `speech_request` | [components.SpeechRequest](../components/speechrequest.mdx) | :heavy_check_mark: | N/A | \{
"input": "Hello world",
"model": "elevenlabs/eleven-turbo-v2",
"response_format": "pcm",
"speed": 1,
"voice": "alloy"
} | \ No newline at end of file +| `speech_request` | [components.SpeechRequest](../components/speechrequest.mdx) | :heavy_check_mark: | N/A | \{
"input": "Hello world",
"model": "mistralai/voxtral-mini-tts-2603",
"response_format": "pcm",
"speed": 1,
"voice": "en_paul_neutral"
} | \ No newline at end of file diff --git a/docs/sdks/tts/README.mdx b/docs/sdks/tts/README.mdx index dca713a..f02ae88 100644 --- a/docs/sdks/tts/README.mdx +++ b/docs/sdks/tts/README.mdx @@ -29,7 +29,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.tts.create_speech(input="Hello world", model="elevenlabs/eleven-turbo-v2", voice="alloy", response_format="pcm", speed=1) + res = open_router.tts.create_speech(input="Hello world", model="mistralai/voxtral-mini-tts-2603", voice="en_paul_neutral", response_format="pcm", speed=1) # Handle response print(res) @@ -41,8 +41,8 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `input` | *str* | :heavy_check_mark: | Text to synthesize | Hello world | -| `model` | *str* | :heavy_check_mark: | TTS model identifier | elevenlabs/eleven-turbo-v2 | -| `voice` | *str* | :heavy_check_mark: | Voice identifier (provider-specific). | alloy | +| `model` | *str* | :heavy_check_mark: | TTS model identifier | mistralai/voxtral-mini-tts-2603 | +| `voice` | *str* | :heavy_check_mark: | Voice identifier (provider-specific). | en_paul_neutral | | `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | diff --git a/pyproject.toml b/pyproject.toml index 93ce03b..6c7ed42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.22" +version = "0.11.23" 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 2310169..4008986 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.22" +__version__: str = "0.11.23" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.22 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.23 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/uv.lock b/uv.lock index 63bad3f..78390fc 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.22" +version = "0.11.23" source = { editable = "." } dependencies = [ { name = "httpcore" }, From cb1b9c5ac6e3f2f5380903319da0d5d36423ecd6 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 17:53:31 +0000 Subject: [PATCH 43/62] chore: update OpenAPI spec from monorepo (#435) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 503 ++++++++++++++++++++++++++++--------- 1 file changed, 385 insertions(+), 118 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index dec6619..f40b69a 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -199,7 +199,7 @@ components: - $ref: '#/components/schemas/FilesServerTool' - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/SearchModelsServerTool_OpenRouter' - $ref: '#/components/schemas/WebFetchServerTool' - $ref: '#/components/schemas/WebSearchServerTool_OpenRouter' - $ref: '#/components/schemas/ApplyPatchServerTool_OpenRouter' @@ -965,6 +965,42 @@ components: - start_block_index - end_block_index type: object + AnthropicCitationSearchResultLocationParam: + example: + cited_text: Example cited text + end_block_index: 1 + search_result_index: 0 + source: example_source + start_block_index: 0 + title: Example Result + type: search_result_location + properties: + cited_text: + type: string + end_block_index: + type: integer + search_result_index: + type: integer + source: + type: string + start_block_index: + type: integer + title: + nullable: true + type: string + type: + enum: + - search_result_location + type: string + required: + - type + - cited_text + - search_result_index + - source + - title + - start_block_index + - end_block_index + type: object AnthropicCitationWebSearchResultLocation: example: cited_text: Example cited text @@ -993,6 +1029,34 @@ components: - title - url type: object + AnthropicCitationWebSearchResultLocationParam: + example: + cited_text: Example cited text + encrypted_index: enc_idx_0 + title: Example Page + type: web_search_result_location + url: https://example.com + properties: + cited_text: + type: string + encrypted_index: + type: string + title: + nullable: true + type: string + type: + enum: + - web_search_result_location + type: string + url: + type: string + required: + - type + - cited_text + - encrypted_index + - title + - url + type: object AnthropicCodeExecution20250825Caller: example: tool_id: toolu_01abc @@ -1607,15 +1671,15 @@ components: char_location: '#/components/schemas/AnthropicCitationCharLocationParam' content_block_location: '#/components/schemas/AnthropicCitationContentBlockLocationParam' page_location: '#/components/schemas/AnthropicCitationPageLocationParam' - search_result_location: '#/components/schemas/AnthropicCitationSearchResultLocation' - web_search_result_location: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + search_result_location: '#/components/schemas/AnthropicCitationSearchResultLocationParam' + web_search_result_location: '#/components/schemas/AnthropicCitationWebSearchResultLocationParam' propertyName: type oneOf: - $ref: '#/components/schemas/AnthropicCitationCharLocationParam' - $ref: '#/components/schemas/AnthropicCitationPageLocationParam' - $ref: '#/components/schemas/AnthropicCitationContentBlockLocationParam' - - $ref: '#/components/schemas/AnthropicCitationWebSearchResultLocation' - - $ref: '#/components/schemas/AnthropicCitationSearchResultLocation' + - $ref: '#/components/schemas/AnthropicCitationWebSearchResultLocationParam' + - $ref: '#/components/schemas/AnthropicCitationSearchResultLocationParam' nullable: true type: array text: @@ -4596,6 +4660,18 @@ components: - type - grammar type: object + ChatFormatJsonObjectConfig: + description: JSON object response format + example: + type: json_object + properties: + type: + enum: + - json_object + type: string + required: + - type + type: object ChatFormatJsonSchemaConfig: description: JSON Schema response format for structured outputs example: @@ -5026,7 +5102,7 @@ components: discriminator: mapping: grammar: '#/components/schemas/ChatFormatGrammarConfig' - json_object: '#/components/schemas/FormatJsonObjectConfig' + json_object: '#/components/schemas/ChatFormatJsonObjectConfig' json_schema: '#/components/schemas/ChatFormatJsonSchemaConfig' python: '#/components/schemas/ChatFormatPythonConfig' text: '#/components/schemas/ChatFormatTextConfig' @@ -5035,7 +5111,7 @@ components: type: json_object oneOf: - $ref: '#/components/schemas/ChatFormatTextConfig' - - $ref: '#/components/schemas/FormatJsonObjectConfig' + - $ref: '#/components/schemas/ChatFormatJsonObjectConfig' - $ref: '#/components/schemas/ChatFormatJsonSchemaConfig' - $ref: '#/components/schemas/ChatFormatGrammarConfig' - $ref: '#/components/schemas/ChatFormatPythonConfig' @@ -6783,7 +6859,7 @@ components: example: true type: boolean filter_rules: - $ref: '#/components/schemas/ObservabilityFilterRulesConfig' + $ref: '#/components/schemas/ObservabilityFilterRulesConfigNullable' name: description: Human-readable name for the destination. example: Production Langfuse @@ -10041,6 +10117,15 @@ components: - text - phase type: object + ImageInputModality: + enum: + - text + - image + - file + - audio + - video + example: text + type: string ImageModelArchitecture: example: input_modalities: @@ -10052,7 +10137,7 @@ components: input_modalities: description: Supported input modalities items: - $ref: '#/components/schemas/InputModality' + $ref: '#/components/schemas/ImageInputModality' type: array output_modalities: description: Supported output modalities @@ -10768,11 +10853,22 @@ components: - input_video type: string video_url: - $ref: '#/components/schemas/ChatContentVideoInput' + $ref: '#/components/schemas/Legacy_ChatContentVideoInput' required: - type - video_url type: object + Legacy_ChatContentVideoInput: + description: Video input object + example: + url: https://example.com/video.mp4 + properties: + url: + description: 'URL of the video (data: URLs supported)' + type: string + required: + - url + type: object Legacy_WebSearchServerTool: description: Web search tool configuration example: @@ -12570,7 +12666,7 @@ components: - $ref: '#/components/schemas/BashServerTool' - $ref: '#/components/schemas/DatetimeServerTool' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/MessagesSearchModelsServerTool' - $ref: '#/components/schemas/WebFetchServerTool' - $ref: '#/components/schemas/OpenRouterWebSearchServerTool' - additionalProperties: @@ -12680,6 +12776,22 @@ components: output_tokens: 15 server_tool_use: null service_tier: standard + MessagesSearchModelsServerTool: + description: 'OpenRouter built-in server tool: searches and filters AI models available on OpenRouter' + example: + parameters: + max_results: 5 + type: openrouter:experimental__search_models + properties: + parameters: + $ref: '#/components/schemas/SearchModelsServerToolConfig' + type: + enum: + - openrouter:experimental__search_models + type: string + required: + - type + type: object MessagesStartEvent: description: Event sent at the start of a streaming message example: @@ -13101,34 +13213,7 @@ components: $ref: '#/components/schemas/InputModality' type: array instruct_type: - description: Instruction format type - enum: - - none - - airoboros - - alpaca - - alpaca-modif - - chatml - - claude - - code-llama - - gemma - - llama2 - - llama3 - - mistral - - nemotron - - neural - - openchat - - phi3 - - rwkv - - vicuna - - zephyr - - deepseek-r1 - - deepseek-v3.1 - - qwq - - qwen3 - - null - example: chatml - nullable: true - type: string + $ref: '#/components/schemas/InstructType' modality: description: Primary modality of the model example: text->text @@ -13337,7 +13422,7 @@ components: id: openai/gpt-4 knowledge_cutoff: null links: - details: /api/v1/models/openai/gpt-5.4/endpoints + details: /api/v1/models/openai/gpt-4/endpoints name: GPT-4 per_request_limits: null pricing: @@ -13356,11 +13441,31 @@ components: context_length: 8192 is_moderated: true max_completion_tokens: 4096 + links: + next: /api/v1/models?offset=500&limit=500 + total_count: 150 properties: data: $ref: '#/components/schemas/ModelsListResponseData' + links: + description: Pagination links + properties: + next: + description: URL for the next page of results, or null if this is the last page + example: /api/v1/models?offset=500&limit=500 + nullable: true + type: string + required: + - next + type: object + total_count: + description: Total number of models matching the query + example: 150 + type: integer required: - data + - total_count + - links type: object ModelsListResponseData: description: List of available models @@ -13382,7 +13487,7 @@ components: id: openai/gpt-4 knowledge_cutoff: null links: - details: /api/v1/models/openai/gpt-5.4/endpoints + details: /api/v1/models/openai/gpt-4/endpoints name: GPT-4 per_request_limits: null pricing: @@ -13953,6 +14058,66 @@ components: - $ref: '#/components/schemas/ObservabilitySnowflakeDestination' - $ref: '#/components/schemas/ObservabilityWeaveDestination' - $ref: '#/components/schemas/ObservabilityWebhookDestination' + ObservabilityFilterRuleGroup: + example: + logic: and + rules: + - field: model + operator: equals + value: openai/gpt-4o + properties: + logic: + default: and + enum: + - and + - or + type: string + rules: + items: + properties: + field: + enum: + - model + - provider + - session_id + - user_id + - api_key_name + - finish_reason + - input + - output + - total_cost + - total_tokens + - prompt_tokens + - completion_tokens + type: string + operator: + enum: + - equals + - not_equals + - contains + - not_contains + - regex + - starts_with + - ends_with + - gt + - lt + - gte + - lte + - exists + - not_exists + type: string + value: + anyOf: + - type: string + - type: number + required: + - field + - operator + type: object + type: array + required: + - rules + type: object ObservabilityFilterRulesConfig: description: Optional structured filter rules controlling which events are forwarded. example: null @@ -13963,59 +14128,22 @@ components: type: boolean groups: items: - properties: - logic: - default: and - enum: - - and - - or - type: string - rules: - items: - properties: - field: - enum: - - model - - provider - - session_id - - user_id - - api_key_name - - finish_reason - - input - - output - - total_cost - - total_tokens - - prompt_tokens - - completion_tokens - type: string - operator: - enum: - - equals - - not_equals - - contains - - not_contains - - regex - - starts_with - - ends_with - - gt - - lt - - gte - - lte - - exists - - not_exists - type: string - value: - anyOf: - - type: string - - type: number - required: - - field - - operator - type: object - type: array - required: - - rules - type: object + $ref: '#/components/schemas/ObservabilityFilterRuleGroup' + type: array + required: + - groups + type: object + ObservabilityFilterRulesConfigNullable: + description: Optional structured filter rules controlling which events are forwarded. + example: null + nullable: true + properties: + enabled: + default: true + type: boolean + groups: + items: + $ref: '#/components/schemas/ObservabilityFilterRuleGroup' type: array required: - groups @@ -20312,7 +20440,7 @@ components: - $ref: '#/components/schemas/FilesServerTool' - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/SearchModelsServerTool_OpenRouter' - $ref: '#/components/schemas/WebFetchServerTool' - $ref: '#/components/schemas/WebSearchServerTool_OpenRouter' - $ref: '#/components/schemas/ApplyPatchServerTool_OpenRouter' @@ -20410,6 +20538,22 @@ components: - high example: medium type: string + SearchModelsServerTool_OpenRouter: + description: 'OpenRouter built-in server tool: searches and filters AI models available on OpenRouter' + example: + parameters: + max_results: 5 + type: openrouter:experimental__search_models + properties: + parameters: + $ref: '#/components/schemas/SearchModelsServerToolConfig' + type: + enum: + - openrouter:experimental__search_models + type: string + required: + - type + type: object SearchModelsServerToolConfig: description: Configuration for the openrouter:experimental__search_models server tool example: @@ -22522,7 +22666,7 @@ components: type: boolean filter_rules: allOf: - - $ref: '#/components/schemas/ObservabilityFilterRulesConfig' + - $ref: '#/components/schemas/ObservabilityFilterRulesConfigNullable' - description: Optional structured filter rules. `null` clears the rules. Omitting keeps the current value. name: description: Human-readable name for the destination. @@ -25122,6 +25266,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -25132,6 +25277,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -26723,27 +26869,7 @@ paths: format: double type: number cost_details: - description: Breakdown of upstream inference costs - example: - upstream_inference_completions_cost: 0.0004 - upstream_inference_cost: null - upstream_inference_prompt_cost: 0.0008 - nullable: true - properties: - upstream_inference_completions_cost: - format: double - type: number - upstream_inference_cost: - format: double - nullable: true - type: number - upstream_inference_prompt_cost: - format: double - type: number - required: - - upstream_inference_prompt_cost - - upstream_inference_completions_cost - type: object + $ref: '#/components/schemas/CostDetails' is_byok: description: Whether a request was made using a Bring Your Own Key configuration type: boolean @@ -26903,6 +27029,35 @@ paths: get: description: Returns a list of all available embeddings models and their properties operationId: listEmbeddingsModels + 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 + nullable: true + type: integer + - description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is + returned + in: query + name: limit + required: false + schema: + default: 500 + description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is + returned + example: 500 + maximum: 1000 + minimum: 1 + type: integer responses: '200': content: @@ -26967,6 +27122,17 @@ paths: tags: - Embeddings x-speakeasy-name-override: listModels + x-speakeasy-pagination: + inputs: + - in: parameters + name: offset + type: offset + - in: parameters + name: limit + type: limit + outputs: + results: $.data + type: offsetLimit /endpoints/zdr: get: operationId: listEndpointsZdr @@ -27863,6 +28029,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -27873,6 +28040,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28295,6 +28463,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28305,6 +28474,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28548,6 +28718,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28558,6 +28729,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28793,6 +28965,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28803,6 +28976,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28872,6 +29046,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28882,6 +29057,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -31016,6 +31192,34 @@ paths: get: operationId: getModels 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 + nullable: true + type: integer + - description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is + returned + in: query + name: limit + required: false + schema: + default: 500 + description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is + returned + example: 500 + maximum: 1000 + minimum: 1 + type: integer - description: Filter models by use case category in: query name: category @@ -31408,6 +31612,17 @@ paths: tags: - Models x-speakeasy-name-override: list + x-speakeasy-pagination: + inputs: + - in: parameters + name: offset + type: offset + - in: parameters + name: limit + type: limit + outputs: + results: $.data + type: offsetLimit /models/{author}/{slug}/endpoints: get: operationId: listEndpoints @@ -31586,6 +31801,35 @@ paths: `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing). operationId: listModelsUser + 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 + nullable: true + type: integer + - description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is + returned + in: query + name: limit + required: false + schema: + default: 500 + description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is + returned + example: 500 + maximum: 1000 + minimum: 1 + type: integer responses: '200': content: @@ -31609,7 +31853,7 @@ paths: id: openai/gpt-4 knowledge_cutoff: null links: - details: /api/v1/models/openai/gpt-5.4/endpoints + details: /api/v1/models/openai/gpt-4/endpoints name: GPT-4 per_request_limits: null pricing: @@ -31665,6 +31909,17 @@ paths: tags: - Models x-speakeasy-name-override: listForUser + x-speakeasy-pagination: + inputs: + - in: parameters + name: offset + type: offset + - in: parameters + name: limit + type: limit + outputs: + results: $.data + type: offsetLimit /observability/destinations: get: description: >- @@ -31679,6 +31934,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -31689,6 +31945,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -32106,6 +32363,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -32116,6 +32374,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -32236,6 +32495,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -32246,6 +32506,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -32801,6 +33062,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -32811,6 +33073,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -34413,6 +34676,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -34423,6 +34687,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -35068,6 +35333,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -35078,6 +35344,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 From 7010ca5c2e7b97c3c69c7055d94732e98b8c1793 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 17:59:18 +0000 Subject: [PATCH 44/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.24=20(#436)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 487 ++++++++++------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 502 +++++++++++++----- .speakeasy/workflow.lock | 10 +- README-PYPI.md | 2 +- README.md | 2 +- RELEASES.md | 12 +- .../additionaltoolsitemtoolunion.mdx | 4 +- .../anthropiccitationsearchresultlocation.mdx | 15 - ...ropiccitationsearchresultlocationparam.mdx | 15 + ...ccitationsearchresultlocationparamtype.mdx | 15 + ...hropiccitationsearchresultlocationtype.mdx | 15 - ...thropiccitationwebsearchresultlocation.mdx | 13 - ...iccitationwebsearchresultlocationparam.mdx | 13 + ...tationwebsearchresultlocationparamtype.mdx | 15 + ...piccitationwebsearchresultlocationtype.mdx | 15 - .../components/chatformatjsonobjectconfig.mdx | 12 + .../chatformatjsonobjectconfigtype.mdx | 15 + docs/components/citation.mdx | 8 +- .../createobservabilitydestinationrequest.mdx | 2 +- docs/components/imageinputmodality.mdx | 23 + docs/components/imagemodelarchitecture.mdx | 2 +- docs/components/legacychatcontentvideo.mdx | 8 +- .../legacychatcontentvideoinput.mdx | 12 + docs/components/links.mdx | 12 + docs/components/messagesrequesttoolunion.mdx | 4 +- .../messagessearchmodelsservertool.mdx | 13 + .../messagessearchmodelsservertooltype.mdx | 15 + docs/components/modelarchitecture.mdx | 14 +- .../modelarchitectureinstructtype.mdx | 42 -- docs/components/modelslistresponse.mdx | 8 +- ...p.mdx => observabilityfilterrulegroup.mdx} | 2 +- ... => observabilityfilterrulegroupvalue.mdx} | 2 +- .../observabilityfilterrulesconfig.mdx | 8 +- ...observabilityfilterrulesconfignullable.mdx | 13 + docs/components/responseformat.mdx | 4 +- docs/components/responsesrequesttoolunion.mdx | 4 +- docs/components/rule.mdx | 10 +- .../searchmodelsservertoolopenrouter.mdx | 13 + .../searchmodelsservertoolopenroutertype.mdx | 15 + .../updateobservabilitydestinationrequest.mdx | 2 +- docs/operations/costdetails.mdx | 14 - docs/operations/createembeddingsusage.mdx | 2 +- docs/operations/getmodelsrequest.mdx | 2 + docs/operations/getmodelsresponse.mdx | 9 + .../listembeddingsmodelsrequest.mdx | 12 +- .../listembeddingsmodelsresponse.mdx | 9 + docs/operations/listmodelsuserrequest.mdx | 12 +- docs/operations/listmodelsuserresponse.mdx | 9 + docs/sdks/byok/README.mdx | 2 +- docs/sdks/embeddings/README.mdx | 24 +- docs/sdks/guardrails/README.mdx | 10 +- docs/sdks/models/README.mdx | 38 +- docs/sdks/observability/README.mdx | 6 +- docs/sdks/organization/README.mdx | 2 +- docs/sdks/presets/README.mdx | 4 +- docs/sdks/workspaces/README.mdx | 4 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/byok.py | 12 +- src/openrouter/components/__init__.py | 153 ++++-- .../components/additionaltoolsitem.py | 12 +- ...ropiccitationsearchresultlocationparam.py} | 10 +- ...iccitationwebsearchresultlocationparam.py} | 12 +- .../components/anthropictextblockparam.py | 23 +- .../components/chatformatjsonobjectconfig.py | 21 + src/openrouter/components/chatrequest.py | 12 +- .../createobservabilitydestinationrequest.py | 10 +- .../components/imageinputmodality.py | 17 + .../components/imagemodelarchitecture.py | 6 +- .../components/legacy_chatcontentvideo.py | 9 +- .../legacy_chatcontentvideoinput.py | 19 + src/openrouter/components/messagesrequest.py | 12 +- .../messagessearchmodelsservertool.py | 47 ++ .../components/modelarchitecture.py | 38 +- .../components/modelslistresponse.py | 41 +- .../observabilityfilterrulegroup.py | 122 +++++ .../observabilityfilterrulesconfig.py | 129 +---- .../observabilityfilterrulesconfignullable.py | 42 ++ src/openrouter/components/responsesrequest.py | 13 +- .../searchmodelsservertool_openrouter.py | 49 ++ .../updateobservabilitydestinationrequest.py | 10 +- src/openrouter/embeddings.py | 86 ++- src/openrouter/guardrails.py | 60 +-- src/openrouter/models_.py | 225 +++++++- src/openrouter/observability.py | 36 +- src/openrouter/operations/__init__.py | 24 +- src/openrouter/operations/createembeddings.py | 48 +- src/openrouter/operations/getmodels.py | 34 +- src/openrouter/operations/listbyokkeys.py | 4 +- .../operations/listembeddingsmodels.py | 42 +- .../operations/listguardrailkeyassignments.py | 4 +- .../listguardrailmemberassignments.py | 4 +- src/openrouter/operations/listguardrails.py | 4 +- .../operations/listkeyassignments.py | 4 +- .../operations/listmemberassignments.py | 4 +- src/openrouter/operations/listmodelsuser.py | 47 +- .../listobservabilitydestinations.py | 4 +- .../operations/listorganizationmembers.py | 4 +- src/openrouter/operations/listpresets.py | 4 +- .../operations/listpresetversions.py | 4 +- .../operations/listworkspacemembers.py | 4 +- src/openrouter/operations/listworkspaces.py | 4 +- src/openrouter/organization.py | 12 +- src/openrouter/presets.py | 24 +- src/openrouter/workspaces.py | 24 +- uv.lock | 2 +- 107 files changed, 2135 insertions(+), 961 deletions(-) delete mode 100644 docs/components/anthropiccitationsearchresultlocation.mdx create mode 100644 docs/components/anthropiccitationsearchresultlocationparam.mdx create mode 100644 docs/components/anthropiccitationsearchresultlocationparamtype.mdx delete mode 100644 docs/components/anthropiccitationsearchresultlocationtype.mdx delete mode 100644 docs/components/anthropiccitationwebsearchresultlocation.mdx create mode 100644 docs/components/anthropiccitationwebsearchresultlocationparam.mdx create mode 100644 docs/components/anthropiccitationwebsearchresultlocationparamtype.mdx delete mode 100644 docs/components/anthropiccitationwebsearchresultlocationtype.mdx create mode 100644 docs/components/chatformatjsonobjectconfig.mdx create mode 100644 docs/components/chatformatjsonobjectconfigtype.mdx create mode 100644 docs/components/imageinputmodality.mdx create mode 100644 docs/components/legacychatcontentvideoinput.mdx create mode 100644 docs/components/links.mdx create mode 100644 docs/components/messagessearchmodelsservertool.mdx create mode 100644 docs/components/messagessearchmodelsservertooltype.mdx delete mode 100644 docs/components/modelarchitectureinstructtype.mdx rename docs/components/{group.mdx => observabilityfilterrulegroup.mdx} (95%) rename docs/components/{observabilityfilterrulesconfigvalue.mdx => observabilityfilterrulegroupvalue.mdx} (76%) create mode 100644 docs/components/observabilityfilterrulesconfignullable.mdx create mode 100644 docs/components/searchmodelsservertoolopenrouter.mdx create mode 100644 docs/components/searchmodelsservertoolopenroutertype.mdx delete mode 100644 docs/operations/costdetails.mdx create mode 100644 docs/operations/getmodelsresponse.mdx create mode 100644 docs/operations/listembeddingsmodelsresponse.mdx create mode 100644 docs/operations/listmodelsuserresponse.mdx rename src/openrouter/components/{anthropiccitationsearchresultlocation.py => anthropiccitationsearchresultlocationparam.py} (73%) rename src/openrouter/components/{anthropiccitationwebsearchresultlocation.py => anthropiccitationwebsearchresultlocationparam.py} (69%) create mode 100644 src/openrouter/components/chatformatjsonobjectconfig.py create mode 100644 src/openrouter/components/imageinputmodality.py create mode 100644 src/openrouter/components/legacy_chatcontentvideoinput.py create mode 100644 src/openrouter/components/messagessearchmodelsservertool.py create mode 100644 src/openrouter/components/observabilityfilterrulegroup.py create mode 100644 src/openrouter/components/observabilityfilterrulesconfignullable.py create mode 100644 src/openrouter/components/searchmodelsservertool_openrouter.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index febf4bd..7bcf87c 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: b5664b53681fb6403943916bb9b110bc + docChecksum: 992dd7bf5d636d875da8e17e4faaed29 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.23 - configChecksum: 47c73c3494869121d190f901e061e5d9 + releaseVersion: 0.11.24 + configChecksum: b26850041dd0457b248bd1e3bb936fa6 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: e4b4974f-8771-44db-babf-659fe2ac2518 - pristine_commit_hash: f72edbf6eebf0c3406c03b3a608aacb71c6122ce - pristine_tree_hash: 42c1bd10666bf80d49c870acf57dafbe7ffc6913 + generation_id: d85ca6f5-dca8-4c80-9b34-a859642d0dd5 + pristine_commit_hash: d8a45b3c5aa026db485cc892cce4ce59f9b2d9e3 + pristine_tree_hash: cb0f77756ac02a67faf406ee499b1f9ea70061f0 features: python: acceptHeaders: 3.0.0 @@ -126,8 +126,8 @@ trackedFiles: pristine_git_object: d78714317e328d9131e563de7807db0761bb3da1 docs/components/additionaltoolsitemtoolunion.mdx: id: b3e8598b1887 - last_write_checksum: sha1:930eb580f2512a07b58b830f588dedad8ecab631 - pristine_git_object: 5fc5576b0d88994c2e7d6996181e51e5fd63fa94 + last_write_checksum: sha1:9337d3a54afac90f430e4c7fd9ecaed326f5995a + pristine_git_object: 31c685297062f6ac8d8a61943c4430500af47744 docs/components/additionaltoolsitemtypefunction.mdx: id: bf179b4008af last_write_checksum: sha1:c0d4fee7d39fbd3d08c44bbe0e7b929350c5d7e8 @@ -268,22 +268,22 @@ trackedFiles: id: 600fbeec8753 last_write_checksum: sha1:dcc72105e3f4c5f50ff39092ad82dc511d65e73b pristine_git_object: ebe0335b3a26503e24ffa142fb1c3907c5e23600 - docs/components/anthropiccitationsearchresultlocation.mdx: - id: 40f569d8ec6e - last_write_checksum: sha1:503cabd5f211da0e9681f802b63e6a242069e3eb - pristine_git_object: 4766fcaadfbff64d65a1b3fbffd3ae95cf8fe435 - docs/components/anthropiccitationsearchresultlocationtype.mdx: - id: 100166b3a8b6 - last_write_checksum: sha1:deed2eb89dc2d1c20b084e4e4c0a2c74b4f84b7c - pristine_git_object: 096cc0d6ce515592417e620b1340aa3b4ea02638 - docs/components/anthropiccitationwebsearchresultlocation.mdx: - id: 95ef98e8c423 - last_write_checksum: sha1:033b55c4b6e7cf6161a5d059d89ba0cd506d0d0d - pristine_git_object: b03268fdff9d48c3e99696ec02c0636c5d23871b - docs/components/anthropiccitationwebsearchresultlocationtype.mdx: - id: 1d41c18eef52 - last_write_checksum: sha1:a18a6f783fc84d86afb56b21cf08ca9d74297b0a - pristine_git_object: 9cb6d29da30e11fd653a9bb5a06c6f7592ea56c8 + docs/components/anthropiccitationsearchresultlocationparam.mdx: + id: 9ae72ccb3e72 + last_write_checksum: sha1:32fca32b7cee91aa9a77edfc5cd8fea9225c0863 + pristine_git_object: 8d0c9d2ac994806fc2d2e0c4de4aec4e4a058852 + docs/components/anthropiccitationsearchresultlocationparamtype.mdx: + id: aaf65427c659 + last_write_checksum: sha1:1c244ccc9dc3e9786157f7b79f0eae68b02a2895 + pristine_git_object: 36ba3e46039d4a40008345c0939a33f95bb36b8e + docs/components/anthropiccitationwebsearchresultlocationparam.mdx: + id: e8b10b5b40f7 + last_write_checksum: sha1:3078918f99892b68eae36856265f870675ef7604 + pristine_git_object: 9b59d45b7e4a9f43588692a661c71214ff316a30 + docs/components/anthropiccitationwebsearchresultlocationparamtype.mdx: + id: 584f4fda6d05 + last_write_checksum: sha1:5529e2c7a6402f204c3dcf7ed18522aefaeb73f4 + pristine_git_object: 4bc0197a7fdc78781b645d2c8f4b32bb0b71b571 docs/components/anthropiccompactionusageiteration.mdx: id: 9bcca00fbe93 last_write_checksum: sha1:7d79a2bda26c860d3da4882bf4c8b4e044d2ed56 @@ -888,6 +888,14 @@ trackedFiles: id: 8afc3b0c53f8 last_write_checksum: sha1:f86f220ce930d1a671b8c702bdea25dcefabfa94 pristine_git_object: 9b479f4efdecfa74ed55207183a0bce5d4d38f5b + docs/components/chatformatjsonobjectconfig.mdx: + id: 6e196fe09ae2 + last_write_checksum: sha1:3db48171b63121e740354c543989c4249f6ab23d + pristine_git_object: 5dae96c7348d2ff09b872408a35afd3bd546c0f1 + docs/components/chatformatjsonobjectconfigtype.mdx: + id: f4db08f0130b + last_write_checksum: sha1:13be1ecccc74426b6db1ed68b26bbc922e836022 + pristine_git_object: 617987c42d412b2814a55a00c73cc435469559c7 docs/components/chatformatjsonschemaconfig.mdx: id: fddf166f727d last_write_checksum: sha1:454f73f794c83adb2b86edc7bc9cba8b322405de @@ -1142,8 +1150,8 @@ trackedFiles: pristine_git_object: 6056c49814eafac5ca7ce25eb0da8413a358c8be docs/components/citation.mdx: id: 9a5f3d4dc85e - last_write_checksum: sha1:e87496dfef2b1f10bc75744fb01cd8c56dc36e1a - pristine_git_object: 9e503681992fded303416915b21d3e23d1296dca + last_write_checksum: sha1:caaf7b5e9d578c27e3347b6a74151450df7b979b + pristine_git_object: 262286806c125e7b4e306e43f29f964459157382 docs/components/cleartoolinputs.mdx: id: 4e474b90f4b7 last_write_checksum: sha1:2574803d7adf914b3f90850fbaea1af2cf6eaed5 @@ -1418,8 +1426,8 @@ trackedFiles: pristine_git_object: e876cac85124ae1a612a2611c11e7039a7eed07a docs/components/createobservabilitydestinationrequest.mdx: id: 8d942a601a6e - last_write_checksum: sha1:8bed1fb299e0fb1961ee90a07274a0803c977958 - pristine_git_object: a3435fe0c498da2ef18fe16d0afab27b813d3595 + last_write_checksum: sha1:968666d16e4c3b3249f7e533829d510c5c043179 + pristine_git_object: 065e043f3ea11140659cba056f490b634d435e62 docs/components/createobservabilitydestinationrequesttype.mdx: id: 0cb269425077 last_write_checksum: sha1:f8608dbed4fcc4407be03f34d5a5ab50c5cd085e @@ -2068,10 +2076,6 @@ trackedFiles: id: c8d0c4683019 last_write_checksum: sha1:d659e4cebde3a9a14eca14c4a95f1e9e53e46f06 pristine_git_object: bb16c1fd514e8e4d4f98dfbebd3a29bcdf8ee192 - docs/components/group.mdx: - id: 7a304030a713 - last_write_checksum: sha1:e7ac1a81dba9420ef0ca16b53648812273505a3b - pristine_git_object: 34495da0d0429ae52773d520030bb2b0807bc206 docs/components/guardrail.mdx: id: 91791d4c83b6 last_write_checksum: sha1:071ca3eb0a6f158e4107d7f337c3f7a8e6ac95f8 @@ -2256,10 +2260,14 @@ trackedFiles: id: 352d5a931932 last_write_checksum: sha1:6d49bb73e36c227f1db9a865435ec47fc3076986 pristine_git_object: fffb82a794389680343b9317dd08062214edf303 + docs/components/imageinputmodality.mdx: + id: dff1855cdca0 + last_write_checksum: sha1:20c35ad045c3933c34f357aab4e9dcde89e20f6d + pristine_git_object: 9062baf545e585b575fbe567868f05451aa5bbb5 docs/components/imagemodelarchitecture.mdx: id: 605b7d0df8cd - last_write_checksum: sha1:4d1003bc766ebe55e79e172c1f959ccb3b945487 - pristine_git_object: 6842d9d695c103dc85f93fa899cb2646c5c2d62a + last_write_checksum: sha1:eb762ec64e5e384c2a3e136fd1dfb9f07ce48d71 + pristine_git_object: 860b66299facaf33aa7f5d2ceac6e4657815a905 docs/components/imagemodelendpointsresponse.mdx: id: 831c40b45635 last_write_checksum: sha1:fd1f51f3157ff364b9c61def7734a5321eb66400 @@ -2534,8 +2542,12 @@ trackedFiles: pristine_git_object: 3c18ed0fb80fbc8cfd45667af06cdecde6a907d5 docs/components/legacychatcontentvideo.mdx: id: fd222b8b9445 - last_write_checksum: sha1:c77f3069be68b3a8fe5757bf31626d73606de778 - pristine_git_object: f1d4b3d542cadec3caabd2fbb99f8769221e37ee + last_write_checksum: sha1:d6819bc122734d7dbe9abf060ae31bac61361633 + pristine_git_object: 74b480b1c49cda64a8d30cf84e91c18d4f4fa32e + docs/components/legacychatcontentvideoinput.mdx: + id: ca6bd671604d + last_write_checksum: sha1:027a30a7edefff19d85cb0065c5c1521280418bc + pristine_git_object: d79ac0622f1c74b02e6f5ce1667c52b8244ff049 docs/components/legacychatcontentvideotype.mdx: id: 6ed2500f1a33 last_write_checksum: sha1:191077107def4be932273d87f6e81a2b3aefc412 @@ -2548,6 +2560,10 @@ trackedFiles: id: 192fa7358f3b last_write_checksum: sha1:c82facbab1f9b4f53e06a6e3986b886f2a9b9b00 pristine_git_object: 3bb4205e59ddb7d332e8d900afd2ee5aaa120dc0 + 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 @@ -2754,8 +2770,16 @@ trackedFiles: pristine_git_object: e6fae8228c3d685d6cfe815e3c24fa53fd642ff7 docs/components/messagesrequesttoolunion.mdx: id: cb1be4df3cf7 - last_write_checksum: sha1:f3afd12d5ecb4ceb5a4209dd03594abb8dcd626a - pristine_git_object: b24e866b9c3842956daae6c28351e0643c29fc49 + last_write_checksum: sha1:bf5c4e8ff92e9f7620dad799ef238f74d15a4102 + pristine_git_object: f5868bf92de456cf395b9bd769323ca35d3225a8 + docs/components/messagessearchmodelsservertool.mdx: + id: 1f9f5edef4fe + last_write_checksum: sha1:5d3026e9fc2eda9ed7c5e8a08aff7f09514d666e + pristine_git_object: e13f74e2abe12371b8dd6d13c85402c17650dc3c + docs/components/messagessearchmodelsservertooltype.mdx: + id: ecbd7f7f2e44 + last_write_checksum: sha1:b0dc13c5cf05011f6496565a4553eb52b9d09481 + pristine_git_object: 52ce907478e961eb90e709fca118e6d0631883d2 docs/components/metadatalevel.mdx: id: f564e5e9a7d3 last_write_checksum: sha1:e51f09243a346926c426f53b07865f5ed145511d @@ -2782,12 +2806,8 @@ trackedFiles: pristine_git_object: e8757cbafebf799b6f162a2b9d7a2aff95c67e4d docs/components/modelarchitecture.mdx: id: fe77e4816f6a - last_write_checksum: sha1:dcf6b88330ab80e643cb7e9b962489a85783002b - pristine_git_object: 3035c9bac4573c0b1a70f9b463ba1a0ce8cf36e2 - docs/components/modelarchitectureinstructtype.mdx: - id: 4064f8606ef4 - last_write_checksum: sha1:172862da64039b2e61ed05b24fbc4c0e219ef9b5 - pristine_git_object: c8d02132963a140b2d71c982b09bec0eed30d042 + last_write_checksum: sha1:ee0aa33ad4b453bc1a0de9aacb2d62b09fc19522 + pristine_git_object: d46fef4698df66a63c1a0e7dc7ac1793df265835 docs/components/modelbenchmarks.mdx: id: a56406a8820b last_write_checksum: sha1:556248629a58731cd01f96ad5972f9d09c00e8af @@ -2818,8 +2838,8 @@ trackedFiles: pristine_git_object: 9e1b9145d0352d47192a8427975702517923ef66 docs/components/modelslistresponse.mdx: id: 1880eae9f45e - last_write_checksum: sha1:660d60c5fb6e99883437e7e30da3586cbf35b57e - pristine_git_object: 140ec11b65ad7ee9bd3b3fd7933d21a49af3561e + last_write_checksum: sha1:37dc51e0d818c3561d0b7094cf6ab9e2cf44167d + pristine_git_object: ac531b92ce061a5062aa91aeac7ce68242c35fcf docs/components/moderation.mdx: id: d145b88b8b67 last_write_checksum: sha1:ed7cedc44d3043ef40007d3135774d168b30683d @@ -2920,14 +2940,22 @@ trackedFiles: id: 2b5b371b62ed last_write_checksum: sha1:eb15fe342436bb49fe24b4884c5989564149716f pristine_git_object: 3fcbba14f1e9d35a5b5f2aac22d4b4827a6ae149 + docs/components/observabilityfilterrulegroup.mdx: + id: 950cb2bcab56 + last_write_checksum: sha1:2d6488e843daf1826887e21964b08f7e22bea201 + pristine_git_object: 95aa7cfb8f9cf3bad8079923919c5ead01936d21 + docs/components/observabilityfilterrulegroupvalue.mdx: + id: 7394ec319945 + last_write_checksum: sha1:d35837b1d253d1d55e5d61923b4f47bb04eedc0f + pristine_git_object: af2effd1a0616aa1b534f4c3ecda08c6cce9333d docs/components/observabilityfilterrulesconfig.mdx: id: 7693db9b58d8 - last_write_checksum: sha1:e0ebf1b44bd0174e38fafee60ed17eca07c1606c - pristine_git_object: 46330428534ffced625fbd3b3a3b2da5f1a156d1 - docs/components/observabilityfilterrulesconfigvalue.mdx: - id: 7c5b26ae20b1 - last_write_checksum: sha1:f8558110d2cff9d5e3ac036fc7befacb12eaf105 - pristine_git_object: 6b335f615687720e4590e73578de2d4e9096b8b2 + last_write_checksum: sha1:83de5980ee1a40def4b464b77aeaf6aec2d83253 + pristine_git_object: 8393404427dfcb3512809c80e749961b758ab7eb + docs/components/observabilityfilterrulesconfignullable.mdx: + id: 8565a4dcf81d + last_write_checksum: sha1:0cbe6562ce8d9a3c26c0135acfb270f9ab32be72 + pristine_git_object: 842fa8f78a38e50486069046e7c2aef07997c600 docs/components/observabilitygrafanadestination.mdx: id: 933526705b96 last_write_checksum: sha1:75f67fe00561d8a7f163554ccec092903698df55 @@ -4158,8 +4186,8 @@ trackedFiles: pristine_git_object: f12a0a04d9dc4430ca6180c8507360d9bc7494cd docs/components/responseformat.mdx: id: 9b8deacad550 - last_write_checksum: sha1:2ca93510828412e375f9903be2c92bcefbacd177 - pristine_git_object: 29709effcd49176f32b4b99f9a37ed1309231549 + last_write_checksum: sha1:fab329e55c5d5be71c187de6a2ca592d7c1c3e68 + pristine_git_object: 4715eaef06706262e09a0108dab8c9fc2ef94f62 docs/components/responsehealingplugin.mdx: id: 5bf9b8008e95 last_write_checksum: sha1:1aa7dc7146a93a215d275571233ee63902a6e155 @@ -4206,8 +4234,8 @@ trackedFiles: pristine_git_object: 5f6cc606242e0f8343c7bef1d54e640fef620a80 docs/components/responsesrequesttoolunion.mdx: id: 96bafa5d19b1 - last_write_checksum: sha1:ea0dca57eedbc520f2a5097b8e0adc1b1f831be2 - pristine_git_object: bfec11b6f951665f3b0467a8e8f98e7f224a9350 + last_write_checksum: sha1:94c59f53bc6d9c13148eb65e73e8850d5714e6b1 + pristine_git_object: b06f8e77235ad31695cf106e56768f83c7432001 docs/components/responsesrequesttype.mdx: id: b2720876d384 last_write_checksum: sha1:9ed21e9f3c79e3936a4f6bc9df24eea499cc1e56 @@ -4234,8 +4262,8 @@ trackedFiles: pristine_git_object: 02852267fa52361a11f7732afe1e7818105196f0 docs/components/rule.mdx: id: 652b4ec56a02 - last_write_checksum: sha1:9e98bfe08cdbc0e13635a26c52a1d11003041b78 - pristine_git_object: d585c3be57a8c3843d6712c747983fbcdb692d17 + last_write_checksum: sha1:689f48837abf4c42c787a7a531e751d32d1e3c67 + pristine_git_object: 14a9f713694cfd61d45b800a23294d906482bca5 docs/components/searchcontextsizeenum.mdx: id: b6b9a99acb5f last_write_checksum: sha1:177016c42a56a7a8dcd40caa7e9105ca7a6ea1cc @@ -4244,6 +4272,14 @@ trackedFiles: id: afffad2845a2 last_write_checksum: sha1:4c205a6c239561b5813ec9202abeeef9e4e41331 pristine_git_object: fb2f7f7c53004cfee264fe37346b88af5cf7d61c + docs/components/searchmodelsservertoolopenrouter.mdx: + id: 7fecfe80e04e + last_write_checksum: sha1:7de51c7d40b22c850b6c49ca7a3e989fd7da71aa + pristine_git_object: e72c5e1cd8e90695cea2f97cc7909d6d7099ef2d + docs/components/searchmodelsservertoolopenroutertype.mdx: + id: a9a0e137d51e + last_write_checksum: sha1:b13d77690c90a53b9957b099560f88729956f701 + pristine_git_object: e57b04828acdf4f7cf9fa30409a47947f7e7f25e docs/components/searchqualitylevel.mdx: id: 0cbced049b6f last_write_checksum: sha1:106b7467c7ab738c7ce04ab44d83a91388dc0808 @@ -4954,8 +4990,8 @@ trackedFiles: pristine_git_object: 9c95861831e9f31f54efd7d48d8f48eece10e369 docs/components/updateobservabilitydestinationrequest.mdx: id: b54091567003 - last_write_checksum: sha1:a49d260a3c096efeeda18b7f204ed6336c25aed4 - pristine_git_object: 1a6d04101d79b08a5993638272a569695d6151c2 + last_write_checksum: sha1:9ba0d6c18b145237efd307d621834669669838f8 + pristine_git_object: f13384238a27b4d58710d33648c8ac8de766635a docs/components/updateobservabilitydestinationresponse.mdx: id: be9661c3676e last_write_checksum: sha1:c8fde493ab2c8285b0a800795e6106f2dbf3a63f @@ -5344,10 +5380,6 @@ trackedFiles: id: 2ab0b419379e last_write_checksum: sha1:f3bcb4a33fc0d7d868762b459a838d1fdca99d28 pristine_git_object: d24616128ffb2e8a3f1fc639235d8210dbeea107 - docs/operations/costdetails.mdx: - id: a5015273e58c - last_write_checksum: sha1:90a330bfa37e208bcee6615af2ee7535c4416a26 - pristine_git_object: 753493b8d505e9317dcaca6fc897da7e30e91d0c docs/operations/createaudiospeechglobals.mdx: id: 9b19782b0fc7 last_write_checksum: sha1:620e2236612f7cdf7dc23e0f975671e979d7e4f5 @@ -5438,8 +5470,8 @@ trackedFiles: pristine_git_object: 4efeda7aa813ebf97131645e6af8e49853731100 docs/operations/createembeddingsusage.mdx: id: 4f9205ca2bb9 - last_write_checksum: sha1:cda993a456ed0e22740a2d6d657dd499199e742a - pristine_git_object: 1050293af3353abc1dba846e61f3d6980cc126f8 + last_write_checksum: sha1:8156e256387b12cc08a5a92f9e9332ec2b35a2af + pristine_git_object: 1218cf960cbc2285120cb399596e0bc73b44aa9f docs/operations/createguardrailglobals.mdx: id: ce6e792df15c last_write_checksum: sha1:6542508eed5dbd74bf6812b8cc0cc9cfd3157d06 @@ -5842,8 +5874,12 @@ trackedFiles: pristine_git_object: e6beafcf11154033e2951ae58103041a2af946b9 docs/operations/getmodelsrequest.mdx: id: b2627beb1959 - last_write_checksum: sha1:f632f852d2575a081418c25c4ae1c5f8f4785ff2 - pristine_git_object: 3cf889e3b06877fa5948f307c334468ed1832d3c + last_write_checksum: sha1:416ad223f0e50e03f76f5da03ca4c3d97754201a + pristine_git_object: 532a1ab9bd3372f778cf6406d9ac686305006228 + docs/operations/getmodelsresponse.mdx: + id: acfd4707ddde + last_write_checksum: sha1:0c0fb343b7965a76cc790355b7f43d1f52f13e89 + pristine_git_object: c7353f31e48c90e3abd225386f409e211bf043de docs/operations/getmodelssort.mdx: id: 3cfd33e60661 last_write_checksum: sha1:6d75758523f8665ff617fe5d4e54385ad785c7ef @@ -5966,8 +6002,12 @@ trackedFiles: pristine_git_object: fad77722bdedf3aa5902e0216dadbbbbb2331c66 docs/operations/listembeddingsmodelsrequest.mdx: id: 280530b63070 - last_write_checksum: sha1:aa92c46789315ceae419561330e80127280e9559 - pristine_git_object: 76c365bf04a9c5fc1f461b0eda0d59d0122b22fa + last_write_checksum: sha1:f409c6a09dd308ffe3145b09b1115293c5c80862 + pristine_git_object: 7e491482186d8bd3a8b13797e591fc7128b5966d + docs/operations/listembeddingsmodelsresponse.mdx: + id: d07053bd83fc + last_write_checksum: sha1:a80671cd7e9e2247b38a0c3f0c9fa1daf0080600 + pristine_git_object: 053af0a817f0ae9077ec70ccd12e4e6581bf8e91 docs/operations/listendpointsglobals.mdx: id: 12c08333c32c last_write_checksum: sha1:72d0a3a54e8fc8cdfa2812fa929c08669dec9779 @@ -6106,8 +6146,12 @@ trackedFiles: pristine_git_object: f0a800135df0c6e4799128a4fbc901c576c8c6ce docs/operations/listmodelsuserrequest.mdx: id: 01537864056e - last_write_checksum: sha1:6a40c5348b33b01ac4dd2d5daac02fb237efc459 - pristine_git_object: 3b65b53fd19e841061b65013fe3adaedebaa5b68 + last_write_checksum: sha1:45aab507978152748484ff6d2eb394570514f08c + pristine_git_object: ca39aeabcd71a18c6e29542ef9cde33fe6b77b33 + docs/operations/listmodelsuserresponse.mdx: + id: 34f7a1648ceb + last_write_checksum: sha1:bf1ee4a9b2ad707ff1c39ea8680e72e5d0c27b9a + pristine_git_object: 380f686c12cbcd07de087be55b5a3f2b8f9eeec5 docs/operations/listmodelsusersecurity.mdx: id: fa5ad15aebfd last_write_checksum: sha1:daa5aafeecb31a35e7cb1bbedc70b722f6a675a5 @@ -6502,8 +6546,8 @@ trackedFiles: pristine_git_object: 6e4b06ff97f02da5d31d78f478094db32dfdaa6f docs/sdks/byok/README.mdx: id: 17792f3b180d - last_write_checksum: sha1:18692d1b1454837b1592113fe1aaba1b1d37a805 - pristine_git_object: f1da2da04de257540172ce771ed1b665f0da9010 + last_write_checksum: sha1:17ebad0d042bd205530b527caf71c33d248ac5c7 + pristine_git_object: 513bb72efe9f74672b1b60d6b45dc0aca282ddf6 docs/sdks/chat/README.mdx: id: 1dd859c23fe1 last_write_checksum: sha1:b6c104dc6b0c3461a2264a95d886f860e7277780 @@ -6522,8 +6566,8 @@ trackedFiles: pristine_git_object: ef43241cee60a329848e01772031d3f97e0f0d30 docs/sdks/embeddings/README.mdx: id: cd71581df291 - last_write_checksum: sha1:627e1efaacb2a29cb97e9d184ead987d95008bed - pristine_git_object: bf8b8c511bb6de4fcb0f24060788581aa51ef1a7 + last_write_checksum: sha1:6327ec4cf4aa480bbbf6eea9c8b54713e46a7db1 + pristine_git_object: 0ec380e6de0a439e80527b502d78d90963d8671b docs/sdks/endpoints/README.mdx: id: 62dfac9f7b71 last_write_checksum: sha1:05fc24509aa174b336fbe7d1a95faf7beca9bca3 @@ -6538,32 +6582,32 @@ trackedFiles: pristine_git_object: f262b34982a18293f5ae22bfbbf385010bfcdc9c docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa - last_write_checksum: sha1:b6543c22a38aca53d7bfbc8d41ed482965fc3b3c - pristine_git_object: d164a1da79b0838bd68f0a6560a0317eb86e0226 + last_write_checksum: sha1:a21e4a94d1ee8d031f862e23b9282f8977d38fc2 + pristine_git_object: 52efbd96250f06588fea44689bed93f27f2e0230 docs/sdks/images/README.mdx: id: 534a6c102c4f last_write_checksum: sha1:eb919a70e20e9bde335ff1e8ae52ba0a309ca5c3 pristine_git_object: 8277c7710decc3ee152c7fe725c90bac9784800a docs/sdks/models/README.mdx: id: 58f1ca464e0b - last_write_checksum: sha1:2a8e7baeb6586e3b46d4da14c1e4701e4625ee7d - pristine_git_object: 888dcaa7005c439f2c0e5e0736ba8f78fc42a8db + last_write_checksum: sha1:90e4f262bc449464226d1d83c731709e3352bbb1 + pristine_git_object: dd4b54253703029cfcc99203de65731b350e49b7 docs/sdks/oauth/README.mdx: id: 42b5079343d2 last_write_checksum: sha1:60ecae1338bc4487fbb050b6044ddc08dd7d1685 pristine_git_object: c8f7dfd9fd46b60a5814250f8cb2de313166e2c3 docs/sdks/observability/README.mdx: id: 75811527e651 - last_write_checksum: sha1:83e566a1ab2ca84c1139d44060b3740a9a543e1d - pristine_git_object: 869bf82e6c2a769a2017220c38e6a6ef1fd270fd + last_write_checksum: sha1:e0d3c0963d72b6c982ec2164d3b38ed7f42ccfc5 + pristine_git_object: fb37fc078d177af746a8d20d989cddd4ab24aa8f docs/sdks/organization/README.mdx: id: f41b85542db0 - last_write_checksum: sha1:05a25a46b97551c8b92fbe3ec2eb736a562ca8bf - pristine_git_object: 6e199abaeb2f5269a885637d65bb176fd235a61c + last_write_checksum: sha1:7bb8e127781511bb01ce8b610084674f56e1ca00 + pristine_git_object: 32a291cb837977e7cdd475c664e5d475660b2ba3 docs/sdks/presets/README.mdx: id: eeb505928d52 - last_write_checksum: sha1:c61b06287a4f3e854cf729a6621a8760ef3c73c0 - pristine_git_object: 5f20994a95b6c41ceab181a1523d1b03935d0ac0 + last_write_checksum: sha1:0c1569e8db293c65840433adda49310960a591d1 + pristine_git_object: ef18762b9c9c42a26bf61c24af1607d7ce19c01a docs/sdks/providers/README.mdx: id: 5ea9af111324 last_write_checksum: sha1:570b55655ee7602d3807c3218e450741f634eed6 @@ -6590,16 +6634,16 @@ trackedFiles: pristine_git_object: 429ca7dad6a66516aec6bb1e674af1e09dc42dd5 docs/sdks/workspaces/README.mdx: id: 0c75d023ef6b - last_write_checksum: sha1:29a4f4699004ed16b9c980463a649576b30fe035 - pristine_git_object: 37f2346cb81f6c7712df90b676b5084808b609b5 + last_write_checksum: sha1:d44b36396b3773c8522f57b64fdd2b80a925d7f9 + pristine_git_object: 547d8b71101d58f89209eb7354d40cb96dce03fa py.typed: id: 258c3ed47ae4 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:5d3a57b654b24aa3e1d864860193cd49e30c8158 - pristine_git_object: 6c7ed425b8481808595bc0c2ea6bf15eead35678 + last_write_checksum: sha1:451a4be23fc081294b962e2bc0c6f0dbae2c43ab + pristine_git_object: 88b38af4fdfc0341a41fae784c7c78c1137e00a3 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6626,8 +6670,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:01c911de175165f5a511285a446e1bb9b86fc01a - pristine_git_object: 400898618adb2f15eac43a4e6b1cb1f093b04c2d + last_write_checksum: sha1:5a4d07dc0be8788ed4abef1a2b48b18cdaa1afb1 + pristine_git_object: e328286d4babd45c447a377612162c30d1220393 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6654,8 +6698,8 @@ trackedFiles: pristine_git_object: 1b01f0c081ffc8a42fa56d335f95ec3121e4b5e6 src/openrouter/byok.py: id: bec352462ae1 - last_write_checksum: sha1:14ffff34cdb97e81dd5ef9d7ba0f105b09b7ba48 - pristine_git_object: fcbfd1acaba89492d5ca7a58aa1126073d5cd5d7 + last_write_checksum: sha1:d812981f845cfc7313a86be8eecca156969ca0a0 + pristine_git_object: 08b177b0b39e7f3581f1a5da13e245c3daddf9d5 src/openrouter/chat.py: id: 723fdce15c1d last_write_checksum: sha1:79e9c02b4a16cae3c202b5ae0bfd6cd1d0d6f89b @@ -6666,8 +6710,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:7da528c3b443bbc59febd9ba816c068802b8f5dd - pristine_git_object: 0aa62516217cf61492f33d953c54956fbfeb4124 + last_write_checksum: sha1:1d909d376196542b7bd1a320346e7bbda7cb5f48 + pristine_git_object: 1f755537449f9869a6c5e548ae39bdb03b8f777f src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6682,8 +6726,8 @@ trackedFiles: pristine_git_object: 1138e6f6bc025546a86877749ce83aca4c46499a src/openrouter/components/additionaltoolsitem.py: id: 2761ab789f41 - last_write_checksum: sha1:9156822bf7cf6b71f1351e12a03b7a659c0a2762 - pristine_git_object: 1bd74f0c42994da09935ed8a6a4c0baa49a0bc5e + last_write_checksum: sha1:955f9a0246407a1e72933c4861b9e343698f4141 + pristine_git_object: 6f2202805056318932d7426b061c24d082cacb53 src/openrouter/components/advisornestedtool.py: id: 768fcc6bad2b last_write_checksum: sha1:9c4303eb7fbefd1d7200cd588e7ab7e55db791e8 @@ -6744,14 +6788,14 @@ trackedFiles: id: "8776686778e3" last_write_checksum: sha1:9a7144f078d7b404bf3d90eac0d3a16a24ba3bba pristine_git_object: cbe0a66bb0fd32915d5f1379990f0b55b1be34e8 - src/openrouter/components/anthropiccitationsearchresultlocation.py: - id: 3bed26599605 - last_write_checksum: sha1:2dd310e399d7957ff933cd7163b7ca9f9fc348f4 - pristine_git_object: 8a90ed4f254de659efca56a8ad691dcca505bf1b - src/openrouter/components/anthropiccitationwebsearchresultlocation.py: - id: 1a120a6f2e0a - last_write_checksum: sha1:e4841838144a600bbc556aed274ecdd56aa2b51e - pristine_git_object: 4d061c61a4c7c6cee32194f7fe3ab9bebf00ec6f + src/openrouter/components/anthropiccitationsearchresultlocationparam.py: + id: 6610f6ef1f41 + last_write_checksum: sha1:8300415c29d0e1ea74e01f9a60e807ab5faec7d2 + pristine_git_object: 77b17e50979925c45c350782a3642dbc0496586d + src/openrouter/components/anthropiccitationwebsearchresultlocationparam.py: + id: e3b53306ee2f + last_write_checksum: sha1:ce75e5feff4dbaa43e8633d1c6c5492bff8a457b + pristine_git_object: 9be8376389ace420687450d12a94075c59902b18 src/openrouter/components/anthropiccompactionusageiteration.py: id: fdfc1ef0420f last_write_checksum: sha1:67b10e83d2fc7777319f6c51d4e5cc7539b9eccc @@ -6802,8 +6846,8 @@ trackedFiles: pristine_git_object: 4f9c2bc739541b12c381e3d6265184af879cc1ff src/openrouter/components/anthropictextblockparam.py: id: f387daeeb940 - last_write_checksum: sha1:f58942e9bb462aa291affec04500e112495a9acf - pristine_git_object: ed10fdcf8fdb3fcc18a59ea6cbaa1035bb987a5f + last_write_checksum: sha1:266f0b2002e313484812c69d4b85a7d84aeb0c2b + pristine_git_object: a6a70aa6825c515fb5c9c1358d011314df010b2d src/openrouter/components/anthropicthinkingdisplay.py: id: 5d63f1a15f67 last_write_checksum: sha1:388d60bbe78d3b848744564f91b31142d7bfc7e3 @@ -7072,6 +7116,10 @@ trackedFiles: id: a852009cc661 last_write_checksum: sha1:0b53b9be3fc3c703dd69f537bd4e2d74bb3794b3 pristine_git_object: 9ec411f0b6d050166527d9ad38b892763113781b + src/openrouter/components/chatformatjsonobjectconfig.py: + id: c6434d0938fa + last_write_checksum: sha1:27544a9a1fcb7531c2e2ff93b63e361a6b6db815 + pristine_git_object: 450c8f6b441ce00d6a164f236ec19ce32a2d5abe src/openrouter/components/chatformatjsonschemaconfig.py: id: ab345e635f28 last_write_checksum: sha1:cf6c6e7bf8101361b2351f978e21bf3f8d61c375 @@ -7106,8 +7154,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:ca664d330b0d2904c1479cb63e7b5b7d4e4f0961 - pristine_git_object: fe89789eca242903d019c9d9dd2e50c1069a452d + last_write_checksum: sha1:e6f5dca8d7972b45dbb40d94867331ad0d1e09e7 + pristine_git_object: 914012755c34634740a1c91aa3f3f7b3da3f095e src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:2ff1963c54e7e79500115c8549c8d395f4e336d1 @@ -7302,8 +7350,8 @@ trackedFiles: pristine_git_object: d6c4a4dc73222668daddc2a1788d314ff30e8fe6 src/openrouter/components/createobservabilitydestinationrequest.py: id: 58587fb98a32 - last_write_checksum: sha1:b8a96311602687e9280550674d0d840f2916ad06 - pristine_git_object: b7bf9755acc084c2f17f3787dc5b70e354b0efe4 + last_write_checksum: sha1:a69652cab8079b002fdcdfd8a3de2d5da4ed2677 + pristine_git_object: 6cd46b4fb85e986a1b54f89e5983a3a0d53b837e src/openrouter/components/createobservabilitydestinationresponse.py: id: 9a8561661e52 last_write_checksum: sha1:730054c12ad209d5f83b88825c946fd6f322e6e9 @@ -7656,10 +7704,14 @@ trackedFiles: id: 5cfc6caf763d last_write_checksum: sha1:79c33282493bf247e4f761e878cc8242b0992c2c pristine_git_object: d433ceae961e91fee4732913cfae463775322981 + src/openrouter/components/imageinputmodality.py: + id: c2336ff63555 + last_write_checksum: sha1:391a5fb69d5e9ce8b4bcdaef4d1280bce944a439 + pristine_git_object: bfe11c62d66b9ba64627867934d9796ea1bf96e8 src/openrouter/components/imagemodelarchitecture.py: id: 5f3e50733fe9 - last_write_checksum: sha1:cc9bee6400f1b7b65ff1c86c5d6bcd5eeab03209 - pristine_git_object: 01f0cb5e15bc03592cca4d25a3d67ebb990dd433 + last_write_checksum: sha1:9400a6354c6b217939bb87dbca39c5c2bf5956a1 + pristine_git_object: 0a870e4b18be6630023ab7a3b32ea9fd90821e62 src/openrouter/components/imagemodelendpointsresponse.py: id: f3d538d38ec2 last_write_checksum: sha1:e10cae58b2bb98ab1a0df6fc162f402ac1561d3c @@ -7742,8 +7794,12 @@ trackedFiles: pristine_git_object: d334197ca0822a32f5f98a7548b254a37ee7d110 src/openrouter/components/legacy_chatcontentvideo.py: id: b06bf8b4b644 - last_write_checksum: sha1:13c50b1957251e4819fc8ac6545c64cfe940bc8f - pristine_git_object: b5dd4d1a0d29169acd66c3b92b04dd9cf5291f79 + last_write_checksum: sha1:59cab32b6634299755ba92b46c90ee4495e6e86a + pristine_git_object: 38a7bf71a9b45b3f38d0aaad567a97996f80401e + src/openrouter/components/legacy_chatcontentvideoinput.py: + id: 27b3187afed4 + last_write_checksum: sha1:b9acaad63d544772ae34ba29a6eec2248b0181ac + pristine_git_object: 0fe43c16758210b0b304f3f31cc88ba2df5e46a0 src/openrouter/components/legacy_websearchservertool.py: id: 8b28b05b8756 last_write_checksum: sha1:bff7d5ebd6a54d3a598aaaeccefd18a04bb9b489 @@ -7842,8 +7898,12 @@ trackedFiles: pristine_git_object: 9b033dd8570e1d71ddb61a63a4b320d3003bd3ef src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:85812e6b546d59d8788ea1a30766a01510ea57a9 - pristine_git_object: e69fe1fc961d93b9cfcfacce426937b34fd53b42 + last_write_checksum: sha1:a14c123f9362720670a6cf4eb4bd55478d5fa376 + pristine_git_object: d2e30398f665dc6b5e8dac7f53bffab6e490d14b + src/openrouter/components/messagessearchmodelsservertool.py: + id: 53d755edb120 + last_write_checksum: sha1:389786fc22ba4bb47b0a086b7aa321f2f04fe943 + pristine_git_object: d101995fd27b0bccbac266805caba629039c5f93 src/openrouter/components/metadatalevel.py: id: 0eede47eef62 last_write_checksum: sha1:b4e7e6fc4e9016b65008e9ebbfcc6f018fe89ced @@ -7854,8 +7914,8 @@ trackedFiles: pristine_git_object: a76656cf0dfc106b6c1a80dac3b53d0114aa68b6 src/openrouter/components/modelarchitecture.py: id: b37ac27e512b - last_write_checksum: sha1:4cb5ae4ebd310085d58966528958f7183f2ca9f0 - pristine_git_object: 1fb1dbcc44f43ac47d0f3c8af94298235461399f + last_write_checksum: sha1:d0b370e5a88cb723c8836ba4c5f4bf9c000ff82d + pristine_git_object: b1fb080a8142fe434784811e7c1cd51fce87c0b4 src/openrouter/components/modelbenchmarks.py: id: efd0b01b6775 last_write_checksum: sha1:71dd3f1be37b6ea21345316025cb106488a9a4c9 @@ -7882,8 +7942,8 @@ trackedFiles: pristine_git_object: 8d68ee4aa093ba2754a65f28e46a23a1848fd99b src/openrouter/components/modelslistresponse.py: id: c2d4bb2cac89 - last_write_checksum: sha1:54bc618bea7ddcaa4e49082d601065c634fb2ea1 - pristine_git_object: 8497c58e5956b9344427e0147063b01ab86c7001 + last_write_checksum: sha1:54461c815f518a71ba9f9b5a00ffad57c2d62c20 + pristine_git_object: a1cd85a3ba7fbb5c4b28936c5a3d0a70ca87aa38 src/openrouter/components/moderationplugin.py: id: d99bd9d505d3 last_write_checksum: sha1:58ff3e6829b973b3db5ed7dda3fa11558ded04b2 @@ -7916,10 +7976,18 @@ trackedFiles: id: f02862444a3d last_write_checksum: sha1:182ba82fb2aee3f33a975ce8eb2ef978bc0b46d2 pristine_git_object: b7a1d2f385159ff27bde884ad290db7878ccdfb1 + src/openrouter/components/observabilityfilterrulegroup.py: + id: f1fcf7b3732d + last_write_checksum: sha1:752f7a5db8f00c94443cc70f1c8cd1217c83e0b9 + pristine_git_object: 576d6a303f41aec506ccc7eb44c254ae5fb3064d src/openrouter/components/observabilityfilterrulesconfig.py: id: 98476c1c326b - last_write_checksum: sha1:2f0154d62e8ae85dfced48bfbc4d5430bddabc18 - pristine_git_object: 76f042e250255d33d9ed6626f1dd0be51f2fb4f3 + last_write_checksum: sha1:2ce6d9001db7a4fec752c3bb8898574be738ddef + pristine_git_object: 6f5536a507863e73dc5bdbd52b9faebf75f35b64 + src/openrouter/components/observabilityfilterrulesconfignullable.py: + id: 4e3d140792cb + last_write_checksum: sha1:6cb7c481dfe78fb6948e85c167ee3c93904ddf57 + pristine_git_object: 80ac61fe6a5044a15f9508a12a746b01085a558d src/openrouter/components/observabilitygrafanadestination.py: id: 36c8f26bcf6f last_write_checksum: sha1:d7fc978dd9c663490f1a7a8c12b07097d7985688 @@ -8434,8 +8502,8 @@ trackedFiles: pristine_git_object: f38c8edcb616d9e7cbd0f724fbb9d9f5aae014f9 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:b6afc18fad09f40c0f343cf5944e80070ef45077 - pristine_git_object: 7331187ebb7ad8010f213526e172d64d2e08d268 + last_write_checksum: sha1:f9f52d25db9ee9e72fbdf8491c47a3fc3a9971c7 + pristine_git_object: 6f97e56c468a1df21fc11fd4c3310fa648968c5f src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -8456,6 +8524,10 @@ trackedFiles: id: c246413c0bd7 last_write_checksum: sha1:863a664a9f17def86180b0407c8233c263acfae7 pristine_git_object: 7faa97b80bfc0d362fd89c255adb708a4f7afc05 + src/openrouter/components/searchmodelsservertool_openrouter.py: + id: 126d609eda44 + last_write_checksum: sha1:4459710e2e9299ccee45ebccc2ab6a4ad03057a3 + pristine_git_object: 158d0a1a8dcd06be171fea886635c69d2c140e63 src/openrouter/components/searchmodelsservertoolconfig.py: id: 6a1174213084 last_write_checksum: sha1:4e4cfb2275ef0d6410f9557ab6a8f28ac8e9ab16 @@ -8718,8 +8790,8 @@ trackedFiles: pristine_git_object: df833960211cc7ed2a2a42fddbeafda0092e1c0c src/openrouter/components/updateobservabilitydestinationrequest.py: id: d7a39fe04386 - last_write_checksum: sha1:3a4279ca4f9680d2a4c41464b04ace5971a125ad - pristine_git_object: a344284f904d781583b0f493839fe11930b5afc1 + last_write_checksum: sha1:9eb493e5c3c8567235b70ec7a603ebdffcb544ea + pristine_git_object: e0d3f99ca9cafe61ac6b011cc2e54348d46115e5 src/openrouter/components/updateobservabilitydestinationresponse.py: id: 187c51d2b3a4 last_write_checksum: sha1:cadc62b37feddb4281e471d15627a9a1bef32cb1 @@ -8870,8 +8942,8 @@ trackedFiles: pristine_git_object: 3d9437c8ce1bdc83d3703c4374cf10b1bcae5d71 src/openrouter/embeddings.py: id: 0374ace39067 - last_write_checksum: sha1:bdfaf3f9ffa1e337c0cc62b5a956a53c7863f24d - pristine_git_object: 9f0b5ce3612b8e56070f8cc69e890aaeb98491a9 + last_write_checksum: sha1:6a967c8d367aabf21aae51b4c098e02f3909bf5a + pristine_git_object: 906426aac514d79539160aae83cb6dbd4e128eac src/openrouter/endpoints.py: id: 465bbf2b7939 last_write_checksum: sha1:0c4ec93f6309edfb7f009679c04f59fa2a62232c @@ -8966,8 +9038,8 @@ trackedFiles: pristine_git_object: f6dbf5440466ba6b1d92442cad1b91e2b3587c52 src/openrouter/guardrails.py: id: 705839f34e66 - last_write_checksum: sha1:e525be9e5746b7b1cb6d170ac74cce37f010004a - pristine_git_object: 4add1c7f1f5608569227ae476d820fa412e33745 + last_write_checksum: sha1:65e0cab899a38685f01c55aaac154d7c34e4cf71 + pristine_git_object: 0e06ce70572df1bf0dfc202de4fb6f918f27d1c5 src/openrouter/httpclient.py: id: e9311185443d last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 @@ -8990,20 +9062,20 @@ trackedFiles: pristine_git_object: 5b741456655ff48919d17ffd552a6410f0587966 src/openrouter/models_.py: id: 4e1ae1fe5b98 - last_write_checksum: sha1:7b5b5454677f47a3a0fbfeff8c084ecd569a95b9 - pristine_git_object: 0379827532be6069ef8a592771c01c1e44219636 + last_write_checksum: sha1:92ace67311606c8bb05b1e264f394e58e2f3a73d + pristine_git_object: 1a85e99763d0764e5d200911200e4710e454b538 src/openrouter/oauth.py: id: 1948ce27255b last_write_checksum: sha1:8d6ba30594d5674164f045d6655914b801268f72 pristine_git_object: d6a938412d5c82be874e958ba4a3043bd46284d3 src/openrouter/observability.py: id: 6a17f32d3f33 - last_write_checksum: sha1:760a86891fad356e60d36c619e02d7c710f10d70 - pristine_git_object: a1dea9b45650cc42a6f60447c032fa46b102839a + last_write_checksum: sha1:4c9eabfefd55cb2cfe1e3813a567296e99e988aa + pristine_git_object: 67318c78e377567e897be1f572a1e3cbdac0366b src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:d5a5875a32fab4fc32e68a7c4036483701797944 - pristine_git_object: 134f9b320535b89c7904427ca69322f9507e7ac2 + last_write_checksum: sha1:e56a2031fc05ced63f1e1c769fc3407b290890a8 + pristine_git_object: 95999d265d654c5c2adab6aaf93bab0e75376e3d src/openrouter/operations/bulkaddworkspacemembers.py: id: e0ed56117619 last_write_checksum: sha1:5c44eb0d40fdece3ac084615f6c6082be4cf1d5a @@ -9050,8 +9122,8 @@ trackedFiles: pristine_git_object: d96c756e911994eaf6ef695a059f7575d69ff63c src/openrouter/operations/createembeddings.py: id: fe1160a960e9 - last_write_checksum: sha1:b268603b5bade55ac49a04e3ce217858ab3174b9 - pristine_git_object: 699e98674ffe69fea3bd1b8df9383cd558884c19 + last_write_checksum: sha1:a0b0b0755594b7a11b6662d9b8685fd3174d64e0 + pristine_git_object: a7fed8ead2d7dbf97fe0107a4f63318b7e610048 src/openrouter/operations/createguardrail.py: id: 52ed4b2f5903 last_write_checksum: sha1:d4351fdd66f1fa2bedcfc9a974c7f4ff6c68a6bc @@ -9178,8 +9250,8 @@ trackedFiles: pristine_git_object: d5a47b01285b12f05d46240e253a934be63f0a00 src/openrouter/operations/getmodels.py: id: 5bd5dfcb0125 - last_write_checksum: sha1:3501eb6dccdf4bf3dc52d2228b5906be95481470 - pristine_git_object: dc16709a2472ddaf838eaa21ffda7be17f7dd0f2 + last_write_checksum: sha1:f736c36217ac4f17ba5405dabcc33ee54223a256 + pristine_git_object: de855463c99bc9ea9e94fc78093d289c6dc0d20a src/openrouter/operations/getobservabilitydestination.py: id: 15b49f22aca9 last_write_checksum: sha1:351b050b646c9e2dbffaf27633cbd38b30047169 @@ -9218,12 +9290,12 @@ trackedFiles: pristine_git_object: cc90375e9aac23107e57e18e6adecc38f544e185 src/openrouter/operations/listbyokkeys.py: id: b6dd42b3e05f - last_write_checksum: sha1:09b5ddfd1b3558638199bf268b5a931a74094012 - pristine_git_object: 67d30bcc6c66aa56f40f3b56b94c2a31879f50d6 + last_write_checksum: sha1:20949993bdcdb4e6827a1a17bf1aa1230690f630 + pristine_git_object: 46c012e74b47beaa8f0b6828cc5bb319fe315e77 src/openrouter/operations/listembeddingsmodels.py: id: bf749a1f23d6 - last_write_checksum: sha1:19ed80a098e6e1b43bedfcccb11b4c8d8794541c - pristine_git_object: a019232d0cfcaccbca305f9d9aefccd0a5023df9 + last_write_checksum: sha1:0af7e243f6b7ea8dcb9c3e506c0e9382372e8397 + pristine_git_object: 016f0b9bc08b60b51e61f5b6acc44697ef5f1c27 src/openrouter/operations/listendpoints.py: id: 62b7a5f21dec last_write_checksum: sha1:1aa9ca7cc8e0376cc77fe81403e2664ecbd1abb2 @@ -9242,16 +9314,16 @@ trackedFiles: pristine_git_object: d57feee9926b76b03d1ec5ed8655cde8310b8192 src/openrouter/operations/listguardrailkeyassignments.py: id: ee9d33f4de6b - last_write_checksum: sha1:6837feb62ec5d172f6588933821232ad73fa08f2 - pristine_git_object: e7a2c31fb2451fbbc836d1356d156db8e9a7a933 + last_write_checksum: sha1:82c4cb0cd9d16cd761b7c0db8fa66165e1bb6f11 + pristine_git_object: 90f267220ceab68f8965a64b5d008a891da9f0d3 src/openrouter/operations/listguardrailmemberassignments.py: id: e36e679b02ec - last_write_checksum: sha1:de031b827a456c84a7d92790fca5ddd06780aa7a - pristine_git_object: 84076b7480837071db3d745f0fee690bd7809a01 + last_write_checksum: sha1:c281ab2ced63404c7786dd0828363708d60ae081 + pristine_git_object: 4ff57806d2d433412d45aef06b033f0c2a3502ff src/openrouter/operations/listguardrails.py: id: c99a9e7be93c - last_write_checksum: sha1:c908e642caa02b7904355cc6dba6f2c4d9a83d1f - pristine_git_object: 461e691429a7daea86a57f6d08df1bf4e9f78833 + last_write_checksum: sha1:758db0ed0413ea4a9ec15ac0e6942fd4f56cc863 + pristine_git_object: 1e36035bdc2da8a195f335d0dca4f0bf6f6858de src/openrouter/operations/listimagemodelendpoints.py: id: 40fd868ead3f last_write_checksum: sha1:2f4ba55f45f8fe4b5ce56cb6781fa8db455f8927 @@ -9262,36 +9334,36 @@ trackedFiles: pristine_git_object: 01655ae02036acf433ec5f54fd1d9323a55f0684 src/openrouter/operations/listkeyassignments.py: id: e26c11d1bd3c - last_write_checksum: sha1:bade55d5aaef4f6d9437c24f0bcb39b645af05ae - pristine_git_object: 2aee3fc4636c77ba4fcf5884a4000a1a04ee58a8 + last_write_checksum: sha1:045dffabc8207001234c5426e8fec665749597ff + pristine_git_object: f9ccb3da2d18137bfd9cadf6b53448a5bd8c3efe src/openrouter/operations/listmemberassignments.py: id: a993b5549126 - last_write_checksum: sha1:f0aab0c649c589a7d76cdaa9bbe4f0529ade66de - pristine_git_object: f8e0b658a596aaab401ff4feb3fa633f56f831f2 + last_write_checksum: sha1:00abec2beffb8b43a17c9d053fd582f4802a80b2 + pristine_git_object: 60c04beaf9ddb069d8b6e9b689e158bac1cc7d8f src/openrouter/operations/listmodelscount.py: id: d588d81b71c2 last_write_checksum: sha1:359fe33759ae50d8180ab793a32b42045a28e3af pristine_git_object: 797af26e7d4985305600eb79b3ede8e78379d13a src/openrouter/operations/listmodelsuser.py: id: 16eb5946cf60 - last_write_checksum: sha1:f77768589018acd0395e98b9a313933872834d84 - pristine_git_object: 6070772eb28a5452620eb4ebebfa2bc5c2310a4f + last_write_checksum: sha1:ac09a491143da6a59b3b84ce74fcc51f19222b0c + pristine_git_object: d2a24e430af7ad8357c453a1a91dad76635501df src/openrouter/operations/listobservabilitydestinations.py: id: 40d2ffa975ee - last_write_checksum: sha1:3f7de2adcba23902d0abc08728d82bb138fa93d1 - pristine_git_object: 465e357cbbb90b0d1be4f7e223332bc14e5deb71 + last_write_checksum: sha1:e49fcd9ded0009ac0699ad63f8ddbfbb2dc92aab + pristine_git_object: 818784f85b0d94fb4731a492ed05297720b5add2 src/openrouter/operations/listorganizationmembers.py: id: d40a3e0e2b38 - last_write_checksum: sha1:d36b77a9962c1808572789f535a04acb51e64685 - pristine_git_object: 15662f480a26a6b35a299d2845556ac4b8bbddf1 + last_write_checksum: sha1:9501a8781176d34c507edb9b160f8e1dca1b190d + pristine_git_object: 06825eead8265472d4abaa1395328215e9dca760 src/openrouter/operations/listpresets.py: id: ecdc7097aab7 - last_write_checksum: sha1:5f23af709ff305b4a1ddb26fd972a080a9c5d134 - pristine_git_object: bf21a246c75309e027a8ee69eb19f610a26af61a + last_write_checksum: sha1:a20921ac7ad2f66fe43a8e09ff14aefeafdbffd3 + pristine_git_object: 23c66e8419b295bb092f2ba1dbf59f5cb30572f8 src/openrouter/operations/listpresetversions.py: id: 697cf707300b - last_write_checksum: sha1:47eabd5ac45fe37bc05f0c57faea512fcb6b1c05 - pristine_git_object: 36052fb3de83cfafd1c021ac8ebfa56110eb55af + last_write_checksum: sha1:5059f0a2b2af9247f2d0f9c84a1338570d671465 + pristine_git_object: 1224fee0a75a1bb356e4bb53459fd1d2a0db3e72 src/openrouter/operations/listproviders.py: id: cf6e2db15118 last_write_checksum: sha1:decee82d2b55738162cc47f02f56c592d53f9ee9 @@ -9310,12 +9382,12 @@ trackedFiles: pristine_git_object: a65454da5ec6727d99312d56c64324edd8615685 src/openrouter/operations/listworkspacemembers.py: id: 9886d508d283 - last_write_checksum: sha1:c83463410e0899b9f5b686e2155f69340c7acff7 - pristine_git_object: 9a8706fcb1a1761c4e636dba74866e239e8d51a3 + last_write_checksum: sha1:dac90a6e7a00d60bff8440f8a012b2a88cf5fc82 + pristine_git_object: ff41be4a17d8b57a01aa9c2273b7db6099f589fd src/openrouter/operations/listworkspaces.py: id: fe94c6f61835 - last_write_checksum: sha1:2458a0c8d4834fa046496a68620b66c5ba55d927 - pristine_git_object: a242ff323f23dfadad254b76440114e66db4e744 + last_write_checksum: sha1:7f5d1903b71a84b51230492ea725f42ee1c413e5 + pristine_git_object: 59f628e9ebbd9da59c4e76aa1c8a080e4f6bd063 src/openrouter/operations/queryanalytics.py: id: d76c63ff66f6 last_write_checksum: sha1:b184adfb9d438f443c1fd6c4e749aff3188e9496 @@ -9358,12 +9430,12 @@ trackedFiles: pristine_git_object: 228942b37d54273e752786186a49bd1b4ed4a787 src/openrouter/organization.py: id: 6f4c63c416e8 - last_write_checksum: sha1:b60a04c6f8482981e03f69fb357c8c183a187225 - pristine_git_object: d24bfa86c4b67290033a18eced04435a3fc3d69f + last_write_checksum: sha1:d12e64ae4b677c154ff5a2cb964d34ddd848a323 + pristine_git_object: 31c74edd544c4ab7d4c5153a6d2888623ca66aed src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:69ad1119617e8e5af1294075eceb9502492724d0 - pristine_git_object: 13b309db7d8dc063c26af9479110eca7fa5b9641 + last_write_checksum: sha1:6de7b3adbfe270bf5b492b1da06230b9f6cc35d5 + pristine_git_object: 250c20d191dfd4a999ab461d6d5d1f066e1cfbeb src/openrouter/providers.py: id: debc4c48f149 last_write_checksum: sha1:11dbc607825edee8dcc84b39ee8171e097c47acf @@ -9490,8 +9562,8 @@ trackedFiles: pristine_git_object: 4a82cde858211c0f5a01b08980cee0e9e3d0f52c src/openrouter/workspaces.py: id: cd6c533b1802 - last_write_checksum: sha1:cde38a8140d790751ffd6bb013a4c702c112aa6f - pristine_git_object: f3cf390c8f027710aaf32e794fa5229f0447b991 + last_write_checksum: sha1:02edbeb467aca20ca454d2bc420aceefd6ef340c + pristine_git_object: d2088f5ad8c1adcd8824271f322b16bfe03731df examples: createResponses: speakeasy-default-create-responses: @@ -9648,9 +9720,13 @@ examples: application/json: {"error": {"code": 529, "message": "Provider returned error"}} listEmbeddingsModels: speakeasy-default-list-embeddings-models: + parameters: + query: + offset: 0 + limit: 500 responses: "200": - application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": null, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-5.4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "supported_voices": null, "top_provider": {"is_moderated": true}}]} + application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": null, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "supported_voices": null, "top_provider": {"is_moderated": true}}], "links": {"next": "/api/v1/models?offset=500&limit=500"}, "total_count": 150} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "500": @@ -9690,18 +9766,26 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} getModels: speakeasy-default-get-models: + parameters: + query: + offset: 0 + limit: 500 responses: "200": - application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": null, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-5.4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "supported_voices": null, "top_provider": {"is_moderated": true}}]} + application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": null, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "supported_voices": null, "top_provider": {"is_moderated": true}}], "links": {"next": "/api/v1/models?offset=500&limit=500"}, "total_count": 150} "400": application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} listModelsUser: speakeasy-default-list-models-user: + parameters: + query: + offset: 0 + limit: 500 responses: "200": - application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": null, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-5.4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "supported_voices": null, "top_provider": {"is_moderated": true}}]} + application/json: {"data": [{"architecture": {"input_modalities": ["text"], "modality": "text->text", "output_modalities": ["text"]}, "canonical_slug": "openai/gpt-4", "context_length": 8192, "created": 1692901234, "default_parameters": null, "id": "openai/gpt-4", "links": {"details": "/api/v1/models/openai/gpt-4/endpoints"}, "name": "GPT-4", "per_request_limits": null, "pricing": {"completion": "0.00006", "prompt": "0.00003"}, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "supported_voices": null, "top_provider": {"is_moderated": true}}], "links": {"next": "/api/v1/models?offset=500&limit=500"}, "total_count": 150} "401": application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} "404": @@ -9826,6 +9910,10 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} listGuardrails: speakeasy-default-list-guardrails: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"created_at": "2025-08-24T10:30:00Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Production Guardrail", "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"}], "total_count": 1} @@ -9896,6 +9984,10 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} listKeyAssignments: speakeasy-default-list-key-assignments: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"assigned_by": "user_abc123", "created_at": "2025-08-24T10:30:00Z", "guardrail_id": "550e8400-e29b-41d4-a716-446655440001", "id": "550e8400-e29b-41d4-a716-446655440000", "key_hash": "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", "key_label": "prod-key", "key_name": "Production Key"}], "total_count": 1} @@ -9905,6 +9997,10 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} listMemberAssignments: speakeasy-default-list-member-assignments: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"assigned_by": "user_abc123", "created_at": "2025-08-24T10:30:00Z", "guardrail_id": "550e8400-e29b-41d4-a716-446655440001", "id": "550e8400-e29b-41d4-a716-446655440000", "organization_id": "org_xyz789", "user_id": "user_abc123"}], "total_count": 1} @@ -9917,6 +10013,9 @@ examples: parameters: path: id: "550e8400-e29b-41d4-a716-446655440000" + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"assigned_by": "user_abc123", "created_at": "2025-08-24T10:30:00Z", "guardrail_id": "550e8400-e29b-41d4-a716-446655440001", "id": "550e8400-e29b-41d4-a716-446655440000", "key_hash": "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", "key_label": "prod-key", "key_name": "Production Key"}], "total_count": 1} @@ -9949,6 +10048,9 @@ examples: parameters: path: id: "550e8400-e29b-41d4-a716-446655440000" + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"assigned_by": "user_abc123", "created_at": "2025-08-24T10:30:00Z", "guardrail_id": "550e8400-e29b-41d4-a716-446655440001", "id": "550e8400-e29b-41d4-a716-446655440000", "organization_id": "org_xyz789", "user_id": "user_abc123"}], "total_count": 1} @@ -10044,6 +10146,10 @@ examples: application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} listOrganizationMembers: speakeasy-default-list-organization-members: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"email": "jane.doe@example.com", "first_name": "Jane", "id": "user_2dHFtVWx2n56w6HkM0000000000", "last_name": "Doe", "role": "org:member"}], "total_count": 25} @@ -10254,6 +10360,10 @@ examples: application/json: {"error": {"code": 529, "message": "Provider returned error"}} listBYOKKeys: speakeasy-default-list-BYOK-keys: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"allowed_api_key_hashes": null, "allowed_models": null, "allowed_user_ids": null, "created_at": "2025-08-24T10:30:00Z", "disabled": false, "id": "11111111-2222-3333-4444-555555555555", "is_fallback": false, "label": "sk-...AbCd", "provider": "openai", "sort_order": 0, "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}], "total_count": 1} @@ -10379,6 +10489,10 @@ examples: application/json: {"error": {"code": 529, "message": "Provider returned error"}} listObservabilityDestinations: speakeasy-default-list-observability-destinations: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"api_key_hashes": null, "config": {"baseUrl": "https://us.cloud.langfuse.com", "publicKey": "pk-l...EfGh", "secretKey": "sk-l...AbCd"}, "created_at": "2025-08-24T10:30:00Z", "enabled": true, "filter_rules": null, "id": "99999999-aaaa-bbbb-cccc-dddddddddddd", "name": "Production Langfuse", "privacy_mode": false, "sampling_rate": 1, "type": "langfuse", "updated_at": "2025-08-24T15:45:00Z", "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}], "total_count": 1} @@ -10453,6 +10567,10 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} listPresets: speakeasy-default-list-presets: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"created_at": "2026-04-20T10:00:00Z", "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000", "description": null, "designated_version_id": "550e8400-e29b-41d4-a716-446655440000", "id": "650e8400-e29b-41d4-a716-446655440001", "name": "my-preset", "slug": "my-preset", "status": "active", "status_updated_at": null, "updated_at": "2026-04-20T10:00:00Z", "workspace_id": "750e8400-e29b-41d4-a716-446655440002"}], "total_count": 1} @@ -10549,6 +10667,9 @@ examples: parameters: path: slug: "my-preset" + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"config": {"model": "openai/gpt-4o", "temperature": 0.7}, "created_at": "2026-04-20T10:00:00Z", "creator_id": "user_2dHFtVWx2n56w6HkM0000000000", "id": "550e8400-e29b-41d4-a716-446655440000", "preset_id": "650e8400-e29b-41d4-a716-446655440001", "system_prompt": "You are a helpful assistant.", "updated_at": "2026-04-20T10:00:00Z", "version": 1}], "total_count": 1} @@ -10579,6 +10700,10 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} listWorkspaces: speakeasy-default-list-workspaces: + parameters: + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"created_at": "2025-08-24T10:30:00Z", "created_by": "user_abc123", "default_image_model": "openai/dall-e-3", "default_provider_sort": "price", "default_text_model": "openai/gpt-4o", "description": "Production environment workspace", "id": "550e8400-e29b-41d4-a716-446655440000", "io_logging_api_key_ids": null, "io_logging_sampling_rate": 1, "is_data_discount_logging_enabled": true, "is_observability_broadcast_enabled": false, "is_observability_io_logging_enabled": false, "name": "Production", "slug": "production", "updated_at": "2025-08-24T15:45:00Z"}], "total_count": 1} @@ -10952,6 +11077,9 @@ examples: parameters: path: id: "production" + query: + offset: 0 + limit: 50 responses: "200": application/json: {"data": [{"created_at": "2025-08-24T10:30:00Z", "id": "660e8400-e29b-41d4-a716-446655440000", "role": "member", "user_id": "user_abc123", "workspace_id": "550e8400-e29b-41d4-a716-446655440000"}], "total_count": 1} @@ -10981,3 +11109,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_messages()`: \n * `request.tools[]` **Changed** (Breaking ⚠️)\n* `open_router.models.list()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.observability.list()`: `request` **Changed**\n* `open_router.guardrails.list_guardrail_member_assignments()`: `request` **Changed**\n* `open_router.guardrails.list_key_assignments()`: `request` **Changed**\n* `open_router.guardrails.list_member_assignments()`: `request` **Changed**\n* `open_router.guardrails.list()`: `request` **Changed**\n* `open_router.models.list_for_user()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.guardrails.list_guardrail_key_assignments()`: `request` **Changed**\n* `open_router.organization.list_members()`: `request` **Changed**\n* `open_router.presets.list()`: `request` **Changed**\n* `open_router.embeddings.list_models()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.byok.list()`: `request` **Changed**\n* `open_router.presets.list_versions()`: `request` **Changed**\n* `open_router.workspaces.list()`: `request` **Changed**\n* `open_router.workspaces.list_members()`: `request` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index b0c9bfe..0640159 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.23 + version: 0.11.24 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 0423eaf..2fd440f 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -223,7 +223,7 @@ components: - $ref: '#/components/schemas/FilesServerTool' - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/SearchModelsServerTool_OpenRouter' - $ref: '#/components/schemas/WebFetchServerTool' - $ref: '#/components/schemas/WebSearchServerTool_OpenRouter' - $ref: '#/components/schemas/ApplyPatchServerTool_OpenRouter' @@ -972,6 +972,42 @@ components: - start_block_index - end_block_index type: object + AnthropicCitationSearchResultLocationParam: + example: + cited_text: Example cited text + end_block_index: 1 + search_result_index: 0 + source: example_source + start_block_index: 0 + title: Example Result + type: search_result_location + properties: + cited_text: + type: string + end_block_index: + type: integer + search_result_index: + type: integer + source: + type: string + start_block_index: + type: integer + title: + nullable: true + type: string + type: + enum: + - search_result_location + type: string + required: + - type + - cited_text + - search_result_index + - source + - title + - start_block_index + - end_block_index + type: object AnthropicCitationWebSearchResultLocation: example: cited_text: Example cited text @@ -1000,6 +1036,34 @@ components: - title - url type: object + AnthropicCitationWebSearchResultLocationParam: + example: + cited_text: Example cited text + encrypted_index: enc_idx_0 + title: Example Page + type: web_search_result_location + url: https://example.com + properties: + cited_text: + type: string + encrypted_index: + type: string + title: + nullable: true + type: string + type: + enum: + - web_search_result_location + type: string + url: + type: string + required: + - type + - cited_text + - encrypted_index + - title + - url + type: object AnthropicCodeExecution20250825Caller: example: tool_id: toolu_01abc @@ -1619,15 +1683,15 @@ components: char_location: '#/components/schemas/AnthropicCitationCharLocationParam' content_block_location: '#/components/schemas/AnthropicCitationContentBlockLocationParam' page_location: '#/components/schemas/AnthropicCitationPageLocationParam' - search_result_location: '#/components/schemas/AnthropicCitationSearchResultLocation' - web_search_result_location: '#/components/schemas/AnthropicCitationWebSearchResultLocation' + search_result_location: '#/components/schemas/AnthropicCitationSearchResultLocationParam' + web_search_result_location: '#/components/schemas/AnthropicCitationWebSearchResultLocationParam' propertyName: type oneOf: - $ref: '#/components/schemas/AnthropicCitationCharLocationParam' - $ref: '#/components/schemas/AnthropicCitationPageLocationParam' - $ref: '#/components/schemas/AnthropicCitationContentBlockLocationParam' - - $ref: '#/components/schemas/AnthropicCitationWebSearchResultLocation' - - $ref: '#/components/schemas/AnthropicCitationSearchResultLocation' + - $ref: '#/components/schemas/AnthropicCitationWebSearchResultLocationParam' + - $ref: '#/components/schemas/AnthropicCitationSearchResultLocationParam' nullable: true type: array text: @@ -4594,6 +4658,18 @@ components: - type - grammar type: object + ChatFormatJsonObjectConfig: + description: JSON object response format + example: + type: json_object + properties: + type: + enum: + - json_object + type: string + required: + - type + type: object ChatFormatJsonSchemaConfig: description: JSON Schema response format for structured outputs example: @@ -5025,7 +5101,7 @@ components: discriminator: mapping: grammar: '#/components/schemas/ChatFormatGrammarConfig' - json_object: '#/components/schemas/FormatJsonObjectConfig' + json_object: '#/components/schemas/ChatFormatJsonObjectConfig' json_schema: '#/components/schemas/ChatFormatJsonSchemaConfig' python: '#/components/schemas/ChatFormatPythonConfig' text: '#/components/schemas/ChatFormatTextConfig' @@ -5034,7 +5110,7 @@ components: type: json_object oneOf: - $ref: '#/components/schemas/ChatFormatTextConfig' - - $ref: '#/components/schemas/FormatJsonObjectConfig' + - $ref: '#/components/schemas/ChatFormatJsonObjectConfig' - $ref: '#/components/schemas/ChatFormatJsonSchemaConfig' - $ref: '#/components/schemas/ChatFormatGrammarConfig' - $ref: '#/components/schemas/ChatFormatPythonConfig' @@ -6758,7 +6834,7 @@ components: example: true type: boolean filter_rules: - $ref: '#/components/schemas/ObservabilityFilterRulesConfig' + $ref: '#/components/schemas/ObservabilityFilterRulesConfigNullable' name: description: Human-readable name for the destination. example: Production Langfuse @@ -9984,6 +10060,16 @@ components: - text - phase type: object + ImageInputModality: + enum: + - text + - image + - file + - audio + - video + example: text + type: string + x-speakeasy-unknown-values: allow ImageModelArchitecture: example: input_modalities: @@ -9995,7 +10081,7 @@ components: input_modalities: description: Supported input modalities items: - $ref: '#/components/schemas/InputModality' + $ref: '#/components/schemas/ImageInputModality' type: array output_modalities: description: Supported output modalities @@ -10717,11 +10803,22 @@ components: - input_video type: string video_url: - $ref: '#/components/schemas/ChatContentVideoInput' + $ref: '#/components/schemas/Legacy_ChatContentVideoInput' required: - type - video_url type: object + Legacy_ChatContentVideoInput: + description: Video input object + example: + url: https://example.com/video.mp4 + properties: + url: + description: 'URL of the video (data: URLs supported)' + type: string + required: + - url + type: object Legacy_WebSearchServerTool: description: Web search tool configuration example: @@ -12510,7 +12607,7 @@ components: - $ref: '#/components/schemas/BashServerTool' - $ref: '#/components/schemas/DatetimeServerTool' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/MessagesSearchModelsServerTool' - $ref: '#/components/schemas/WebFetchServerTool' - $ref: '#/components/schemas/OpenRouterWebSearchServerTool' - additionalProperties: @@ -12618,6 +12715,22 @@ components: output_tokens: 15 server_tool_use: null service_tier: standard + MessagesSearchModelsServerTool: + description: 'OpenRouter built-in server tool: searches and filters AI models available on OpenRouter' + example: + parameters: + max_results: 5 + type: openrouter:experimental__search_models + properties: + parameters: + $ref: '#/components/schemas/SearchModelsServerToolConfig' + type: + enum: + - openrouter:experimental__search_models + type: string + required: + - type + type: object MessagesStartEvent: description: Event sent at the start of a streaming message example: @@ -13041,35 +13154,7 @@ components: $ref: '#/components/schemas/InputModality' type: array instruct_type: - description: Instruction format type - enum: - - none - - airoboros - - alpaca - - alpaca-modif - - chatml - - claude - - code-llama - - gemma - - llama2 - - llama3 - - mistral - - nemotron - - neural - - openchat - - phi3 - - rwkv - - vicuna - - zephyr - - deepseek-r1 - - deepseek-v3.1 - - qwq - - qwen3 - - null - example: chatml - nullable: true - type: string - x-speakeasy-unknown-values: allow + $ref: '#/components/schemas/InstructType' modality: description: Primary modality of the model example: text->text @@ -13275,7 +13360,7 @@ components: id: openai/gpt-4 knowledge_cutoff: null links: - details: /api/v1/models/openai/gpt-5.4/endpoints + details: /api/v1/models/openai/gpt-4/endpoints name: GPT-4 per_request_limits: null pricing: @@ -13294,11 +13379,31 @@ components: context_length: 8192 is_moderated: true max_completion_tokens: 4096 + links: + next: /api/v1/models?offset=500&limit=500 + total_count: 150 properties: data: $ref: '#/components/schemas/ModelsListResponseData' + links: + description: Pagination links + properties: + next: + description: URL for the next page of results, or null if this is the last page + example: /api/v1/models?offset=500&limit=500 + nullable: true + type: string + required: + - next + type: object + total_count: + description: Total number of models matching the query + example: 150 + type: integer required: - data + - total_count + - links type: object ModelsListResponseData: description: List of available models @@ -13320,7 +13425,7 @@ components: id: openai/gpt-4 knowledge_cutoff: null links: - details: /api/v1/models/openai/gpt-5.4/endpoints + details: /api/v1/models/openai/gpt-4/endpoints name: GPT-4 per_request_limits: null pricing: @@ -13886,6 +13991,69 @@ components: - $ref: '#/components/schemas/ObservabilitySnowflakeDestination' - $ref: '#/components/schemas/ObservabilityWeaveDestination' - $ref: '#/components/schemas/ObservabilityWebhookDestination' + ObservabilityFilterRuleGroup: + example: + logic: and + rules: + - field: model + operator: equals + value: openai/gpt-4o + properties: + logic: + default: and + enum: + - and + - or + type: string + x-speakeasy-unknown-values: allow + rules: + items: + properties: + field: + enum: + - model + - provider + - session_id + - user_id + - api_key_name + - finish_reason + - input + - output + - total_cost + - total_tokens + - prompt_tokens + - completion_tokens + type: string + x-speakeasy-unknown-values: allow + operator: + enum: + - equals + - not_equals + - contains + - not_contains + - regex + - starts_with + - ends_with + - gt + - lt + - gte + - lte + - exists + - not_exists + type: string + x-speakeasy-unknown-values: allow + value: + anyOf: + - type: string + - type: number + required: + - field + - operator + type: object + type: array + required: + - rules + type: object ObservabilityFilterRulesConfig: description: Optional structured filter rules controlling which events are forwarded. example: null @@ -13896,62 +14064,22 @@ components: type: boolean groups: items: - properties: - logic: - default: and - enum: - - and - - or - type: string - x-speakeasy-unknown-values: allow - rules: - items: - properties: - field: - enum: - - model - - provider - - session_id - - user_id - - api_key_name - - finish_reason - - input - - output - - total_cost - - total_tokens - - prompt_tokens - - completion_tokens - type: string - x-speakeasy-unknown-values: allow - operator: - enum: - - equals - - not_equals - - contains - - not_contains - - regex - - starts_with - - ends_with - - gt - - lt - - gte - - lte - - exists - - not_exists - type: string - x-speakeasy-unknown-values: allow - value: - anyOf: - - type: string - - type: number - required: - - field - - operator - type: object - type: array - required: - - rules - type: object + $ref: '#/components/schemas/ObservabilityFilterRuleGroup' + type: array + required: + - groups + type: object + ObservabilityFilterRulesConfigNullable: + description: Optional structured filter rules controlling which events are forwarded. + example: null + nullable: true + properties: + enabled: + default: true + type: boolean + groups: + items: + $ref: '#/components/schemas/ObservabilityFilterRuleGroup' type: array required: - groups @@ -20187,7 +20315,7 @@ components: - $ref: '#/components/schemas/FilesServerTool' - $ref: '#/components/schemas/FusionServerTool_OpenRouter' - $ref: '#/components/schemas/ImageGenerationServerTool_OpenRouter' - - $ref: '#/components/schemas/ChatSearchModelsServerTool' + - $ref: '#/components/schemas/SearchModelsServerTool_OpenRouter' - $ref: '#/components/schemas/WebFetchServerTool' - $ref: '#/components/schemas/WebSearchServerTool_OpenRouter' - $ref: '#/components/schemas/ApplyPatchServerTool_OpenRouter' @@ -20284,6 +20412,22 @@ components: example: medium type: string x-speakeasy-unknown-values: allow + SearchModelsServerTool_OpenRouter: + description: 'OpenRouter built-in server tool: searches and filters AI models available on OpenRouter' + example: + parameters: + max_results: 5 + type: openrouter:experimental__search_models + properties: + parameters: + $ref: '#/components/schemas/SearchModelsServerToolConfig' + type: + enum: + - openrouter:experimental__search_models + type: string + required: + - type + type: object SearchModelsServerToolConfig: description: Configuration for the openrouter:experimental__search_models server tool example: @@ -22362,7 +22506,7 @@ components: type: boolean filter_rules: allOf: - - $ref: '#/components/schemas/ObservabilityFilterRulesConfig' + - $ref: '#/components/schemas/ObservabilityFilterRulesConfigNullable' - description: Optional structured filter rules. `null` clears the rules. Omitting keeps the current value. name: description: Human-readable name for the destination. @@ -24933,6 +25077,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -24943,6 +25088,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -26512,27 +26658,7 @@ paths: format: double type: number cost_details: - description: Breakdown of upstream inference costs - example: - upstream_inference_completions_cost: 0.0004 - upstream_inference_cost: null - upstream_inference_prompt_cost: 0.0008 - nullable: true - properties: - upstream_inference_completions_cost: - format: double - type: number - upstream_inference_cost: - format: double - nullable: true - type: number - upstream_inference_prompt_cost: - format: double - type: number - required: - - upstream_inference_prompt_cost - - upstream_inference_completions_cost - type: object + $ref: '#/components/schemas/CostDetails' is_byok: description: Whether a request was made using a Bring Your Own Key configuration type: boolean @@ -26694,6 +26820,32 @@ paths: get: description: Returns a list of all available embeddings models and their properties operationId: listEmbeddingsModels + 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 + nullable: false + type: integer + - description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned + in: query + name: limit + required: false + schema: + default: 500 + description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned + example: 500 + maximum: 1000 + minimum: 1 + type: integer responses: '200': content: @@ -26758,6 +26910,17 @@ paths: tags: - Embeddings x-speakeasy-name-override: listModels + x-speakeasy-pagination: + inputs: + - in: parameters + name: offset + type: offset + - in: parameters + name: limit + type: limit + outputs: + results: $.data + type: offsetLimit parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" @@ -27683,6 +27846,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -27693,6 +27857,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28120,6 +28285,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28130,6 +28296,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28378,6 +28545,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28388,6 +28556,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28628,6 +28797,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28638,6 +28808,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -28710,6 +28881,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -28720,6 +28892,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -30873,6 +31046,31 @@ paths: get: operationId: getModels 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 + nullable: false + type: integer + - description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned + in: query + name: limit + required: false + schema: + default: 500 + description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned + example: 500 + maximum: 1000 + minimum: 1 + type: integer - description: Filter models by use case category in: query name: category @@ -31230,6 +31428,17 @@ paths: tags: - Models x-speakeasy-name-override: list + x-speakeasy-pagination: + inputs: + - in: parameters + name: offset + type: offset + - in: parameters + name: limit + type: limit + outputs: + results: $.data + type: offsetLimit parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" @@ -31414,6 +31623,32 @@ paths: description: >- List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing). operationId: listModelsUser + 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 + nullable: false + type: integer + - description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned + in: query + name: limit + required: false + schema: + default: 500 + description: >- + Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned + example: 500 + maximum: 1000 + minimum: 1 + type: integer responses: '200': content: @@ -31437,7 +31672,7 @@ paths: id: openai/gpt-4 knowledge_cutoff: null links: - details: /api/v1/models/openai/gpt-5.4/endpoints + details: /api/v1/models/openai/gpt-4/endpoints name: GPT-4 per_request_limits: null pricing: @@ -31493,6 +31728,17 @@ paths: tags: - Models x-speakeasy-name-override: listForUser + x-speakeasy-pagination: + inputs: + - in: parameters + name: offset + type: offset + - in: parameters + name: limit + type: limit + outputs: + results: $.data + type: offsetLimit parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" @@ -31508,6 +31754,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -31518,6 +31765,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -31937,6 +32185,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -31947,6 +32196,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -32072,6 +32322,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -32082,6 +32333,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -32654,6 +32906,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -32664,6 +32917,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -34295,6 +34549,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -34305,6 +34560,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 @@ -34958,6 +35214,7 @@ paths: name: offset required: false schema: + default: 0 description: Number of records to skip for pagination example: 0 minimum: 0 @@ -34968,6 +35225,7 @@ paths: name: limit required: false schema: + default: 50 description: Maximum number of records to return (max 100) example: 50 maximum: 100 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ac79a9f..ddd35cc 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:91baf68600b99a1acb7cb48770bd8c65f2b52078522d9da36800b7643cafc19f - sourceBlobDigest: sha256:02edebbb16b70cdfd1a10bb719ff1031e41efca6d359d06417af23a8aea281cf + sourceRevisionDigest: sha256:aa9148968ef9a66307aca31b047a12fb8a955aa957482a3b06a582537f259cb4 + sourceBlobDigest: sha256:ac0a0e1f34d3f5e342c3ba497bf58ea2d83107f59302dd2c399a70116dfe8845 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:91baf68600b99a1acb7cb48770bd8c65f2b52078522d9da36800b7643cafc19f - sourceBlobDigest: sha256:02edebbb16b70cdfd1a10bb719ff1031e41efca6d359d06417af23a8aea281cf + sourceRevisionDigest: sha256:aa9148968ef9a66307aca31b047a12fb8a955aa957482a3b06a582537f259cb4 + sourceBlobDigest: sha256:ac0a0e1f34d3f5e342c3ba497bf58ea2d83107f59302dd2c399a70116dfe8845 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:4d79cd30506971bb612d61d9874f75ba05d12922734d2c246672e3607f98b17b + codeSamplesRevisionDigest: sha256:252d3909d3f6fce4c2605924214b126af1fe4c3162dd52ba9cf9ad32ddd7dbda workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/README-PYPI.md b/README-PYPI.md index 6b6e72c..633da1b 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -189,7 +189,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.byok.list() + res = open_router.byok.list(offset=0, limit=50) while res is not None: # Handle items diff --git a/README.md b/README.md index 6b6e72c..633da1b 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.byok.list() + res = open_router.byok.list(offset=0, limit=50) while res is not None: # Handle items diff --git a/RELEASES.md b/RELEASES.md index 28a3ac2..f8b0a1d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -338,4 +338,14 @@ Based on: ### Generated - [python v0.11.23] . ### Releases -- [PyPI v0.11.23] https://pypi.org/project/openrouter/0.11.23 - . \ No newline at end of file +- [PyPI v0.11.23] https://pypi.org/project/openrouter/0.11.23 - . + +## 2026-07-13 17:54:57 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.24] . +### Releases +- [PyPI v0.11.24] https://pypi.org/project/openrouter/0.11.24 - . \ No newline at end of file diff --git a/docs/components/additionaltoolsitemtoolunion.mdx b/docs/components/additionaltoolsitemtoolunion.mdx index 5fc5576..31c6852 100644 --- a/docs/components/additionaltoolsitemtoolunion.mdx +++ b/docs/components/additionaltoolsitemtoolunion.mdx @@ -124,10 +124,10 @@ value: components.FusionServerToolOpenRouter = /* values here */ value: components.ImageGenerationServerToolOpenRouter = /* values here */ ``` -### `components.ChatSearchModelsServerTool` +### `components.SearchModelsServerToolOpenRouter` ```python -value: components.ChatSearchModelsServerTool = /* values here */ +value: components.SearchModelsServerToolOpenRouter = /* values here */ ``` ### `components.WebFetchServerTool` diff --git a/docs/components/anthropiccitationsearchresultlocation.mdx b/docs/components/anthropiccitationsearchresultlocation.mdx deleted file mode 100644 index 4766fca..0000000 --- a/docs/components/anthropiccitationsearchresultlocation.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "AnthropicCitationSearchResultLocation" ---- - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| `cited_text` | *str* | :heavy_check_mark: | N/A | -| `end_block_index` | *int* | :heavy_check_mark: | N/A | -| `search_result_index` | *int* | :heavy_check_mark: | N/A | -| `source` | *str* | :heavy_check_mark: | N/A | -| `start_block_index` | *int* | :heavy_check_mark: | N/A | -| `title` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `type` | [components.AnthropicCitationSearchResultLocationType](../components/anthropiccitationsearchresultlocationtype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/anthropiccitationsearchresultlocationparam.mdx b/docs/components/anthropiccitationsearchresultlocationparam.mdx new file mode 100644 index 0000000..8d0c9d2 --- /dev/null +++ b/docs/components/anthropiccitationsearchresultlocationparam.mdx @@ -0,0 +1,15 @@ +--- +title: "AnthropicCitationSearchResultLocationParam" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `cited_text` | *str* | :heavy_check_mark: | N/A | +| `end_block_index` | *int* | :heavy_check_mark: | N/A | +| `search_result_index` | *int* | :heavy_check_mark: | N/A | +| `source` | *str* | :heavy_check_mark: | N/A | +| `start_block_index` | *int* | :heavy_check_mark: | N/A | +| `title` | *Nullable[str]* | :heavy_check_mark: | N/A | +| `type` | [components.AnthropicCitationSearchResultLocationParamType](../components/anthropiccitationsearchresultlocationparamtype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/anthropiccitationsearchresultlocationparamtype.mdx b/docs/components/anthropiccitationsearchresultlocationparamtype.mdx new file mode 100644 index 0000000..36ba3e4 --- /dev/null +++ b/docs/components/anthropiccitationsearchresultlocationparamtype.mdx @@ -0,0 +1,15 @@ +--- +title: "AnthropicCitationSearchResultLocationParamType" +--- + +## Example Usage + +```python +from openrouter.components import AnthropicCitationSearchResultLocationParamType +value: AnthropicCitationSearchResultLocationParamType = "search_result_location" +``` + + +## Values + +- `"search_result_location"` diff --git a/docs/components/anthropiccitationsearchresultlocationtype.mdx b/docs/components/anthropiccitationsearchresultlocationtype.mdx deleted file mode 100644 index 096cc0d..0000000 --- a/docs/components/anthropiccitationsearchresultlocationtype.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "AnthropicCitationSearchResultLocationType" ---- - -## Example Usage - -```python -from openrouter.components import AnthropicCitationSearchResultLocationType -value: AnthropicCitationSearchResultLocationType = "search_result_location" -``` - - -## Values - -- `"search_result_location"` diff --git a/docs/components/anthropiccitationwebsearchresultlocation.mdx b/docs/components/anthropiccitationwebsearchresultlocation.mdx deleted file mode 100644 index b03268f..0000000 --- a/docs/components/anthropiccitationwebsearchresultlocation.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "AnthropicCitationWebSearchResultLocation" ---- - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `cited_text` | *str* | :heavy_check_mark: | N/A | -| `encrypted_index` | *str* | :heavy_check_mark: | N/A | -| `title` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `type` | [components.AnthropicCitationWebSearchResultLocationType](../components/anthropiccitationwebsearchresultlocationtype.mdx) | :heavy_check_mark: | N/A | -| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/anthropiccitationwebsearchresultlocationparam.mdx b/docs/components/anthropiccitationwebsearchresultlocationparam.mdx new file mode 100644 index 0000000..9b59d45 --- /dev/null +++ b/docs/components/anthropiccitationwebsearchresultlocationparam.mdx @@ -0,0 +1,13 @@ +--- +title: "AnthropicCitationWebSearchResultLocationParam" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `cited_text` | *str* | :heavy_check_mark: | N/A | +| `encrypted_index` | *str* | :heavy_check_mark: | N/A | +| `title` | *Nullable[str]* | :heavy_check_mark: | N/A | +| `type` | [components.AnthropicCitationWebSearchResultLocationParamType](../components/anthropiccitationwebsearchresultlocationparamtype.mdx) | :heavy_check_mark: | N/A | +| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/anthropiccitationwebsearchresultlocationparamtype.mdx b/docs/components/anthropiccitationwebsearchresultlocationparamtype.mdx new file mode 100644 index 0000000..4bc0197 --- /dev/null +++ b/docs/components/anthropiccitationwebsearchresultlocationparamtype.mdx @@ -0,0 +1,15 @@ +--- +title: "AnthropicCitationWebSearchResultLocationParamType" +--- + +## Example Usage + +```python +from openrouter.components import AnthropicCitationWebSearchResultLocationParamType +value: AnthropicCitationWebSearchResultLocationParamType = "web_search_result_location" +``` + + +## Values + +- `"web_search_result_location"` diff --git a/docs/components/anthropiccitationwebsearchresultlocationtype.mdx b/docs/components/anthropiccitationwebsearchresultlocationtype.mdx deleted file mode 100644 index 9cb6d29..0000000 --- a/docs/components/anthropiccitationwebsearchresultlocationtype.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "AnthropicCitationWebSearchResultLocationType" ---- - -## Example Usage - -```python -from openrouter.components import AnthropicCitationWebSearchResultLocationType -value: AnthropicCitationWebSearchResultLocationType = "web_search_result_location" -``` - - -## Values - -- `"web_search_result_location"` diff --git a/docs/components/chatformatjsonobjectconfig.mdx b/docs/components/chatformatjsonobjectconfig.mdx new file mode 100644 index 0000000..5dae96c --- /dev/null +++ b/docs/components/chatformatjsonobjectconfig.mdx @@ -0,0 +1,12 @@ +--- +title: "ChatFormatJSONObjectConfig" +--- + +JSON object response format + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `type` | [components.ChatFormatJSONObjectConfigType](../components/chatformatjsonobjectconfigtype.mdx) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatformatjsonobjectconfigtype.mdx b/docs/components/chatformatjsonobjectconfigtype.mdx new file mode 100644 index 0000000..617987c --- /dev/null +++ b/docs/components/chatformatjsonobjectconfigtype.mdx @@ -0,0 +1,15 @@ +--- +title: "ChatFormatJSONObjectConfigType" +--- + +## Example Usage + +```python +from openrouter.components import ChatFormatJSONObjectConfigType +value: ChatFormatJSONObjectConfigType = "json_object" +``` + + +## Values + +- `"json_object"` diff --git a/docs/components/citation.mdx b/docs/components/citation.mdx index 9e50368..2622868 100644 --- a/docs/components/citation.mdx +++ b/docs/components/citation.mdx @@ -22,15 +22,15 @@ value: components.AnthropicCitationContentBlockLocationParam = /* values here */ value: components.AnthropicCitationPageLocationParam = /* values here */ ``` -### `components.AnthropicCitationSearchResultLocation` +### `components.AnthropicCitationSearchResultLocationParam` ```python -value: components.AnthropicCitationSearchResultLocation = /* values here */ +value: components.AnthropicCitationSearchResultLocationParam = /* values here */ ``` -### `components.AnthropicCitationWebSearchResultLocation` +### `components.AnthropicCitationWebSearchResultLocationParam` ```python -value: components.AnthropicCitationWebSearchResultLocation = /* values here */ +value: components.AnthropicCitationWebSearchResultLocationParam = /* values here */ ``` diff --git a/docs/components/createobservabilitydestinationrequest.mdx b/docs/components/createobservabilitydestinationrequest.mdx index a3435fe..065e043 100644 --- a/docs/components/createobservabilitydestinationrequest.mdx +++ b/docs/components/createobservabilitydestinationrequest.mdx @@ -9,7 +9,7 @@ title: "CreateObservabilityDestinationRequest" | `api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided. | null | | `config` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | Provider-specific configuration. The shape depends on `type` and is validated server-side. | \{
"baseUrl": "https://us.cloud.langfuse.com",
"publicKey": "pk-l...EfGh",
"secretKey": "sk-l...AbCd"
} | | `enabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this destination should be enabled immediately. | true | -| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfig]](../components/observabilityfilterrulesconfig.mdx) | :heavy_minus_sign: | Optional structured filter rules controlling which events are forwarded. | null | +| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfigNullable]](../components/observabilityfilterrulesconfignullable.mdx) | :heavy_minus_sign: | Optional structured filter rules controlling which events are forwarded. | null | | `name` | *str* | :heavy_check_mark: | Human-readable name for the destination. | Production Langfuse | | `privacy_mode` | *Optional[bool]* | :heavy_minus_sign: | When true, request/response bodies are not forwarded — only metadata. | false | | `sampling_rate` | *Optional[float]* | :heavy_minus_sign: | Sampling rate between 0.0001 and 1 (1 = 100%). | 1 | diff --git a/docs/components/imageinputmodality.mdx b/docs/components/imageinputmodality.mdx new file mode 100644 index 0000000..9062baf --- /dev/null +++ b/docs/components/imageinputmodality.mdx @@ -0,0 +1,23 @@ +--- +title: "ImageInputModality" +--- + +## Example Usage + +```python +from openrouter.components import ImageInputModality + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ImageInputModality = "text" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"text"` +- `"image"` +- `"file"` +- `"audio"` +- `"video"` diff --git a/docs/components/imagemodelarchitecture.mdx b/docs/components/imagemodelarchitecture.mdx index 6842d9d..860b662 100644 --- a/docs/components/imagemodelarchitecture.mdx +++ b/docs/components/imagemodelarchitecture.mdx @@ -6,5 +6,5 @@ title: "ImageModelArchitecture" | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `input_modalities` | List[[components.InputModality](../components/inputmodality.mdx)] | :heavy_check_mark: | Supported input modalities | +| `input_modalities` | List[[components.ImageInputModality](../components/imageinputmodality.mdx)] | :heavy_check_mark: | Supported input modalities | | `output_modalities` | List[[components.ImageOutputModality](../components/imageoutputmodality.mdx)] | :heavy_check_mark: | Supported output modalities | \ No newline at end of file diff --git a/docs/components/legacychatcontentvideo.mdx b/docs/components/legacychatcontentvideo.mdx index f1d4b3d..74b480b 100644 --- a/docs/components/legacychatcontentvideo.mdx +++ b/docs/components/legacychatcontentvideo.mdx @@ -9,7 +9,7 @@ Video input content part (legacy format - deprecated) ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `type` | [components.LegacyChatContentVideoType](../components/legacychatcontentvideotype.mdx) | :heavy_check_mark: | N/A | | -| `video_url` | [components.ChatContentVideoInput](../components/chatcontentvideoinput.mdx) | :heavy_check_mark: | Video input object | \{
"url": "https://example.com/video.mp4"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `type` | [components.LegacyChatContentVideoType](../components/legacychatcontentvideotype.mdx) | :heavy_check_mark: | N/A | | +| `video_url` | [components.LegacyChatContentVideoInput](../components/legacychatcontentvideoinput.mdx) | :heavy_check_mark: | Video input object | \{
"url": "https://example.com/video.mp4"
} | \ No newline at end of file diff --git a/docs/components/legacychatcontentvideoinput.mdx b/docs/components/legacychatcontentvideoinput.mdx new file mode 100644 index 0000000..d79ac06 --- /dev/null +++ b/docs/components/legacychatcontentvideoinput.mdx @@ -0,0 +1,12 @@ +--- +title: "LegacyChatContentVideoInput" +--- + +Video input object + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | +| `url` | *str* | :heavy_check_mark: | URL of the video (data: URLs supported) | \ No newline at end of file diff --git a/docs/components/links.mdx b/docs/components/links.mdx new file mode 100644 index 0000000..6debf47 --- /dev/null +++ b/docs/components/links.mdx @@ -0,0 +1,12 @@ +--- +title: "Links" +--- + +Pagination links + + +## 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 | /api/v1/models?offset=500&limit=500 | \ No newline at end of file diff --git a/docs/components/messagesrequesttoolunion.mdx b/docs/components/messagesrequesttoolunion.mdx index b24e866..f5868bf 100644 --- a/docs/components/messagesrequesttoolunion.mdx +++ b/docs/components/messagesrequesttoolunion.mdx @@ -58,10 +58,10 @@ value: components.DatetimeServerTool = /* values here */ value: components.ImageGenerationServerToolOpenRouter = /* values here */ ``` -### `components.ChatSearchModelsServerTool` +### `components.MessagesSearchModelsServerTool` ```python -value: components.ChatSearchModelsServerTool = /* values here */ +value: components.MessagesSearchModelsServerTool = /* values here */ ``` ### `components.WebFetchServerTool` diff --git a/docs/components/messagessearchmodelsservertool.mdx b/docs/components/messagessearchmodelsservertool.mdx new file mode 100644 index 0000000..e13f74e --- /dev/null +++ b/docs/components/messagessearchmodelsservertool.mdx @@ -0,0 +1,13 @@ +--- +title: "MessagesSearchModelsServerTool" +--- + +OpenRouter built-in server tool: searches and filters AI models available on OpenRouter + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `parameters` | [Optional[components.SearchModelsServerToolConfig]](../components/searchmodelsservertoolconfig.mdx) | :heavy_minus_sign: | Configuration for the openrouter:experimental__search_models server tool | \{
"max_results": 5
} | +| `type` | [components.MessagesSearchModelsServerToolType](../components/messagessearchmodelsservertooltype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/messagessearchmodelsservertooltype.mdx b/docs/components/messagessearchmodelsservertooltype.mdx new file mode 100644 index 0000000..52ce907 --- /dev/null +++ b/docs/components/messagessearchmodelsservertooltype.mdx @@ -0,0 +1,15 @@ +--- +title: "MessagesSearchModelsServerToolType" +--- + +## Example Usage + +```python +from openrouter.components import MessagesSearchModelsServerToolType +value: MessagesSearchModelsServerToolType = "openrouter:experimental__search_models" +``` + + +## Values + +- `"openrouter:experimental__search_models"` diff --git a/docs/components/modelarchitecture.mdx b/docs/components/modelarchitecture.mdx index 3035c9b..d46fef4 100644 --- a/docs/components/modelarchitecture.mdx +++ b/docs/components/modelarchitecture.mdx @@ -7,10 +7,10 @@ Model architecture information ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `input_modalities` | List[[components.InputModality](../components/inputmodality.mdx)] | :heavy_check_mark: | Supported input modalities | | -| `instruct_type` | [OptionalNullable[components.ModelArchitectureInstructType]](../components/modelarchitectureinstructtype.mdx) | :heavy_minus_sign: | Instruction format type | chatml | -| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text->text | -| `output_modalities` | List[[components.OutputModality](../components/outputmodality.mdx)] | :heavy_check_mark: | Supported output modalities | | -| `tokenizer` | [Optional[components.ModelGroup]](../components/modelgroup.mdx) | :heavy_minus_sign: | Tokenizer type used by the model | GPT | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `input_modalities` | List[[components.InputModality](../components/inputmodality.mdx)] | :heavy_check_mark: | Supported input modalities | | +| `instruct_type` | [OptionalNullable[components.InstructType]](../components/instructtype.mdx) | :heavy_minus_sign: | Instruction format type | chatml | +| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text->text | +| `output_modalities` | List[[components.OutputModality](../components/outputmodality.mdx)] | :heavy_check_mark: | Supported output modalities | | +| `tokenizer` | [Optional[components.ModelGroup]](../components/modelgroup.mdx) | :heavy_minus_sign: | Tokenizer type used by the model | GPT | \ No newline at end of file diff --git a/docs/components/modelarchitectureinstructtype.mdx b/docs/components/modelarchitectureinstructtype.mdx deleted file mode 100644 index c8d0213..0000000 --- a/docs/components/modelarchitectureinstructtype.mdx +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "ModelArchitectureInstructType" ---- - -Instruction format type - -## Example Usage - -```python -from openrouter.components import ModelArchitectureInstructType - -# Open enum: unrecognized values are captured as UnrecognizedStr -value: ModelArchitectureInstructType = "none" -``` - - -## Values - -This is an open enum. Unrecognized values will not fail type checks. - -- `"none"` -- `"airoboros"` -- `"alpaca"` -- `"alpaca-modif"` -- `"chatml"` -- `"claude"` -- `"code-llama"` -- `"gemma"` -- `"llama2"` -- `"llama3"` -- `"mistral"` -- `"nemotron"` -- `"neural"` -- `"openchat"` -- `"phi3"` -- `"rwkv"` -- `"vicuna"` -- `"zephyr"` -- `"deepseek-r1"` -- `"deepseek-v3.1"` -- `"qwq"` -- `"qwen3"` diff --git a/docs/components/modelslistresponse.mdx b/docs/components/modelslistresponse.mdx index 140ec11..ac531b9 100644 --- a/docs/components/modelslistresponse.mdx +++ b/docs/components/modelslistresponse.mdx @@ -7,6 +7,8 @@ List of available models ## Fields -| 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-5.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
}
}
] | \ No newline at end of file +| 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 | | +| `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/group.mdx b/docs/components/observabilityfilterrulegroup.mdx similarity index 95% rename from docs/components/group.mdx rename to docs/components/observabilityfilterrulegroup.mdx index 34495da..95aa7cf 100644 --- a/docs/components/group.mdx +++ b/docs/components/observabilityfilterrulegroup.mdx @@ -1,5 +1,5 @@ --- -title: "Group" +title: "ObservabilityFilterRuleGroup" --- ## Fields diff --git a/docs/components/observabilityfilterrulesconfigvalue.mdx b/docs/components/observabilityfilterrulegroupvalue.mdx similarity index 76% rename from docs/components/observabilityfilterrulesconfigvalue.mdx rename to docs/components/observabilityfilterrulegroupvalue.mdx index 6b335f6..af2effd 100644 --- a/docs/components/observabilityfilterrulesconfigvalue.mdx +++ b/docs/components/observabilityfilterrulegroupvalue.mdx @@ -1,5 +1,5 @@ --- -title: "ObservabilityFilterRulesConfigValue" +title: "ObservabilityFilterRuleGroupValue" --- ## Supported Types diff --git a/docs/components/observabilityfilterrulesconfig.mdx b/docs/components/observabilityfilterrulesconfig.mdx index 4633042..8393404 100644 --- a/docs/components/observabilityfilterrulesconfig.mdx +++ b/docs/components/observabilityfilterrulesconfig.mdx @@ -7,7 +7,7 @@ Optional structured filter rules controlling which events are forwarded. ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `groups` | List[[components.Group](../components/group.mdx)] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `groups` | List[[components.ObservabilityFilterRuleGroup](../components/observabilityfilterrulegroup.mdx)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/observabilityfilterrulesconfignullable.mdx b/docs/components/observabilityfilterrulesconfignullable.mdx new file mode 100644 index 0000000..842fa8f --- /dev/null +++ b/docs/components/observabilityfilterrulesconfignullable.mdx @@ -0,0 +1,13 @@ +--- +title: "ObservabilityFilterRulesConfigNullable" +--- + +Optional structured filter rules controlling which events are forwarded. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `groups` | List[[components.ObservabilityFilterRuleGroup](../components/observabilityfilterrulegroup.mdx)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/responseformat.mdx b/docs/components/responseformat.mdx index 29709ef..4715eae 100644 --- a/docs/components/responseformat.mdx +++ b/docs/components/responseformat.mdx @@ -13,10 +13,10 @@ Response format configuration value: components.ChatFormatGrammarConfig = /* values here */ ``` -### `components.FormatJSONObjectConfig` +### `components.ChatFormatJSONObjectConfig` ```python -value: components.FormatJSONObjectConfig = /* values here */ +value: components.ChatFormatJSONObjectConfig = /* values here */ ``` ### `components.ChatFormatJSONSchemaConfig` diff --git a/docs/components/responsesrequesttoolunion.mdx b/docs/components/responsesrequesttoolunion.mdx index bfec11b..b06f8e7 100644 --- a/docs/components/responsesrequesttoolunion.mdx +++ b/docs/components/responsesrequesttoolunion.mdx @@ -124,10 +124,10 @@ value: components.FusionServerToolOpenRouter = /* values here */ value: components.ImageGenerationServerToolOpenRouter = /* values here */ ``` -### `components.ChatSearchModelsServerTool` +### `components.SearchModelsServerToolOpenRouter` ```python -value: components.ChatSearchModelsServerTool = /* values here */ +value: components.SearchModelsServerToolOpenRouter = /* values here */ ``` ### `components.WebFetchServerTool` diff --git a/docs/components/rule.mdx b/docs/components/rule.mdx index d585c3b..14a9f71 100644 --- a/docs/components/rule.mdx +++ b/docs/components/rule.mdx @@ -4,8 +4,8 @@ title: "Rule" ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `field` | [components.FieldT](../components/fieldt.mdx) | :heavy_check_mark: | N/A | -| `operator` | [components.Operator](../components/operator.mdx) | :heavy_check_mark: | N/A | -| `value` | [Optional[components.ObservabilityFilterRulesConfigValue]](../components/observabilityfilterrulesconfigvalue.mdx) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `field` | [components.FieldT](../components/fieldt.mdx) | :heavy_check_mark: | N/A | +| `operator` | [components.Operator](../components/operator.mdx) | :heavy_check_mark: | N/A | +| `value` | [Optional[components.ObservabilityFilterRuleGroupValue]](../components/observabilityfilterrulegroupvalue.mdx) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/searchmodelsservertoolopenrouter.mdx b/docs/components/searchmodelsservertoolopenrouter.mdx new file mode 100644 index 0000000..e72c5e1 --- /dev/null +++ b/docs/components/searchmodelsservertoolopenrouter.mdx @@ -0,0 +1,13 @@ +--- +title: "SearchModelsServerToolOpenRouter" +--- + +OpenRouter built-in server tool: searches and filters AI models available on OpenRouter + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `parameters` | [Optional[components.SearchModelsServerToolConfig]](../components/searchmodelsservertoolconfig.mdx) | :heavy_minus_sign: | Configuration for the openrouter:experimental__search_models server tool | \{
"max_results": 5
} | +| `type` | [components.SearchModelsServerToolOpenRouterType](../components/searchmodelsservertoolopenroutertype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/searchmodelsservertoolopenroutertype.mdx b/docs/components/searchmodelsservertoolopenroutertype.mdx new file mode 100644 index 0000000..e57b048 --- /dev/null +++ b/docs/components/searchmodelsservertoolopenroutertype.mdx @@ -0,0 +1,15 @@ +--- +title: "SearchModelsServerToolOpenRouterType" +--- + +## Example Usage + +```python +from openrouter.components import SearchModelsServerToolOpenRouterType +value: SearchModelsServerToolOpenRouterType = "openrouter:experimental__search_models" +``` + + +## Values + +- `"openrouter:experimental__search_models"` diff --git a/docs/components/updateobservabilitydestinationrequest.mdx b/docs/components/updateobservabilitydestinationrequest.mdx index 1a6d041..f133842 100644 --- a/docs/components/updateobservabilitydestinationrequest.mdx +++ b/docs/components/updateobservabilitydestinationrequest.mdx @@ -9,7 +9,7 @@ title: "UpdateObservabilityDestinationRequest" | `api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes. `null` clears the filter (all keys). Omitting leaves the current value. Must contain at least one hash if provided. | null | | `config` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Provider-specific configuration fields to update. Masked values are ignored; unset fields keep their current value. | \{
"baseUrl": "https://us.cloud.langfuse.com",
"publicKey": "pk-l...EfGh",
"secretKey": "sk-l...AbCd"
} | | `enabled` | *Optional[bool]* | :heavy_minus_sign: | Whether the destination is enabled. | true | -| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfig]](../components/observabilityfilterrulesconfig.mdx) | :heavy_minus_sign: | N/A | null | +| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfigNullable]](../components/observabilityfilterrulesconfignullable.mdx) | :heavy_minus_sign: | N/A | null | | `name` | *Optional[str]* | :heavy_minus_sign: | Human-readable name for the destination. | Production Langfuse | | `privacy_mode` | *Optional[bool]* | :heavy_minus_sign: | When true, request/response bodies are not forwarded — only metadata. | false | | `sampling_rate` | *Optional[float]* | :heavy_minus_sign: | Sampling rate between 0.0001 and 1 (1 = 100%). | 1 | \ No newline at end of file diff --git a/docs/operations/costdetails.mdx b/docs/operations/costdetails.mdx deleted file mode 100644 index 753493b..0000000 --- a/docs/operations/costdetails.mdx +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: "CostDetails" ---- - -Breakdown of upstream inference costs - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- | -| `upstream_inference_completions_cost` | *float* | :heavy_check_mark: | N/A | -| `upstream_inference_cost` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `upstream_inference_prompt_cost` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createembeddingsusage.mdx b/docs/operations/createembeddingsusage.mdx index 1050293..1218cf9 100644 --- a/docs/operations/createembeddingsusage.mdx +++ b/docs/operations/createembeddingsusage.mdx @@ -10,7 +10,7 @@ Token usage statistics | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `cost` | *Optional[float]* | :heavy_minus_sign: | Cost of the request in credits | 0.0001 | -| `cost_details` | [OptionalNullable[operations.CostDetails]](../operations/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} | +| `cost_details` | [OptionalNullable[components.CostDetails]](../components/costdetails.mdx) | :heavy_minus_sign: | Breakdown of upstream inference costs | \{
"upstream_inference_completions_cost": 0.0004,
"upstream_inference_cost": null,
"upstream_inference_prompt_cost": 0.0008
} | | `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | | | `prompt_tokens` | *int* | :heavy_check_mark: | Number of tokens in the input | 8 | | `prompt_tokens_details` | [Optional[operations.PromptTokensDetails]](../operations/prompttokensdetails.mdx) | :heavy_minus_sign: | Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. | | diff --git a/docs/operations/getmodelsrequest.mdx b/docs/operations/getmodelsrequest.mdx index 3cf889e..532a1ab 100644 --- a/docs/operations/getmodelsrequest.mdx +++ b/docs/operations/getmodelsrequest.mdx @@ -9,6 +9,8 @@ title: "GetModelsRequest" | `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` | *Optional[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 1000). When both offset and limit are omitted, the full list is returned | 500 | | `category` | [Optional[operations.GetModelsCategory]](../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | | `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | diff --git a/docs/operations/getmodelsresponse.mdx b/docs/operations/getmodelsresponse.mdx new file mode 100644 index 0000000..c7353f3 --- /dev/null +++ b/docs/operations/getmodelsresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "GetModelsResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ModelsListResponse](../components/modelslistresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"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",
"frequency_penalty",
"presence_penalty"
],
"supported_voices": null,
"top_provider": \{
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
}
}
],
"links": \{
"next": "/api/v1/models?offset=500\u0026limit=500"
},
"total_count": 150
} | \ No newline at end of file diff --git a/docs/operations/listembeddingsmodelsrequest.mdx b/docs/operations/listembeddingsmodelsrequest.mdx index 76c365b..7e49148 100644 --- a/docs/operations/listembeddingsmodelsrequest.mdx +++ b/docs/operations/listembeddingsmodelsrequest.mdx @@ -4,8 +4,10 @@ title: "ListEmbeddingsModelsRequest" ## 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 +| 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` | *Optional[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 1000). When both offset and limit are omitted, the full list is returned | 500 | \ No newline at end of file diff --git a/docs/operations/listembeddingsmodelsresponse.mdx b/docs/operations/listembeddingsmodelsresponse.mdx new file mode 100644 index 0000000..053af0a --- /dev/null +++ b/docs/operations/listembeddingsmodelsresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListEmbeddingsModelsResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ModelsListResponse](../components/modelslistresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"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",
"frequency_penalty",
"presence_penalty"
],
"supported_voices": null,
"top_provider": \{
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
}
}
],
"links": \{
"next": "/api/v1/models?offset=500\u0026limit=500"
},
"total_count": 150
} | \ No newline at end of file diff --git a/docs/operations/listmodelsuserrequest.mdx b/docs/operations/listmodelsuserrequest.mdx index 3b65b53..ca39aea 100644 --- a/docs/operations/listmodelsuserrequest.mdx +++ b/docs/operations/listmodelsuserrequest.mdx @@ -4,8 +4,10 @@ title: "ListModelsUserRequest" ## 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 +| 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` | *Optional[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 1000). When both offset and limit are omitted, the full list is returned | 500 | \ No newline at end of file diff --git a/docs/operations/listmodelsuserresponse.mdx b/docs/operations/listmodelsuserresponse.mdx new file mode 100644 index 0000000..380f686 --- /dev/null +++ b/docs/operations/listmodelsuserresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListModelsUserResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ModelsListResponse](../components/modelslistresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"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",
"frequency_penalty",
"presence_penalty"
],
"supported_voices": null,
"top_provider": \{
"context_length": 8192,
"is_moderated": true,
"max_completion_tokens": 4096
}
}
],
"links": \{
"next": "/api/v1/models?offset=500\u0026limit=500"
},
"total_count": 150
} | \ No newline at end of file diff --git a/docs/sdks/byok/README.mdx b/docs/sdks/byok/README.mdx index f1da2da..513bb72 100644 --- a/docs/sdks/byok/README.mdx +++ b/docs/sdks/byok/README.mdx @@ -33,7 +33,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.byok.list() + res = open_router.byok.list(offset=0, limit=50) while res is not None: # Handle items diff --git a/docs/sdks/embeddings/README.mdx b/docs/sdks/embeddings/README.mdx index bf8b8c5..0ec380e 100644 --- a/docs/sdks/embeddings/README.mdx +++ b/docs/sdks/embeddings/README.mdx @@ -91,25 +91,29 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.embeddings.list_models() + res = open_router.embeddings.list_models(offset=0, limit=500) - # Handle response - print(res) + while res is not None: + # Handle items + + res = res.next() ``` ### Parameters -| Parameter | 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.
| -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | 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` | *Optional[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 1000). When both offset and limit are omitted, the full list is returned | 500 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response -**[components.ModelsListResponse](../../components/modelslistresponse.mdx)** +**[operations.ListEmbeddingsModelsResponse](../../operations/listembeddingsmodelsresponse.mdx)** ### Errors diff --git a/docs/sdks/guardrails/README.mdx b/docs/sdks/guardrails/README.mdx index d164a1d..52efbd9 100644 --- a/docs/sdks/guardrails/README.mdx +++ b/docs/sdks/guardrails/README.mdx @@ -41,7 +41,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.guardrails.list() + res = open_router.guardrails.list(offset=0, limit=50) while res is not None: # Handle items @@ -320,7 +320,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.guardrails.list_guardrail_key_assignments(id="550e8400-e29b-41d4-a716-446655440000") + res = open_router.guardrails.list_guardrail_key_assignments(id="550e8400-e29b-41d4-a716-446655440000", offset=0, limit=50) while res is not None: # Handle items @@ -476,7 +476,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.guardrails.list_guardrail_member_assignments(id="550e8400-e29b-41d4-a716-446655440000") + res = open_router.guardrails.list_guardrail_member_assignments(id="550e8400-e29b-41d4-a716-446655440000", offset=0, limit=50) while res is not None: # Handle items @@ -634,7 +634,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.guardrails.list_key_assignments() + res = open_router.guardrails.list_key_assignments(offset=0, limit=50) while res is not None: # Handle items @@ -684,7 +684,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.guardrails.list_member_assignments() + res = open_router.guardrails.list_member_assignments(offset=0, limit=50) while res is not None: # Handle items diff --git a/docs/sdks/models/README.mdx b/docs/sdks/models/README.mdx index 888dcaa..dd4b542 100644 --- a/docs/sdks/models/README.mdx +++ b/docs/sdks/models/README.mdx @@ -80,10 +80,12 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.models.list() + res = open_router.models.list(offset=0, limit=500) - # Handle response - print(res) + while res is not None: + # Handle items + + res = res.next() ``` @@ -94,6 +96,8 @@ with OpenRouter( | `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` | *Optional[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 1000). When both offset and limit are omitted, the full list is returned | 500 | | `category` | [Optional[operations.GetModelsCategory]](../../operations/getmodelscategory.mdx) | :heavy_minus_sign: | Filter models by use case category | programming | | `supported_parameters` | *Optional[str]* | :heavy_minus_sign: | Filter models by supported parameter (comma-separated) | temperature | | `output_modalities` | *Optional[str]* | :heavy_minus_sign: | Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text". | text | @@ -125,7 +129,7 @@ with OpenRouter( ### Response -**[components.ModelsListResponse](../../components/modelslistresponse.mdx)** +**[operations.GetModelsResponse](../../operations/getmodelsresponse.mdx)** ### Errors @@ -201,26 +205,30 @@ with OpenRouter( res = open_router.models.list_for_user(security=operations.ListModelsUserSecurity( bearer=os.getenv("OPENROUTER_BEARER", ""), - )) + ), offset=0, limit=500) - # Handle response - print(res) + while res is not None: + # Handle items + + res = res.next() ``` ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.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.
| -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `security` | [operations.ListModelsUserSecurity](../../operations/listmodelsusersecurity.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` | *Optional[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 1000). When both offset and limit are omitted, the full list is returned | 500 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response -**[components.ModelsListResponse](../../components/modelslistresponse.mdx)** +**[operations.ListModelsUserResponse](../../operations/listmodelsuserresponse.mdx)** ### Errors diff --git a/docs/sdks/observability/README.mdx b/docs/sdks/observability/README.mdx index 869bf82..fb37fc0 100644 --- a/docs/sdks/observability/README.mdx +++ b/docs/sdks/observability/README.mdx @@ -33,7 +33,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.observability.list() + res = open_router.observability.list(offset=0, limit=50) while res is not None: # Handle items @@ -107,7 +107,7 @@ with OpenRouter( | `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.
| | | `api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided. | null | | `enabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this destination should be enabled immediately. | true | -| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfig]](../../components/observabilityfilterrulesconfig.mdx) | :heavy_minus_sign: | Optional structured filter rules controlling which events are forwarded. | null | +| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfigNullable]](../../components/observabilityfilterrulesconfignullable.mdx) | :heavy_minus_sign: | Optional structured filter rules controlling which events are forwarded. | null | | `privacy_mode` | *Optional[bool]* | :heavy_minus_sign: | When true, request/response bodies are not forwarded — only metadata. | false | | `sampling_rate` | *Optional[float]* | :heavy_minus_sign: | Sampling rate between 0.0001 and 1 (1 = 100%). | 1 | | `workspace_id` | *Optional[str]* | :heavy_minus_sign: | Optional workspace ID. Defaults to the authenticated entity's default workspace. | 550e8400-e29b-41d4-a716-446655440000 | @@ -260,7 +260,7 @@ with OpenRouter( | `api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes. `null` clears the filter (all keys). Omitting leaves the current value. Must contain at least one hash if provided. | null | | `config` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Provider-specific configuration fields to update. Masked values are ignored; unset fields keep their current value. | \{
"baseUrl": "https://us.cloud.langfuse.com",
"publicKey": "pk-l...EfGh",
"secretKey": "sk-l...AbCd"
} | | `enabled` | *Optional[bool]* | :heavy_minus_sign: | Whether the destination is enabled. | true | -| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfig]](../../components/observabilityfilterrulesconfig.mdx) | :heavy_minus_sign: | N/A | null | +| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfigNullable]](../../components/observabilityfilterrulesconfignullable.mdx) | :heavy_minus_sign: | N/A | null | | `name` | *Optional[str]* | :heavy_minus_sign: | Human-readable name for the destination. | Production Langfuse | | `privacy_mode` | *Optional[bool]* | :heavy_minus_sign: | When true, request/response bodies are not forwarded — only metadata. | false | | `sampling_rate` | *Optional[float]* | :heavy_minus_sign: | Sampling rate between 0.0001 and 1 (1 = 100%). | 1 | diff --git a/docs/sdks/organization/README.mdx b/docs/sdks/organization/README.mdx index 6e199ab..32a291c 100644 --- a/docs/sdks/organization/README.mdx +++ b/docs/sdks/organization/README.mdx @@ -29,7 +29,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.organization.list_members() + res = open_router.organization.list_members(offset=0, limit=50) while res is not None: # Handle items diff --git a/docs/sdks/presets/README.mdx b/docs/sdks/presets/README.mdx index 5f20994..ef18762 100644 --- a/docs/sdks/presets/README.mdx +++ b/docs/sdks/presets/README.mdx @@ -35,7 +35,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.presets.list() + res = open_router.presets.list(offset=0, limit=50) while res is not None: # Handle items @@ -404,7 +404,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.presets.list_versions(slug="my-preset") + res = open_router.presets.list_versions(slug="my-preset", offset=0, limit=50) while res is not None: # Handle items diff --git a/docs/sdks/workspaces/README.mdx b/docs/sdks/workspaces/README.mdx index 37f2346..547d8b7 100644 --- a/docs/sdks/workspaces/README.mdx +++ b/docs/sdks/workspaces/README.mdx @@ -39,7 +39,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.workspaces.list() + res = open_router.workspaces.list(offset=0, limit=50) while res is not None: # Handle items @@ -455,7 +455,7 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.workspaces.list_members(id="production") + res = open_router.workspaces.list_members(id="production", offset=0, limit=50) while res is not None: # Handle items diff --git a/pyproject.toml b/pyproject.toml index 6c7ed42..88b38af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.23" +version = "0.11.24" 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 4008986..e328286 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.23" +__version__: str = "0.11.24" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.23 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.24 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/byok.py b/src/openrouter/byok.py index fcbfd1a..08b177b 100644 --- a/src/openrouter/byok.py +++ b/src/openrouter/byok.py @@ -19,8 +19,8 @@ class Byok(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, workspace_id: Optional[str] = None, provider: Optional[operations.Provider] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -129,7 +129,7 @@ class Byok(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -185,8 +185,8 @@ class Byok(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, workspace_id: Optional[str] = None, provider: Optional[operations.Provider] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -298,7 +298,7 @@ class Byok(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 0aa6251..1f75553 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -95,15 +95,15 @@ if TYPE_CHECKING: AnthropicCitationPageLocationParamType, AnthropicCitationPageLocationParamTypedDict, ) - from .anthropiccitationsearchresultlocation import ( - AnthropicCitationSearchResultLocation, - AnthropicCitationSearchResultLocationType, - AnthropicCitationSearchResultLocationTypedDict, + from .anthropiccitationsearchresultlocationparam import ( + AnthropicCitationSearchResultLocationParam, + AnthropicCitationSearchResultLocationParamType, + AnthropicCitationSearchResultLocationParamTypedDict, ) - from .anthropiccitationwebsearchresultlocation import ( - AnthropicCitationWebSearchResultLocation, - AnthropicCitationWebSearchResultLocationType, - AnthropicCitationWebSearchResultLocationTypedDict, + from .anthropiccitationwebsearchresultlocationparam import ( + AnthropicCitationWebSearchResultLocationParam, + AnthropicCitationWebSearchResultLocationParamType, + AnthropicCitationWebSearchResultLocationParamTypedDict, ) from .anthropiccompactionusageiteration import ( AnthropicCompactionUsageIteration, @@ -470,6 +470,11 @@ if TYPE_CHECKING: ChatFormatGrammarConfigType, ChatFormatGrammarConfigTypedDict, ) + from .chatformatjsonobjectconfig import ( + ChatFormatJSONObjectConfig, + ChatFormatJSONObjectConfigType, + ChatFormatJSONObjectConfigTypedDict, + ) from .chatformatjsonschemaconfig import ( ChatFormatJSONSchemaConfig, ChatFormatJSONSchemaConfigType, @@ -1217,6 +1222,7 @@ if TYPE_CHECKING: ImageGenTextChunkEventType, ImageGenTextChunkEventTypedDict, ) + from .imageinputmodality import ImageInputModality from .imagemodelarchitecture import ( ImageModelArchitecture, ImageModelArchitectureTypedDict, @@ -1327,6 +1333,10 @@ if TYPE_CHECKING: LegacyChatContentVideoType, LegacyChatContentVideoTypedDict, ) + from .legacy_chatcontentvideoinput import ( + LegacyChatContentVideoInput, + LegacyChatContentVideoInputTypedDict, + ) from .legacy_websearchservertool import ( LegacyWebSearchServerTool, LegacyWebSearchServerToolType, @@ -1586,13 +1596,14 @@ if TYPE_CHECKING: TypeWebSearch20250305, TypeWebSearch20260209, ) + from .messagessearchmodelsservertool import ( + MessagesSearchModelsServerTool, + MessagesSearchModelsServerToolType, + MessagesSearchModelsServerToolTypedDict, + ) from .metadatalevel import MetadataLevel from .model import Model, ModelTypedDict - from .modelarchitecture import ( - ModelArchitecture, - ModelArchitectureInstructType, - ModelArchitectureTypedDict, - ) + from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict from .modelgroup import ModelGroup from .modellinks import ModelLinks, ModelLinksTypedDict @@ -1604,7 +1615,12 @@ if TYPE_CHECKING: ModelsCountResponseDataTypedDict, ModelsCountResponseTypedDict, ) - from .modelslistresponse import ModelsListResponse, ModelsListResponseTypedDict + from .modelslistresponse import ( + Links, + LinksTypedDict, + ModelsListResponse, + ModelsListResponseTypedDict, + ) from .moderationplugin import ( ModerationPlugin, ModerationPluginID, @@ -1648,19 +1664,25 @@ if TYPE_CHECKING: ObservabilityDestinationTypedDict, UnknownObservabilityDestination, ) - from .observabilityfilterrulesconfig import ( + from .observabilityfilterrulegroup import ( FieldT, - Group, - GroupTypedDict, Logic, - ObservabilityFilterRulesConfig, - ObservabilityFilterRulesConfigTypedDict, - ObservabilityFilterRulesConfigValue, - ObservabilityFilterRulesConfigValueTypedDict, + ObservabilityFilterRuleGroup, + ObservabilityFilterRuleGroupTypedDict, + ObservabilityFilterRuleGroupValue, + ObservabilityFilterRuleGroupValueTypedDict, Operator, Rule, RuleTypedDict, ) + from .observabilityfilterrulesconfig import ( + ObservabilityFilterRulesConfig, + ObservabilityFilterRulesConfigTypedDict, + ) + from .observabilityfilterrulesconfignullable import ( + ObservabilityFilterRulesConfigNullable, + ObservabilityFilterRulesConfigNullableTypedDict, + ) from .observabilitygrafanadestination import ( ObservabilityGrafanaDestination, ObservabilityGrafanaDestinationConfig, @@ -2375,6 +2397,11 @@ if TYPE_CHECKING: from .routerparams import RouterParams, RouterParamsTypedDict from .routingstrategy import RoutingStrategy from .searchcontextsizeenum import SearchContextSizeEnum + from .searchmodelsservertool_openrouter import ( + SearchModelsServerToolOpenRouter, + SearchModelsServerToolOpenRouterType, + SearchModelsServerToolOpenRouterTypedDict, + ) from .searchmodelsservertoolconfig import ( SearchModelsServerToolConfig, SearchModelsServerToolConfigTypedDict, @@ -2866,12 +2893,12 @@ __all__ = [ "AnthropicCitationPageLocationParam", "AnthropicCitationPageLocationParamType", "AnthropicCitationPageLocationParamTypedDict", - "AnthropicCitationSearchResultLocation", - "AnthropicCitationSearchResultLocationType", - "AnthropicCitationSearchResultLocationTypedDict", - "AnthropicCitationWebSearchResultLocation", - "AnthropicCitationWebSearchResultLocationType", - "AnthropicCitationWebSearchResultLocationTypedDict", + "AnthropicCitationSearchResultLocationParam", + "AnthropicCitationSearchResultLocationParamType", + "AnthropicCitationSearchResultLocationParamTypedDict", + "AnthropicCitationWebSearchResultLocationParam", + "AnthropicCitationWebSearchResultLocationParamType", + "AnthropicCitationWebSearchResultLocationParamTypedDict", "AnthropicCompactionUsageIteration", "AnthropicCompactionUsageIterationType", "AnthropicCompactionUsageIterationTypedDict", @@ -3112,6 +3139,9 @@ __all__ = [ "ChatFormatGrammarConfig", "ChatFormatGrammarConfigType", "ChatFormatGrammarConfigTypedDict", + "ChatFormatJSONObjectConfig", + "ChatFormatJSONObjectConfigType", + "ChatFormatJSONObjectConfigTypedDict", "ChatFormatJSONSchemaConfig", "ChatFormatJSONSchemaConfigType", "ChatFormatJSONSchemaConfigTypedDict", @@ -3592,8 +3622,6 @@ __all__ = [ "GetPresetVersionResponseTypedDict", "GetWorkspaceResponse", "GetWorkspaceResponseTypedDict", - "Group", - "GroupTypedDict", "Guardrail", "GuardrailInterval", "GuardrailTypedDict", @@ -3665,6 +3693,7 @@ __all__ = [ "ImageGenerationUsagePromptTokensDetails", "ImageGenerationUsagePromptTokensDetailsTypedDict", "ImageGenerationUsageTypedDict", + "ImageInputModality", "ImageModelArchitecture", "ImageModelArchitectureTypedDict", "ImageModelEndpointsResponse", @@ -3774,11 +3803,15 @@ __all__ = [ "KeyAssignment", "KeyAssignmentTypedDict", "LegacyChatContentVideo", + "LegacyChatContentVideoInput", + "LegacyChatContentVideoInputTypedDict", "LegacyChatContentVideoType", "LegacyChatContentVideoTypedDict", "LegacyWebSearchServerTool", "LegacyWebSearchServerToolType", "LegacyWebSearchServerToolTypedDict", + "Links", + "LinksTypedDict", "ListBYOKKeysResponse", "ListBYOKKeysResponseTypedDict", "ListEndpointsResponse", @@ -3869,6 +3902,9 @@ __all__ = [ "MessagesRequestToolUnion", "MessagesRequestToolUnionTypedDict", "MessagesRequestTypedDict", + "MessagesSearchModelsServerTool", + "MessagesSearchModelsServerToolType", + "MessagesSearchModelsServerToolTypedDict", "MetadataLevel", "Method", "Modality", @@ -3878,7 +3914,6 @@ __all__ = [ "ModeTypedDict", "Model", "ModelArchitecture", - "ModelArchitectureInstructType", "ModelArchitectureTypedDict", "ModelBenchmarks", "ModelBenchmarksTypedDict", @@ -3933,10 +3968,14 @@ __all__ = [ "ObservabilityDatadogDestinationTypedDict", "ObservabilityDestination", "ObservabilityDestinationTypedDict", + "ObservabilityFilterRuleGroup", + "ObservabilityFilterRuleGroupTypedDict", + "ObservabilityFilterRuleGroupValue", + "ObservabilityFilterRuleGroupValueTypedDict", "ObservabilityFilterRulesConfig", + "ObservabilityFilterRulesConfigNullable", + "ObservabilityFilterRulesConfigNullableTypedDict", "ObservabilityFilterRulesConfigTypedDict", - "ObservabilityFilterRulesConfigValue", - "ObservabilityFilterRulesConfigValueTypedDict", "ObservabilityGrafanaDestination", "ObservabilityGrafanaDestinationConfig", "ObservabilityGrafanaDestinationConfigTypedDict", @@ -4459,6 +4498,9 @@ __all__ = [ "SearchContextSizeEnum", "SearchModelsServerToolConfig", "SearchModelsServerToolConfigTypedDict", + "SearchModelsServerToolOpenRouter", + "SearchModelsServerToolOpenRouterType", + "SearchModelsServerToolOpenRouterTypedDict", "SearchQualityLevel", "Security", "SecurityTypedDict", @@ -4906,12 +4948,12 @@ _dynamic_imports: dict[str, str] = { "AnthropicCitationPageLocationParam": ".anthropiccitationpagelocationparam", "AnthropicCitationPageLocationParamType": ".anthropiccitationpagelocationparam", "AnthropicCitationPageLocationParamTypedDict": ".anthropiccitationpagelocationparam", - "AnthropicCitationSearchResultLocation": ".anthropiccitationsearchresultlocation", - "AnthropicCitationSearchResultLocationType": ".anthropiccitationsearchresultlocation", - "AnthropicCitationSearchResultLocationTypedDict": ".anthropiccitationsearchresultlocation", - "AnthropicCitationWebSearchResultLocation": ".anthropiccitationwebsearchresultlocation", - "AnthropicCitationWebSearchResultLocationType": ".anthropiccitationwebsearchresultlocation", - "AnthropicCitationWebSearchResultLocationTypedDict": ".anthropiccitationwebsearchresultlocation", + "AnthropicCitationSearchResultLocationParam": ".anthropiccitationsearchresultlocationparam", + "AnthropicCitationSearchResultLocationParamType": ".anthropiccitationsearchresultlocationparam", + "AnthropicCitationSearchResultLocationParamTypedDict": ".anthropiccitationsearchresultlocationparam", + "AnthropicCitationWebSearchResultLocationParam": ".anthropiccitationwebsearchresultlocationparam", + "AnthropicCitationWebSearchResultLocationParamType": ".anthropiccitationwebsearchresultlocationparam", + "AnthropicCitationWebSearchResultLocationParamTypedDict": ".anthropiccitationwebsearchresultlocationparam", "AnthropicCompactionUsageIteration": ".anthropiccompactionusageiteration", "AnthropicCompactionUsageIterationType": ".anthropiccompactionusageiteration", "AnthropicCompactionUsageIterationTypedDict": ".anthropiccompactionusageiteration", @@ -5156,6 +5198,9 @@ _dynamic_imports: dict[str, str] = { "ChatFormatGrammarConfig": ".chatformatgrammarconfig", "ChatFormatGrammarConfigType": ".chatformatgrammarconfig", "ChatFormatGrammarConfigTypedDict": ".chatformatgrammarconfig", + "ChatFormatJSONObjectConfig": ".chatformatjsonobjectconfig", + "ChatFormatJSONObjectConfigType": ".chatformatjsonobjectconfig", + "ChatFormatJSONObjectConfigTypedDict": ".chatformatjsonobjectconfig", "ChatFormatJSONSchemaConfig": ".chatformatjsonschemaconfig", "ChatFormatJSONSchemaConfigType": ".chatformatjsonschemaconfig", "ChatFormatJSONSchemaConfigTypedDict": ".chatformatjsonschemaconfig", @@ -5702,6 +5747,7 @@ _dynamic_imports: dict[str, str] = { "ImageGenTextChunkEventPhase": ".imagegentextchunkevent", "ImageGenTextChunkEventType": ".imagegentextchunkevent", "ImageGenTextChunkEventTypedDict": ".imagegentextchunkevent", + "ImageInputModality": ".imageinputmodality", "ImageModelArchitecture": ".imagemodelarchitecture", "ImageModelArchitectureTypedDict": ".imagemodelarchitecture", "ImageModelEndpointsResponse": ".imagemodelendpointsresponse", @@ -5799,6 +5845,8 @@ _dynamic_imports: dict[str, str] = { "LegacyChatContentVideo": ".legacy_chatcontentvideo", "LegacyChatContentVideoType": ".legacy_chatcontentvideo", "LegacyChatContentVideoTypedDict": ".legacy_chatcontentvideo", + "LegacyChatContentVideoInput": ".legacy_chatcontentvideoinput", + "LegacyChatContentVideoInputTypedDict": ".legacy_chatcontentvideoinput", "LegacyWebSearchServerTool": ".legacy_websearchservertool", "LegacyWebSearchServerToolType": ".legacy_websearchservertool", "LegacyWebSearchServerToolTypedDict": ".legacy_websearchservertool", @@ -6018,11 +6066,13 @@ _dynamic_imports: dict[str, str] = { "TypeTool": ".messagesrequest", "TypeWebSearch20250305": ".messagesrequest", "TypeWebSearch20260209": ".messagesrequest", + "MessagesSearchModelsServerTool": ".messagessearchmodelsservertool", + "MessagesSearchModelsServerToolType": ".messagessearchmodelsservertool", + "MessagesSearchModelsServerToolTypedDict": ".messagessearchmodelsservertool", "MetadataLevel": ".metadatalevel", "Model": ".model", "ModelTypedDict": ".model", "ModelArchitecture": ".modelarchitecture", - "ModelArchitectureInstructType": ".modelarchitecture", "ModelArchitectureTypedDict": ".modelarchitecture", "ModelBenchmarks": ".modelbenchmarks", "ModelBenchmarksTypedDict": ".modelbenchmarks", @@ -6038,6 +6088,8 @@ _dynamic_imports: dict[str, str] = { "ModelsCountResponseData": ".modelscountresponse", "ModelsCountResponseDataTypedDict": ".modelscountresponse", "ModelsCountResponseTypedDict": ".modelscountresponse", + "Links": ".modelslistresponse", + "LinksTypedDict": ".modelslistresponse", "ModelsListResponse": ".modelslistresponse", "ModelsListResponseTypedDict": ".modelslistresponse", "ModerationPlugin": ".moderationplugin", @@ -6070,17 +6122,19 @@ _dynamic_imports: dict[str, str] = { "ObservabilityDestination": ".observabilitydestination", "ObservabilityDestinationTypedDict": ".observabilitydestination", "UnknownObservabilityDestination": ".observabilitydestination", - "FieldT": ".observabilityfilterrulesconfig", - "Group": ".observabilityfilterrulesconfig", - "GroupTypedDict": ".observabilityfilterrulesconfig", - "Logic": ".observabilityfilterrulesconfig", + "FieldT": ".observabilityfilterrulegroup", + "Logic": ".observabilityfilterrulegroup", + "ObservabilityFilterRuleGroup": ".observabilityfilterrulegroup", + "ObservabilityFilterRuleGroupTypedDict": ".observabilityfilterrulegroup", + "ObservabilityFilterRuleGroupValue": ".observabilityfilterrulegroup", + "ObservabilityFilterRuleGroupValueTypedDict": ".observabilityfilterrulegroup", + "Operator": ".observabilityfilterrulegroup", + "Rule": ".observabilityfilterrulegroup", + "RuleTypedDict": ".observabilityfilterrulegroup", "ObservabilityFilterRulesConfig": ".observabilityfilterrulesconfig", "ObservabilityFilterRulesConfigTypedDict": ".observabilityfilterrulesconfig", - "ObservabilityFilterRulesConfigValue": ".observabilityfilterrulesconfig", - "ObservabilityFilterRulesConfigValueTypedDict": ".observabilityfilterrulesconfig", - "Operator": ".observabilityfilterrulesconfig", - "Rule": ".observabilityfilterrulesconfig", - "RuleTypedDict": ".observabilityfilterrulesconfig", + "ObservabilityFilterRulesConfigNullable": ".observabilityfilterrulesconfignullable", + "ObservabilityFilterRulesConfigNullableTypedDict": ".observabilityfilterrulesconfignullable", "ObservabilityGrafanaDestination": ".observabilitygrafanadestination", "ObservabilityGrafanaDestinationConfig": ".observabilitygrafanadestination", "ObservabilityGrafanaDestinationConfigTypedDict": ".observabilitygrafanadestination", @@ -6608,6 +6662,9 @@ _dynamic_imports: dict[str, str] = { "RouterParamsTypedDict": ".routerparams", "RoutingStrategy": ".routingstrategy", "SearchContextSizeEnum": ".searchcontextsizeenum", + "SearchModelsServerToolOpenRouter": ".searchmodelsservertool_openrouter", + "SearchModelsServerToolOpenRouterType": ".searchmodelsservertool_openrouter", + "SearchModelsServerToolOpenRouterTypedDict": ".searchmodelsservertool_openrouter", "SearchModelsServerToolConfig": ".searchmodelsservertoolconfig", "SearchModelsServerToolConfigTypedDict": ".searchmodelsservertoolconfig", "SearchQualityLevel": ".searchqualitylevel", diff --git a/src/openrouter/components/additionaltoolsitem.py b/src/openrouter/components/additionaltoolsitem.py index 1bd74f0..6f22028 100644 --- a/src/openrouter/components/additionaltoolsitem.py +++ b/src/openrouter/components/additionaltoolsitem.py @@ -11,10 +11,6 @@ from .applypatchservertool_openrouter import ( ApplyPatchServerToolOpenRouterTypedDict, ) from .bashservertool import BashServerTool, BashServerToolTypedDict -from .chatsearchmodelsservertool import ( - ChatSearchModelsServerTool, - ChatSearchModelsServerToolTypedDict, -) from .codeinterpreterservertool import ( CodeInterpreterServerTool, CodeInterpreterServerToolTypedDict, @@ -50,6 +46,10 @@ from .preview_websearchservertool import ( PreviewWebSearchServerTool, PreviewWebSearchServerToolTypedDict, ) +from .searchmodelsservertool_openrouter import ( + SearchModelsServerToolOpenRouter, + SearchModelsServerToolOpenRouterTypedDict, +) from .shellservertool import ShellServerTool, ShellServerToolTypedDict from .shellservertool_openrouter import ( ShellServerToolOpenRouter, @@ -182,7 +182,7 @@ AdditionalToolsItemToolUnionTypedDict = TypeAliasType( ApplyPatchServerToolOpenRouterTypedDict, WebSearchServerToolOpenRouterTypedDict, WebFetchServerToolTypedDict, - ChatSearchModelsServerToolTypedDict, + SearchModelsServerToolOpenRouterTypedDict, FilesServerToolTypedDict, AdvisorServerToolOpenRouterTypedDict, SubagentServerToolOpenRouterTypedDict, @@ -216,7 +216,7 @@ AdditionalToolsItemToolUnion = TypeAliasType( ApplyPatchServerToolOpenRouter, WebSearchServerToolOpenRouter, WebFetchServerTool, - ChatSearchModelsServerTool, + SearchModelsServerToolOpenRouter, FilesServerTool, AdvisorServerToolOpenRouter, SubagentServerToolOpenRouter, diff --git a/src/openrouter/components/anthropiccitationsearchresultlocation.py b/src/openrouter/components/anthropiccitationsearchresultlocationparam.py similarity index 73% rename from src/openrouter/components/anthropiccitationsearchresultlocation.py rename to src/openrouter/components/anthropiccitationsearchresultlocationparam.py index 8a90ed4..77b17e5 100644 --- a/src/openrouter/components/anthropiccitationsearchresultlocation.py +++ b/src/openrouter/components/anthropiccitationsearchresultlocationparam.py @@ -7,20 +7,20 @@ from typing import Literal from typing_extensions import TypedDict -AnthropicCitationSearchResultLocationType = Literal["search_result_location",] +AnthropicCitationSearchResultLocationParamType = Literal["search_result_location",] -class AnthropicCitationSearchResultLocationTypedDict(TypedDict): +class AnthropicCitationSearchResultLocationParamTypedDict(TypedDict): cited_text: str end_block_index: int search_result_index: int source: str start_block_index: int title: Nullable[str] - type: AnthropicCitationSearchResultLocationType + type: AnthropicCitationSearchResultLocationParamType -class AnthropicCitationSearchResultLocation(BaseModel): +class AnthropicCitationSearchResultLocationParam(BaseModel): cited_text: str end_block_index: int @@ -33,7 +33,7 @@ class AnthropicCitationSearchResultLocation(BaseModel): title: Nullable[str] - type: AnthropicCitationSearchResultLocationType + type: AnthropicCitationSearchResultLocationParamType @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/anthropiccitationwebsearchresultlocation.py b/src/openrouter/components/anthropiccitationwebsearchresultlocationparam.py similarity index 69% rename from src/openrouter/components/anthropiccitationwebsearchresultlocation.py rename to src/openrouter/components/anthropiccitationwebsearchresultlocationparam.py index 4d061c6..9be8376 100644 --- a/src/openrouter/components/anthropiccitationwebsearchresultlocation.py +++ b/src/openrouter/components/anthropiccitationwebsearchresultlocationparam.py @@ -7,25 +7,27 @@ from typing import Literal from typing_extensions import TypedDict -AnthropicCitationWebSearchResultLocationType = Literal["web_search_result_location",] +AnthropicCitationWebSearchResultLocationParamType = Literal[ + "web_search_result_location", +] -class AnthropicCitationWebSearchResultLocationTypedDict(TypedDict): +class AnthropicCitationWebSearchResultLocationParamTypedDict(TypedDict): cited_text: str encrypted_index: str title: Nullable[str] - type: AnthropicCitationWebSearchResultLocationType + type: AnthropicCitationWebSearchResultLocationParamType url: str -class AnthropicCitationWebSearchResultLocation(BaseModel): +class AnthropicCitationWebSearchResultLocationParam(BaseModel): cited_text: str encrypted_index: str title: Nullable[str] - type: AnthropicCitationWebSearchResultLocationType + type: AnthropicCitationWebSearchResultLocationParamType url: str diff --git a/src/openrouter/components/anthropictextblockparam.py b/src/openrouter/components/anthropictextblockparam.py index ed10fdc..a6a70aa 100644 --- a/src/openrouter/components/anthropictextblockparam.py +++ b/src/openrouter/components/anthropictextblockparam.py @@ -17,13 +17,13 @@ from .anthropiccitationpagelocationparam import ( AnthropicCitationPageLocationParam, AnthropicCitationPageLocationParamTypedDict, ) -from .anthropiccitationsearchresultlocation import ( - AnthropicCitationSearchResultLocation, - AnthropicCitationSearchResultLocationTypedDict, +from .anthropiccitationsearchresultlocationparam import ( + AnthropicCitationSearchResultLocationParam, + AnthropicCitationSearchResultLocationParamTypedDict, ) -from .anthropiccitationwebsearchresultlocation import ( - AnthropicCitationWebSearchResultLocation, - AnthropicCitationWebSearchResultLocationTypedDict, +from .anthropiccitationwebsearchresultlocationparam import ( + AnthropicCitationWebSearchResultLocationParam, + AnthropicCitationWebSearchResultLocationParamTypedDict, ) from openrouter.types import ( BaseModel, @@ -41,11 +41,11 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict CitationTypedDict = TypeAliasType( "CitationTypedDict", Union[ - AnthropicCitationWebSearchResultLocationTypedDict, + AnthropicCitationWebSearchResultLocationParamTypedDict, AnthropicCitationCharLocationParamTypedDict, AnthropicCitationPageLocationParamTypedDict, AnthropicCitationContentBlockLocationParamTypedDict, - AnthropicCitationSearchResultLocationTypedDict, + AnthropicCitationSearchResultLocationParamTypedDict, ], ) @@ -57,9 +57,12 @@ Citation = Annotated[ AnthropicCitationContentBlockLocationParam, Tag("content_block_location") ], Annotated[AnthropicCitationPageLocationParam, Tag("page_location")], - Annotated[AnthropicCitationSearchResultLocation, Tag("search_result_location")], Annotated[ - AnthropicCitationWebSearchResultLocation, Tag("web_search_result_location") + AnthropicCitationSearchResultLocationParam, Tag("search_result_location") + ], + Annotated[ + AnthropicCitationWebSearchResultLocationParam, + Tag("web_search_result_location"), ], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), diff --git a/src/openrouter/components/chatformatjsonobjectconfig.py b/src/openrouter/components/chatformatjsonobjectconfig.py new file mode 100644 index 0000000..450c8f6 --- /dev/null +++ b/src/openrouter/components/chatformatjsonobjectconfig.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +ChatFormatJSONObjectConfigType = Literal["json_object",] + + +class ChatFormatJSONObjectConfigTypedDict(TypedDict): + r"""JSON object response format""" + + type: ChatFormatJSONObjectConfigType + + +class ChatFormatJSONObjectConfig(BaseModel): + r"""JSON object response format""" + + type: ChatFormatJSONObjectConfigType diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index fe89789..9140127 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -11,6 +11,10 @@ from .chatformatgrammarconfig import ( ChatFormatGrammarConfig, ChatFormatGrammarConfigTypedDict, ) +from .chatformatjsonobjectconfig import ( + ChatFormatJSONObjectConfig, + ChatFormatJSONObjectConfigTypedDict, +) from .chatformatjsonschemaconfig import ( ChatFormatJSONSchemaConfig, ChatFormatJSONSchemaConfigTypedDict, @@ -30,10 +34,6 @@ from .contextcompressionplugin import ( ContextCompressionPluginTypedDict, ) from .fileparserplugin import FileParserPlugin, FileParserPluginTypedDict -from .formatjsonobjectconfig import ( - FormatJSONObjectConfig, - FormatJSONObjectConfigTypedDict, -) from .fusionplugin import FusionPlugin, FusionPluginTypedDict from .imageconfig import ImageConfig, ImageConfigTypedDict from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict @@ -179,7 +179,7 @@ ResponseFormatTypedDict = TypeAliasType( "ResponseFormatTypedDict", Union[ ChatFormatTextConfigTypedDict, - FormatJSONObjectConfigTypedDict, + ChatFormatJSONObjectConfigTypedDict, ChatFormatPythonConfigTypedDict, ChatFormatJSONSchemaConfigTypedDict, ChatFormatGrammarConfigTypedDict, @@ -191,7 +191,7 @@ r"""Response format configuration""" ResponseFormat = Annotated[ Union[ Annotated[ChatFormatGrammarConfig, Tag("grammar")], - Annotated[FormatJSONObjectConfig, Tag("json_object")], + Annotated[ChatFormatJSONObjectConfig, Tag("json_object")], Annotated[ChatFormatJSONSchemaConfig, Tag("json_schema")], Annotated[ChatFormatPythonConfig, Tag("python")], Annotated[ChatFormatTextConfig, Tag("text")], diff --git a/src/openrouter/components/createobservabilitydestinationrequest.py b/src/openrouter/components/createobservabilitydestinationrequest.py index b7bf975..6cd46b4 100644 --- a/src/openrouter/components/createobservabilitydestinationrequest.py +++ b/src/openrouter/components/createobservabilitydestinationrequest.py @@ -1,9 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .observabilityfilterrulesconfig import ( - ObservabilityFilterRulesConfig, - ObservabilityFilterRulesConfigTypedDict, +from .observabilityfilterrulesconfignullable import ( + ObservabilityFilterRulesConfigNullable, + ObservabilityFilterRulesConfigNullableTypedDict, ) from openrouter.types import ( BaseModel, @@ -54,7 +54,7 @@ class CreateObservabilityDestinationRequestTypedDict(TypedDict): r"""Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided.""" enabled: NotRequired[bool] r"""Whether this destination should be enabled immediately.""" - filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigTypedDict]] + filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigNullableTypedDict]] r"""Optional structured filter rules controlling which events are forwarded.""" privacy_mode: NotRequired[bool] r"""When true, request/response bodies are not forwarded — only metadata.""" @@ -80,7 +80,7 @@ class CreateObservabilityDestinationRequest(BaseModel): enabled: Optional[bool] = True r"""Whether this destination should be enabled immediately.""" - filter_rules: OptionalNullable[ObservabilityFilterRulesConfig] = UNSET + filter_rules: OptionalNullable[ObservabilityFilterRulesConfigNullable] = UNSET r"""Optional structured filter rules controlling which events are forwarded.""" privacy_mode: Optional[bool] = False diff --git a/src/openrouter/components/imageinputmodality.py b/src/openrouter/components/imageinputmodality.py new file mode 100644 index 0000000..bfe11c6 --- /dev/null +++ b/src/openrouter/components/imageinputmodality.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import UnrecognizedStr +from typing import Literal, Union + + +ImageInputModality = Union[ + Literal[ + "text", + "image", + "file", + "audio", + "video", + ], + UnrecognizedStr, +] diff --git a/src/openrouter/components/imagemodelarchitecture.py b/src/openrouter/components/imagemodelarchitecture.py index 01f0cb5..0a870e4 100644 --- a/src/openrouter/components/imagemodelarchitecture.py +++ b/src/openrouter/components/imagemodelarchitecture.py @@ -1,22 +1,22 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .imageinputmodality import ImageInputModality from .imageoutputmodality import ImageOutputModality -from .inputmodality import InputModality from openrouter.types import BaseModel from typing import List from typing_extensions import TypedDict class ImageModelArchitectureTypedDict(TypedDict): - input_modalities: List[InputModality] + input_modalities: List[ImageInputModality] r"""Supported input modalities""" output_modalities: List[ImageOutputModality] r"""Supported output modalities""" class ImageModelArchitecture(BaseModel): - input_modalities: List[InputModality] + input_modalities: List[ImageInputModality] r"""Supported input modalities""" output_modalities: List[ImageOutputModality] diff --git a/src/openrouter/components/legacy_chatcontentvideo.py b/src/openrouter/components/legacy_chatcontentvideo.py index b5dd4d1..38a7bf7 100644 --- a/src/openrouter/components/legacy_chatcontentvideo.py +++ b/src/openrouter/components/legacy_chatcontentvideo.py @@ -1,7 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .chatcontentvideoinput import ChatContentVideoInput, ChatContentVideoInputTypedDict +from .legacy_chatcontentvideoinput import ( + LegacyChatContentVideoInput, + LegacyChatContentVideoInputTypedDict, +) from openrouter.types import BaseModel from typing import Literal from typing_extensions import TypedDict, deprecated @@ -17,7 +20,7 @@ class LegacyChatContentVideoTypedDict(TypedDict): r"""Video input content part (legacy format - deprecated)""" type: LegacyChatContentVideoType - video_url: ChatContentVideoInputTypedDict + video_url: LegacyChatContentVideoInputTypedDict r"""Video input object""" @@ -29,5 +32,5 @@ class LegacyChatContentVideo(BaseModel): type: LegacyChatContentVideoType - video_url: ChatContentVideoInput + video_url: LegacyChatContentVideoInput r"""Video input object""" diff --git a/src/openrouter/components/legacy_chatcontentvideoinput.py b/src/openrouter/components/legacy_chatcontentvideoinput.py new file mode 100644 index 0000000..0fe43c1 --- /dev/null +++ b/src/openrouter/components/legacy_chatcontentvideoinput.py @@ -0,0 +1,19 @@ +"""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 LegacyChatContentVideoInputTypedDict(TypedDict): + r"""Video input object""" + + url: str + r"""URL of the video (data: URLs supported)""" + + +class LegacyChatContentVideoInput(BaseModel): + r"""Video input object""" + + url: str + r"""URL of the video (data: URLs supported)""" diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index e69fe1f..d2e3039 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -35,10 +35,6 @@ from .anthropicwebsearchtooluserlocation import ( ) from .autorouterplugin import AutoRouterPlugin, AutoRouterPluginTypedDict from .bashservertool import BashServerTool, BashServerToolTypedDict -from .chatsearchmodelsservertool import ( - ChatSearchModelsServerTool, - ChatSearchModelsServerToolTypedDict, -) from .contextcompressionplugin import ( ContextCompressionPlugin, ContextCompressionPluginTypedDict, @@ -53,6 +49,10 @@ from .imagegenerationservertool_openrouter import ( from .messagesfallbackparam import MessagesFallbackParam, MessagesFallbackParamTypedDict from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict +from .messagessearchmodelsservertool import ( + MessagesSearchModelsServerTool, + MessagesSearchModelsServerToolTypedDict, +) from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict from .openrouterwebsearchservertool import ( OpenRouterWebSearchServerTool, @@ -1070,7 +1070,7 @@ class ToolCustom(BaseModel): MessagesRequestToolUnionTypedDict = TypeAliasType( "MessagesRequestToolUnionTypedDict", Union[ - ChatSearchModelsServerToolTypedDict, + MessagesSearchModelsServerToolTypedDict, BashServerToolTypedDict, DatetimeServerToolTypedDict, ImageGenerationServerToolOpenRouterTypedDict, @@ -1090,7 +1090,7 @@ MessagesRequestToolUnionTypedDict = TypeAliasType( MessagesRequestToolUnion = TypeAliasType( "MessagesRequestToolUnion", Union[ - ChatSearchModelsServerTool, + MessagesSearchModelsServerTool, BashServerTool, DatetimeServerTool, ImageGenerationServerToolOpenRouter, diff --git a/src/openrouter/components/messagessearchmodelsservertool.py b/src/openrouter/components/messagessearchmodelsservertool.py new file mode 100644 index 0000000..d101995 --- /dev/null +++ b/src/openrouter/components/messagessearchmodelsservertool.py @@ -0,0 +1,47 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .searchmodelsservertoolconfig import ( + SearchModelsServerToolConfig, + SearchModelsServerToolConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +MessagesSearchModelsServerToolType = Literal["openrouter:experimental__search_models",] + + +class MessagesSearchModelsServerToolTypedDict(TypedDict): + r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter""" + + type: MessagesSearchModelsServerToolType + parameters: NotRequired[SearchModelsServerToolConfigTypedDict] + r"""Configuration for the openrouter:experimental__search_models server tool""" + + +class MessagesSearchModelsServerTool(BaseModel): + r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter""" + + type: MessagesSearchModelsServerToolType + + parameters: Optional[SearchModelsServerToolConfig] = None + r"""Configuration for the openrouter:experimental__search_models server tool""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["parameters"]) + 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/modelarchitecture.py b/src/openrouter/components/modelarchitecture.py index 1fb1dbc..b1fb080 100644 --- a/src/openrouter/components/modelarchitecture.py +++ b/src/openrouter/components/modelarchitecture.py @@ -2,6 +2,7 @@ from __future__ import annotations from .inputmodality import InputModality +from .instructtype import InstructType from .modelgroup import ModelGroup from .outputmodality import OutputModality from openrouter.types import ( @@ -10,43 +11,12 @@ from openrouter.types import ( OptionalNullable, UNSET, UNSET_SENTINEL, - UnrecognizedStr, ) from pydantic import model_serializer -from typing import List, Literal, Optional, Union +from typing import List, Optional from typing_extensions import NotRequired, TypedDict -ModelArchitectureInstructType = Union[ - Literal[ - "none", - "airoboros", - "alpaca", - "alpaca-modif", - "chatml", - "claude", - "code-llama", - "gemma", - "llama2", - "llama3", - "mistral", - "nemotron", - "neural", - "openchat", - "phi3", - "rwkv", - "vicuna", - "zephyr", - "deepseek-r1", - "deepseek-v3.1", - "qwq", - "qwen3", - ], - UnrecognizedStr, -] -r"""Instruction format type""" - - class ModelArchitectureTypedDict(TypedDict): r"""Model architecture information""" @@ -56,7 +26,7 @@ class ModelArchitectureTypedDict(TypedDict): r"""Primary modality of the model""" output_modalities: List[OutputModality] r"""Supported output modalities""" - instruct_type: NotRequired[Nullable[ModelArchitectureInstructType]] + instruct_type: NotRequired[Nullable[InstructType]] r"""Instruction format type""" tokenizer: NotRequired[ModelGroup] r"""Tokenizer type used by the model""" @@ -74,7 +44,7 @@ class ModelArchitecture(BaseModel): output_modalities: List[OutputModality] r"""Supported output modalities""" - instruct_type: OptionalNullable[ModelArchitectureInstructType] = UNSET + instruct_type: OptionalNullable[InstructType] = UNSET r"""Instruction format type""" tokenizer: Optional[ModelGroup] = None diff --git a/src/openrouter/components/modelslistresponse.py b/src/openrouter/components/modelslistresponse.py index 8497c58..a1cd85a 100644 --- a/src/openrouter/components/modelslistresponse.py +++ b/src/openrouter/components/modelslistresponse.py @@ -2,16 +2,49 @@ from __future__ import annotations from .model import Model, ModelTypedDict -from openrouter.types import BaseModel +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer from typing import List from typing_extensions import TypedDict +class LinksTypedDict(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): + r"""Pagination links""" + + 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 ModelsListResponseTypedDict(TypedDict): r"""List of available models""" data: List[ModelTypedDict] r"""List of available models""" + links: LinksTypedDict + r"""Pagination links""" + total_count: int + r"""Total number of models matching the query""" class ModelsListResponse(BaseModel): @@ -19,3 +52,9 @@ class ModelsListResponse(BaseModel): data: List[Model] r"""List of available models""" + + links: Links + r"""Pagination links""" + + total_count: int + r"""Total number of models matching the query""" diff --git a/src/openrouter/components/observabilityfilterrulegroup.py b/src/openrouter/components/observabilityfilterrulegroup.py new file mode 100644 index 0000000..576d6a3 --- /dev/null +++ b/src/openrouter/components/observabilityfilterrulegroup.py @@ -0,0 +1,122 @@ +"""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 List, Literal, Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +Logic = Union[ + Literal[ + "and", + "or", + ], + UnrecognizedStr, +] + + +FieldT = Union[ + Literal[ + "model", + "provider", + "session_id", + "user_id", + "api_key_name", + "finish_reason", + "input", + "output", + "total_cost", + "total_tokens", + "prompt_tokens", + "completion_tokens", + ], + UnrecognizedStr, +] + + +Operator = Union[ + Literal[ + "equals", + "not_equals", + "contains", + "not_contains", + "regex", + "starts_with", + "ends_with", + "gt", + "lt", + "gte", + "lte", + "exists", + "not_exists", + ], + UnrecognizedStr, +] + + +ObservabilityFilterRuleGroupValueTypedDict = TypeAliasType( + "ObservabilityFilterRuleGroupValueTypedDict", Union[str, float] +) + + +ObservabilityFilterRuleGroupValue = TypeAliasType( + "ObservabilityFilterRuleGroupValue", Union[str, float] +) + + +class RuleTypedDict(TypedDict): + field: FieldT + operator: Operator + value: NotRequired[ObservabilityFilterRuleGroupValueTypedDict] + + +class Rule(BaseModel): + field: FieldT + + operator: Operator + + value: Optional[ObservabilityFilterRuleGroupValue] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["value"]) + 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 ObservabilityFilterRuleGroupTypedDict(TypedDict): + rules: List[RuleTypedDict] + logic: NotRequired[Logic] + + +class ObservabilityFilterRuleGroup(BaseModel): + rules: List[Rule] + + logic: Optional[Logic] = "and" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["logic"]) + 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/observabilityfilterrulesconfig.py b/src/openrouter/components/observabilityfilterrulesconfig.py index 76f042e..6f5536a 100644 --- a/src/openrouter/components/observabilityfilterrulesconfig.py +++ b/src/openrouter/components/observabilityfilterrulesconfig.py @@ -1,138 +1,27 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from .observabilityfilterrulegroup import ( + ObservabilityFilterRuleGroup, + ObservabilityFilterRuleGroupTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer -from typing import List, Literal, Optional, Union -from typing_extensions import NotRequired, TypeAliasType, TypedDict - - -Logic = Union[ - Literal[ - "and", - "or", - ], - UnrecognizedStr, -] - - -FieldT = Union[ - Literal[ - "model", - "provider", - "session_id", - "user_id", - "api_key_name", - "finish_reason", - "input", - "output", - "total_cost", - "total_tokens", - "prompt_tokens", - "completion_tokens", - ], - UnrecognizedStr, -] - - -Operator = Union[ - Literal[ - "equals", - "not_equals", - "contains", - "not_contains", - "regex", - "starts_with", - "ends_with", - "gt", - "lt", - "gte", - "lte", - "exists", - "not_exists", - ], - UnrecognizedStr, -] - - -ObservabilityFilterRulesConfigValueTypedDict = TypeAliasType( - "ObservabilityFilterRulesConfigValueTypedDict", Union[str, float] -) - - -ObservabilityFilterRulesConfigValue = TypeAliasType( - "ObservabilityFilterRulesConfigValue", Union[str, float] -) - - -class RuleTypedDict(TypedDict): - field: FieldT - operator: Operator - value: NotRequired[ObservabilityFilterRulesConfigValueTypedDict] - - -class Rule(BaseModel): - field: FieldT - - operator: Operator - - value: Optional[ObservabilityFilterRulesConfigValue] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["value"]) - 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 GroupTypedDict(TypedDict): - rules: List[RuleTypedDict] - logic: NotRequired[Logic] - - -class Group(BaseModel): - rules: List[Rule] - - logic: Optional[Logic] = "and" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["logic"]) - 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 +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict class ObservabilityFilterRulesConfigTypedDict(TypedDict): r"""Optional structured filter rules controlling which events are forwarded.""" - groups: List[GroupTypedDict] + groups: List[ObservabilityFilterRuleGroupTypedDict] enabled: NotRequired[bool] class ObservabilityFilterRulesConfig(BaseModel): r"""Optional structured filter rules controlling which events are forwarded.""" - groups: List[Group] + groups: List[ObservabilityFilterRuleGroup] enabled: Optional[bool] = True diff --git a/src/openrouter/components/observabilityfilterrulesconfignullable.py b/src/openrouter/components/observabilityfilterrulesconfignullable.py new file mode 100644 index 0000000..80ac61f --- /dev/null +++ b/src/openrouter/components/observabilityfilterrulesconfignullable.py @@ -0,0 +1,42 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .observabilityfilterrulegroup import ( + ObservabilityFilterRuleGroup, + ObservabilityFilterRuleGroupTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class ObservabilityFilterRulesConfigNullableTypedDict(TypedDict): + r"""Optional structured filter rules controlling which events are forwarded.""" + + groups: List[ObservabilityFilterRuleGroupTypedDict] + enabled: NotRequired[bool] + + +class ObservabilityFilterRulesConfigNullable(BaseModel): + r"""Optional structured filter rules controlling which events are forwarded.""" + + groups: List[ObservabilityFilterRuleGroup] + + enabled: Optional[bool] = True + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["enabled"]) + 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/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 7331187..6f97e56 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -17,10 +17,6 @@ from .applypatchservertool_openrouter import ( from .autorouterplugin import AutoRouterPlugin, AutoRouterPluginTypedDict from .bashservertool import BashServerTool, BashServerToolTypedDict from .chatdebugoptions import ChatDebugOptions, ChatDebugOptionsTypedDict -from .chatsearchmodelsservertool import ( - ChatSearchModelsServerTool, - ChatSearchModelsServerToolTypedDict, -) from .codeinterpreterservertool import ( CodeInterpreterServerTool, CodeInterpreterServerToolTypedDict, @@ -77,6 +73,10 @@ from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDi from .reasoningconfig import ReasoningConfig, ReasoningConfigTypedDict from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict from .responseincludesenum import ResponseIncludesEnum +from .searchmodelsservertool_openrouter import ( + SearchModelsServerToolOpenRouter, + SearchModelsServerToolOpenRouterTypedDict, +) from .shellservertool import ShellServerTool, ShellServerToolTypedDict from .shellservertool_openrouter import ( ShellServerToolOpenRouter, @@ -227,7 +227,7 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType( ApplyPatchServerToolOpenRouterTypedDict, WebSearchServerToolOpenRouterTypedDict, WebFetchServerToolTypedDict, - ChatSearchModelsServerToolTypedDict, + SearchModelsServerToolOpenRouterTypedDict, FilesServerToolTypedDict, DatetimeServerToolTypedDict, AdvisorServerToolOpenRouterTypedDict, @@ -273,7 +273,8 @@ ResponsesRequestToolUnion = Annotated[ ImageGenerationServerToolOpenRouter, Tag("openrouter:image_generation") ], Annotated[ - ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models") + SearchModelsServerToolOpenRouter, + Tag("openrouter:experimental__search_models"), ], Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")], Annotated[WebSearchServerToolOpenRouter, Tag("openrouter:web_search")], diff --git a/src/openrouter/components/searchmodelsservertool_openrouter.py b/src/openrouter/components/searchmodelsservertool_openrouter.py new file mode 100644 index 0000000..158d0a1 --- /dev/null +++ b/src/openrouter/components/searchmodelsservertool_openrouter.py @@ -0,0 +1,49 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .searchmodelsservertoolconfig import ( + SearchModelsServerToolConfig, + SearchModelsServerToolConfigTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Literal, Optional +from typing_extensions import NotRequired, TypedDict + + +SearchModelsServerToolOpenRouterType = Literal[ + "openrouter:experimental__search_models", +] + + +class SearchModelsServerToolOpenRouterTypedDict(TypedDict): + r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter""" + + type: SearchModelsServerToolOpenRouterType + parameters: NotRequired[SearchModelsServerToolConfigTypedDict] + r"""Configuration for the openrouter:experimental__search_models server tool""" + + +class SearchModelsServerToolOpenRouter(BaseModel): + r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter""" + + type: SearchModelsServerToolOpenRouterType + + parameters: Optional[SearchModelsServerToolConfig] = None + r"""Configuration for the openrouter:experimental__search_models server tool""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["parameters"]) + 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/updateobservabilitydestinationrequest.py b/src/openrouter/components/updateobservabilitydestinationrequest.py index a344284..e0d3f99 100644 --- a/src/openrouter/components/updateobservabilitydestinationrequest.py +++ b/src/openrouter/components/updateobservabilitydestinationrequest.py @@ -1,9 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .observabilityfilterrulesconfig import ( - ObservabilityFilterRulesConfig, - ObservabilityFilterRulesConfigTypedDict, +from .observabilityfilterrulesconfignullable import ( + ObservabilityFilterRulesConfigNullable, + ObservabilityFilterRulesConfigNullableTypedDict, ) from openrouter.types import ( BaseModel, @@ -24,7 +24,7 @@ class UpdateObservabilityDestinationRequestTypedDict(TypedDict): r"""Provider-specific configuration fields to update. Masked values are ignored; unset fields keep their current value.""" enabled: NotRequired[bool] r"""Whether the destination is enabled.""" - filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigTypedDict]] + filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigNullableTypedDict]] name: NotRequired[str] r"""Human-readable name for the destination.""" privacy_mode: NotRequired[bool] @@ -43,7 +43,7 @@ class UpdateObservabilityDestinationRequest(BaseModel): enabled: Optional[bool] = None r"""Whether the destination is enabled.""" - filter_rules: OptionalNullable[ObservabilityFilterRulesConfig] = UNSET + filter_rules: OptionalNullable[ObservabilityFilterRulesConfigNullable] = UNSET name: Optional[str] = None r"""Human-readable name for the destination.""" diff --git a/src/openrouter/embeddings.py b/src/openrouter/embeddings.py index 9f0b5ce..906426a 100644 --- a/src/openrouter/embeddings.py +++ b/src/openrouter/embeddings.py @@ -2,12 +2,13 @@ from .basesdk import BaseSDK from enum import Enum +from jsonpath import JSONPath 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 +from typing import Any, Awaitable, Dict, List, Mapping, Optional, Union class GenerateAcceptEnum(str, Enum): @@ -432,11 +433,13 @@ class Embeddings(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 500, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsListResponse: + ) -> Optional[operations.ListEmbeddingsModelsResponse]: r"""List all embeddings models Returns a list of all available embeddings models and their properties @@ -448,6 +451,8 @@ class Embeddings(BaseSDK): :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 1000). When both offset and limit are omitted, the full list is returned :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 @@ -467,6 +472,8 @@ class Embeddings(BaseSDK): http_referer=http_referer, x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, ) req = self._build_request( @@ -520,9 +527,39 @@ class Embeddings(BaseSDK): retry_config=retry_config, ) + def next_func() -> Optional[operations.ListEmbeddingsModelsResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list_models( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.ModelsListResponse, http_res) + return operations.ListEmbeddingsModelsResponse( + result=unmarshal_json_response(components.ModelsListResponse, http_res), + next=next_func, + ) if utils.match_response(http_res, "400", "application/json"): response_data = unmarshal_json_response( errors.BadRequestResponseErrorData, http_res @@ -552,11 +589,13 @@ class Embeddings(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 500, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsListResponse: + ) -> Optional[operations.ListEmbeddingsModelsResponse]: r"""List all embeddings models Returns a list of all available embeddings models and their properties @@ -568,6 +607,8 @@ class Embeddings(BaseSDK): :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 1000). When both offset and limit are omitted, the full list is returned :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 @@ -587,6 +628,8 @@ class Embeddings(BaseSDK): http_referer=http_referer, x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, ) req = self._build_request_async( @@ -640,9 +683,42 @@ class Embeddings(BaseSDK): retry_config=retry_config, ) + def next_func() -> Awaitable[Optional[operations.ListEmbeddingsModelsResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_models_async( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.ModelsListResponse, http_res) + return operations.ListEmbeddingsModelsResponse( + result=unmarshal_json_response(components.ModelsListResponse, http_res), + next=next_func, + ) if utils.match_response(http_res, "400", "application/json"): response_data = unmarshal_json_response( errors.BadRequestResponseErrorData, http_res diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index 4add1c7..0e06ce7 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -19,8 +19,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -126,7 +126,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -181,8 +181,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -291,7 +291,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) @@ -1703,8 +1703,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1809,7 +1809,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -1870,8 +1870,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1981,7 +1981,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) @@ -2626,8 +2626,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2732,7 +2732,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -2793,8 +2793,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2904,7 +2904,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) @@ -3552,8 +3552,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -3656,7 +3656,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -3710,8 +3710,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -3817,7 +3817,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) @@ -3871,8 +3871,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -3975,7 +3975,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -4029,8 +4029,8 @@ class Guardrails(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -4138,7 +4138,7 @@ class Guardrails(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) diff --git a/src/openrouter/models_.py b/src/openrouter/models_.py index 0379827..1a85e99 100644 --- a/src/openrouter/models_.py +++ b/src/openrouter/models_.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK +from jsonpath import JSONPath 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 +from typing import Any, Awaitable, Dict, List, Mapping, Optional, Union class Models(BaseSDK): @@ -270,6 +271,8 @@ class Models(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 500, category: Optional[operations.GetModelsCategory] = None, supported_parameters: Optional[str] = None, output_modalities: Optional[str] = None, @@ -301,7 +304,7 @@ class Models(BaseSDK): server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsListResponse: + ) -> Optional[operations.GetModelsResponse]: r"""List all models and their properties :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -311,6 +314,8 @@ class Models(BaseSDK): :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 1000). When both offset and limit are omitted, the full list is returned :param category: Filter models by use case category :param supported_parameters: Filter models by supported parameter (comma-separated) :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". @@ -357,6 +362,8 @@ class Models(BaseSDK): http_referer=http_referer, x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, category=category, supported_parameters=supported_parameters, output_modalities=output_modalities, @@ -437,9 +444,66 @@ class Models(BaseSDK): retry_config=retry_config, ) + def next_func() -> Optional[operations.GetModelsResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + category=category, + supported_parameters=supported_parameters, + output_modalities=output_modalities, + sort=sort, + q=q, + input_modalities=input_modalities, + context=context, + min_price=min_price, + max_price=max_price, + arch=arch, + model_authors=model_authors, + providers=providers, + distillable=distillable, + zdr=zdr, + region=region, + min_output_price=min_output_price, + max_output_price=max_output_price, + min_age_days=min_age_days, + max_age_days=max_age_days, + min_intelligence_index=min_intelligence_index, + max_intelligence_index=max_intelligence_index, + min_coding_index=min_coding_index, + max_coding_index=max_coding_index, + min_agentic_index=min_agentic_index, + max_agentic_index=max_agentic_index, + min_tool_success_rate=min_tool_success_rate, + max_tool_success_rate=max_tool_success_rate, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.ModelsListResponse, http_res) + return operations.GetModelsResponse( + result=unmarshal_json_response(components.ModelsListResponse, http_res), + next=next_func, + ) if utils.match_response(http_res, "400", "application/json"): response_data = unmarshal_json_response( errors.BadRequestResponseErrorData, http_res @@ -469,6 +533,8 @@ class Models(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 500, category: Optional[operations.GetModelsCategory] = None, supported_parameters: Optional[str] = None, output_modalities: Optional[str] = None, @@ -500,7 +566,7 @@ class Models(BaseSDK): server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsListResponse: + ) -> Optional[operations.GetModelsResponse]: r"""List all models and their properties :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. @@ -510,6 +576,8 @@ class Models(BaseSDK): :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 1000). When both offset and limit are omitted, the full list is returned :param category: Filter models by use case category :param supported_parameters: Filter models by supported parameter (comma-separated) :param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\". @@ -556,6 +624,8 @@ class Models(BaseSDK): http_referer=http_referer, x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, category=category, supported_parameters=supported_parameters, output_modalities=output_modalities, @@ -636,9 +706,69 @@ class Models(BaseSDK): retry_config=retry_config, ) + def next_func() -> Awaitable[Optional[operations.GetModelsResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_async( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + category=category, + supported_parameters=supported_parameters, + output_modalities=output_modalities, + sort=sort, + q=q, + input_modalities=input_modalities, + context=context, + min_price=min_price, + max_price=max_price, + arch=arch, + model_authors=model_authors, + providers=providers, + distillable=distillable, + zdr=zdr, + region=region, + min_output_price=min_output_price, + max_output_price=max_output_price, + min_age_days=min_age_days, + max_age_days=max_age_days, + min_intelligence_index=min_intelligence_index, + max_intelligence_index=max_intelligence_index, + min_coding_index=min_coding_index, + max_coding_index=max_coding_index, + min_agentic_index=min_agentic_index, + max_agentic_index=max_agentic_index, + min_tool_success_rate=min_tool_success_rate, + max_tool_success_rate=max_tool_success_rate, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.ModelsListResponse, http_res) + return operations.GetModelsResponse( + result=unmarshal_json_response(components.ModelsListResponse, http_res), + next=next_func, + ) if utils.match_response(http_res, "400", "application/json"): response_data = unmarshal_json_response( errors.BadRequestResponseErrorData, http_res @@ -914,11 +1044,13 @@ class Models(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 500, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsListResponse: + ) -> Optional[operations.ListModelsUserResponse]: r"""List models filtered by user provider preferences, privacy settings, and guardrails List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing). @@ -931,6 +1063,8 @@ class Models(BaseSDK): :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 1000). When both offset and limit are omitted, the full list is returned :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 @@ -950,6 +1084,8 @@ class Models(BaseSDK): http_referer=http_referer, x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, ) req = self._build_request( @@ -1003,9 +1139,40 @@ class Models(BaseSDK): retry_config=retry_config, ) + def next_func() -> Optional[operations.ListModelsUserResponse]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return None + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return None + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return None + next_offset = offset + len(results[0]) + + return self.list_for_user( + security=security, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.ModelsListResponse, http_res) + return operations.ListModelsUserResponse( + result=unmarshal_json_response(components.ModelsListResponse, http_res), + next=next_func, + ) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res @@ -1044,11 +1211,13 @@ class Models(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 500, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> components.ModelsListResponse: + ) -> Optional[operations.ListModelsUserResponse]: r"""List models filtered by user provider preferences, privacy settings, and guardrails List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing). @@ -1061,6 +1230,8 @@ class Models(BaseSDK): :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 1000). When both offset and limit are omitted, the full list is returned :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 @@ -1080,6 +1251,8 @@ class Models(BaseSDK): http_referer=http_referer, x_open_router_title=x_open_router_title, x_open_router_categories=x_open_router_categories, + offset=offset, + limit=limit, ) req = self._build_request_async( @@ -1133,9 +1306,43 @@ class Models(BaseSDK): retry_config=retry_config, ) + def next_func() -> Awaitable[Optional[operations.ListModelsUserResponse]]: + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) + + async def empty_result(): + return None + + offset = request.offset if isinstance(request.offset, int) else 0 + + if not http_res.text: + return empty_result() + results = JSONPath("$.data").parse(body) + if len(results) == 0 or len(results[0]) == 0: + return empty_result() + limit_ = request.limit if isinstance(request.limit, int) else 500 + if len(results[0]) < limit_: + return empty_result() + next_offset = offset + len(results[0]) + + return self.list_for_user_async( + security=security, + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + offset=next_offset, + limit=limit, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ) + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(components.ModelsListResponse, http_res) + return operations.ListModelsUserResponse( + result=unmarshal_json_response(components.ModelsListResponse, http_res), + next=next_func, + ) if utils.match_response(http_res, "401", "application/json"): response_data = unmarshal_json_response( errors.UnauthorizedResponseErrorData, http_res diff --git a/src/openrouter/observability.py b/src/openrouter/observability.py index a1dea9b..67318c7 100644 --- a/src/openrouter/observability.py +++ b/src/openrouter/observability.py @@ -19,8 +19,8 @@ class Observability(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -126,7 +126,7 @@ class Observability(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -181,8 +181,8 @@ class Observability(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, workspace_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -293,7 +293,7 @@ class Observability(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) @@ -355,8 +355,8 @@ class Observability(BaseSDK): enabled: Optional[bool] = True, filter_rules: OptionalNullable[ Union[ - components.ObservabilityFilterRulesConfig, - components.ObservabilityFilterRulesConfigTypedDict, + components.ObservabilityFilterRulesConfigNullable, + components.ObservabilityFilterRulesConfigNullableTypedDict, ] ] = UNSET, privacy_mode: Optional[bool] = False, @@ -414,7 +414,7 @@ class Observability(BaseSDK): enabled=enabled, filter_rules=utils.get_pydantic_model( filter_rules, - OptionalNullable[components.ObservabilityFilterRulesConfig], + OptionalNullable[components.ObservabilityFilterRulesConfigNullable], ), name=name, privacy_mode=privacy_mode, @@ -538,8 +538,8 @@ class Observability(BaseSDK): enabled: Optional[bool] = True, filter_rules: OptionalNullable[ Union[ - components.ObservabilityFilterRulesConfig, - components.ObservabilityFilterRulesConfigTypedDict, + components.ObservabilityFilterRulesConfigNullable, + components.ObservabilityFilterRulesConfigNullableTypedDict, ] ] = UNSET, privacy_mode: Optional[bool] = False, @@ -597,7 +597,7 @@ class Observability(BaseSDK): enabled=enabled, filter_rules=utils.get_pydantic_model( filter_rules, - OptionalNullable[components.ObservabilityFilterRulesConfig], + OptionalNullable[components.ObservabilityFilterRulesConfigNullable], ), name=name, privacy_mode=privacy_mode, @@ -1240,8 +1240,8 @@ class Observability(BaseSDK): enabled: Optional[bool] = None, filter_rules: OptionalNullable[ Union[ - components.ObservabilityFilterRulesConfig, - components.ObservabilityFilterRulesConfigTypedDict, + components.ObservabilityFilterRulesConfigNullable, + components.ObservabilityFilterRulesConfigNullableTypedDict, ] ] = UNSET, name: Optional[str] = None, @@ -1299,7 +1299,7 @@ class Observability(BaseSDK): enabled=enabled, filter_rules=utils.get_pydantic_model( filter_rules, - OptionalNullable[components.ObservabilityFilterRulesConfig], + OptionalNullable[components.ObservabilityFilterRulesConfigNullable], ), name=name, privacy_mode=privacy_mode, @@ -1420,8 +1420,8 @@ class Observability(BaseSDK): enabled: Optional[bool] = None, filter_rules: OptionalNullable[ Union[ - components.ObservabilityFilterRulesConfig, - components.ObservabilityFilterRulesConfigTypedDict, + components.ObservabilityFilterRulesConfigNullable, + components.ObservabilityFilterRulesConfigNullableTypedDict, ] ] = UNSET, name: Optional[str] = None, @@ -1479,7 +1479,7 @@ class Observability(BaseSDK): enabled=enabled, filter_rules=utils.get_pydantic_model( filter_rules, - OptionalNullable[components.ObservabilityFilterRulesConfig], + OptionalNullable[components.ObservabilityFilterRulesConfigNullable], ), name=name, privacy_mode=privacy_mode, diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 134f9b3..95999d2 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -92,8 +92,6 @@ if TYPE_CHECKING: ContentText, ContentTextTypedDict, ContentTypedDict, - CostDetails, - CostDetailsTypedDict, CreateEmbeddingsData, CreateEmbeddingsDataTypedDict, CreateEmbeddingsGlobals, @@ -389,6 +387,8 @@ if TYPE_CHECKING: GetModelsGlobalsTypedDict, GetModelsRequest, GetModelsRequestTypedDict, + GetModelsResponse, + GetModelsResponseTypedDict, GetModelsSort, Region, Zdr, @@ -471,6 +471,8 @@ if TYPE_CHECKING: ListEmbeddingsModelsGlobalsTypedDict, ListEmbeddingsModelsRequest, ListEmbeddingsModelsRequestTypedDict, + ListEmbeddingsModelsResponse, + ListEmbeddingsModelsResponseTypedDict, ) from .listendpoints import ( ListEndpointsGlobals, @@ -565,6 +567,8 @@ if TYPE_CHECKING: ListModelsUserGlobalsTypedDict, ListModelsUserRequest, ListModelsUserRequestTypedDict, + ListModelsUserResponse, + ListModelsUserResponseTypedDict, ListModelsUserSecurity, ListModelsUserSecurityTypedDict, ) @@ -797,8 +801,6 @@ __all__ = [ "ContentTextTypedDict", "ContentTypedDict", "ContextBucket", - "CostDetails", - "CostDetailsTypedDict", "CreateAudioSpeechGlobals", "CreateAudioSpeechGlobalsTypedDict", "CreateAudioSpeechRequest", @@ -1036,6 +1038,8 @@ __all__ = [ "GetModelsGlobalsTypedDict", "GetModelsRequest", "GetModelsRequestTypedDict", + "GetModelsResponse", + "GetModelsResponseTypedDict", "GetModelsSort", "GetObservabilityDestinationGlobals", "GetObservabilityDestinationGlobalsTypedDict", @@ -1093,6 +1097,8 @@ __all__ = [ "ListEmbeddingsModelsGlobalsTypedDict", "ListEmbeddingsModelsRequest", "ListEmbeddingsModelsRequestTypedDict", + "ListEmbeddingsModelsResponse", + "ListEmbeddingsModelsResponseTypedDict", "ListEndpointsGlobals", "ListEndpointsGlobalsTypedDict", "ListEndpointsRequest", @@ -1163,6 +1169,8 @@ __all__ = [ "ListModelsUserGlobalsTypedDict", "ListModelsUserRequest", "ListModelsUserRequestTypedDict", + "ListModelsUserResponse", + "ListModelsUserResponseTypedDict", "ListModelsUserSecurity", "ListModelsUserSecurityTypedDict", "ListObservabilityDestinationsGlobals", @@ -1398,8 +1406,6 @@ _dynamic_imports: dict[str, str] = { "ContentText": ".createembeddings", "ContentTextTypedDict": ".createembeddings", "ContentTypedDict": ".createembeddings", - "CostDetails": ".createembeddings", - "CostDetailsTypedDict": ".createembeddings", "CreateEmbeddingsData": ".createembeddings", "CreateEmbeddingsDataTypedDict": ".createembeddings", "CreateEmbeddingsGlobals": ".createembeddings", @@ -1631,6 +1637,8 @@ _dynamic_imports: dict[str, str] = { "GetModelsGlobalsTypedDict": ".getmodels", "GetModelsRequest": ".getmodels", "GetModelsRequestTypedDict": ".getmodels", + "GetModelsResponse": ".getmodels", + "GetModelsResponseTypedDict": ".getmodels", "GetModelsSort": ".getmodels", "Region": ".getmodels", "Zdr": ".getmodels", @@ -1691,6 +1699,8 @@ _dynamic_imports: dict[str, str] = { "ListEmbeddingsModelsGlobalsTypedDict": ".listembeddingsmodels", "ListEmbeddingsModelsRequest": ".listembeddingsmodels", "ListEmbeddingsModelsRequestTypedDict": ".listembeddingsmodels", + "ListEmbeddingsModelsResponse": ".listembeddingsmodels", + "ListEmbeddingsModelsResponseTypedDict": ".listembeddingsmodels", "ListEndpointsGlobals": ".listendpoints", "ListEndpointsGlobalsTypedDict": ".listendpoints", "ListEndpointsRequest": ".listendpoints", @@ -1759,6 +1769,8 @@ _dynamic_imports: dict[str, str] = { "ListModelsUserGlobalsTypedDict": ".listmodelsuser", "ListModelsUserRequest": ".listmodelsuser", "ListModelsUserRequestTypedDict": ".listmodelsuser", + "ListModelsUserResponse": ".listmodelsuser", + "ListModelsUserResponseTypedDict": ".listmodelsuser", "ListModelsUserSecurity": ".listmodelsuser", "ListModelsUserSecurityTypedDict": ".listmodelsuser", "ListObservabilityDestinationsGlobals": ".listobservabilitydestinations", diff --git a/src/openrouter/operations/createembeddings.py b/src/openrouter/operations/createembeddings.py index 699e986..a7fed8e 100644 --- a/src/openrouter/operations/createembeddings.py +++ b/src/openrouter/operations/createembeddings.py @@ -5,6 +5,7 @@ from openrouter.components import ( contentpartinputaudio as components_contentpartinputaudio, contentpartinputfile as components_contentpartinputfile, contentpartinputvideo as components_contentpartinputvideo, + costdetails as components_costdetails, providerpreferences as components_providerpreferences, ) from openrouter.types import ( @@ -383,49 +384,6 @@ class CreateEmbeddingsData(BaseModel): Object = Literal["list",] -class CostDetailsTypedDict(TypedDict): - r"""Breakdown of upstream inference costs""" - - upstream_inference_completions_cost: float - upstream_inference_prompt_cost: float - upstream_inference_cost: NotRequired[Nullable[float]] - - -class CostDetails(BaseModel): - r"""Breakdown of upstream inference costs""" - - upstream_inference_completions_cost: float - - upstream_inference_prompt_cost: float - - upstream_inference_cost: OptionalNullable[float] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["upstream_inference_cost"]) - nullable_fields = set(["upstream_inference_cost"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - class PromptTokensDetailsTypedDict(TypedDict): r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.""" @@ -493,7 +451,7 @@ class CreateEmbeddingsUsageTypedDict(TypedDict): r"""Total number of tokens used""" cost: NotRequired[float] r"""Cost of the request in credits""" - cost_details: NotRequired[Nullable[CostDetailsTypedDict]] + cost_details: NotRequired[Nullable[components_costdetails.CostDetailsTypedDict]] r"""Breakdown of upstream inference costs""" is_byok: NotRequired[bool] r"""Whether a request was made using a Bring Your Own Key configuration""" @@ -513,7 +471,7 @@ class CreateEmbeddingsUsage(BaseModel): cost: Optional[float] = None r"""Cost of the request in credits""" - cost_details: OptionalNullable[CostDetails] = UNSET + cost_details: OptionalNullable[components_costdetails.CostDetails] = UNSET r"""Breakdown of upstream inference costs""" is_byok: Optional[bool] = None diff --git a/src/openrouter/operations/getmodels.py b/src/openrouter/operations/getmodels.py index dc16709..de85546 100644 --- a/src/openrouter/operations/getmodels.py +++ b/src/openrouter/operations/getmodels.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from openrouter.components import modelslistresponse as components_modelslistresponse from openrouter.types import ( BaseModel, Nullable, @@ -12,7 +13,7 @@ from openrouter.types import ( from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata import pydantic from pydantic import model_serializer -from typing import Literal, Optional, Union +from typing import Awaitable, Callable, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -152,6 +153,10 @@ class GetModelsRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ + offset: NotRequired[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 1000). When both offset and limit are omitted, the full list is returned""" category: NotRequired[GetModelsCategory] r"""Filter models by use case category""" supported_parameters: NotRequired[str] @@ -237,6 +242,18 @@ class GetModelsRequest(BaseModel): """ + offset: Annotated[ + Optional[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)), + ] = 500 + r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned""" + category: Annotated[ Optional[GetModelsCategory], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), @@ -406,6 +423,8 @@ class GetModelsRequest(BaseModel): "HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories", + "offset", + "limit", "category", "supported_parameters", "output_modalities", @@ -473,3 +492,16 @@ class GetModelsRequest(BaseModel): m[k] = val return m + + +class GetModelsResponseTypedDict(TypedDict): + result: components_modelslistresponse.ModelsListResponseTypedDict + + +class GetModelsResponse(BaseModel): + next: Union[ + Callable[[], Optional[GetModelsResponse]], + Callable[[], Awaitable[Optional[GetModelsResponse]]], + ] + + result: components_modelslistresponse.ModelsListResponse diff --git a/src/openrouter/operations/listbyokkeys.py b/src/openrouter/operations/listbyokkeys.py index 67d30bc..46c012e 100644 --- a/src/openrouter/operations/listbyokkeys.py +++ b/src/openrouter/operations/listbyokkeys.py @@ -230,13 +230,13 @@ class ListBYOKKeysRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" workspace_id: Annotated[ diff --git a/src/openrouter/operations/listembeddingsmodels.py b/src/openrouter/operations/listembeddingsmodels.py index a019232..016f0b9 100644 --- a/src/openrouter/operations/listembeddingsmodels.py +++ b/src/openrouter/operations/listembeddingsmodels.py @@ -1,11 +1,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from openrouter.components import modelslistresponse as components_modelslistresponse from openrouter.types import BaseModel, UNSET_SENTINEL -from openrouter.utils import FieldMetadata, HeaderMetadata +from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata import pydantic from pydantic import model_serializer -from typing import Optional +from typing import Awaitable, Callable, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -87,6 +88,10 @@ class ListEmbeddingsModelsRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ + offset: NotRequired[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 1000). When both offset and limit are omitted, the full list is returned""" class ListEmbeddingsModelsRequest(BaseModel): @@ -118,10 +123,28 @@ class ListEmbeddingsModelsRequest(BaseModel): """ + offset: Annotated[ + Optional[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)), + ] = 500 + r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + ] ) serialized = handler(self) m = {} @@ -135,3 +158,16 @@ class ListEmbeddingsModelsRequest(BaseModel): m[k] = val return m + + +class ListEmbeddingsModelsResponseTypedDict(TypedDict): + result: components_modelslistresponse.ModelsListResponseTypedDict + + +class ListEmbeddingsModelsResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListEmbeddingsModelsResponse]], + Callable[[], Awaitable[Optional[ListEmbeddingsModelsResponse]]], + ] + + result: components_modelslistresponse.ModelsListResponse diff --git a/src/openrouter/operations/listguardrailkeyassignments.py b/src/openrouter/operations/listguardrailkeyassignments.py index e7a2c31..90f2672 100644 --- a/src/openrouter/operations/listguardrailkeyassignments.py +++ b/src/openrouter/operations/listguardrailkeyassignments.py @@ -140,13 +140,13 @@ class ListGuardrailKeyAssignmentsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listguardrailmemberassignments.py b/src/openrouter/operations/listguardrailmemberassignments.py index 84076b7..4ff5780 100644 --- a/src/openrouter/operations/listguardrailmemberassignments.py +++ b/src/openrouter/operations/listguardrailmemberassignments.py @@ -140,13 +140,13 @@ class ListGuardrailMemberAssignmentsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listguardrails.py b/src/openrouter/operations/listguardrails.py index 461e691..1e36035 100644 --- a/src/openrouter/operations/listguardrails.py +++ b/src/openrouter/operations/listguardrails.py @@ -130,13 +130,13 @@ class ListGuardrailsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" workspace_id: Annotated[ diff --git a/src/openrouter/operations/listkeyassignments.py b/src/openrouter/operations/listkeyassignments.py index 2aee3fc..f9ccb3d 100644 --- a/src/openrouter/operations/listkeyassignments.py +++ b/src/openrouter/operations/listkeyassignments.py @@ -128,13 +128,13 @@ class ListKeyAssignmentsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listmemberassignments.py b/src/openrouter/operations/listmemberassignments.py index f8e0b65..60c04be 100644 --- a/src/openrouter/operations/listmemberassignments.py +++ b/src/openrouter/operations/listmemberassignments.py @@ -128,13 +128,13 @@ class ListMemberAssignmentsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listmodelsuser.py b/src/openrouter/operations/listmodelsuser.py index 6070772..d2a24e4 100644 --- a/src/openrouter/operations/listmodelsuser.py +++ b/src/openrouter/operations/listmodelsuser.py @@ -1,11 +1,17 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from openrouter.components import modelslistresponse as components_modelslistresponse from openrouter.types import BaseModel, UNSET_SENTINEL -from openrouter.utils import FieldMetadata, HeaderMetadata, SecurityMetadata +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + QueryParamMetadata, + SecurityMetadata, +) import pydantic from pydantic import model_serializer -from typing import Optional +from typing import Awaitable, Callable, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict @@ -105,6 +111,10 @@ class ListModelsUserRequestTypedDict(TypedDict): r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. """ + offset: NotRequired[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 1000). When both offset and limit are omitted, the full list is returned""" class ListModelsUserRequest(BaseModel): @@ -136,10 +146,28 @@ class ListModelsUserRequest(BaseModel): """ + offset: Annotated[ + Optional[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)), + ] = 500 + r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + [ + "HTTP-Referer", + "X-OpenRouter-Title", + "X-OpenRouter-Categories", + "offset", + "limit", + ] ) serialized = handler(self) m = {} @@ -153,3 +181,16 @@ class ListModelsUserRequest(BaseModel): m[k] = val return m + + +class ListModelsUserResponseTypedDict(TypedDict): + result: components_modelslistresponse.ModelsListResponseTypedDict + + +class ListModelsUserResponse(BaseModel): + next: Union[ + Callable[[], Optional[ListModelsUserResponse]], + Callable[[], Awaitable[Optional[ListModelsUserResponse]]], + ] + + result: components_modelslistresponse.ModelsListResponse diff --git a/src/openrouter/operations/listobservabilitydestinations.py b/src/openrouter/operations/listobservabilitydestinations.py index 465e357..818784f 100644 --- a/src/openrouter/operations/listobservabilitydestinations.py +++ b/src/openrouter/operations/listobservabilitydestinations.py @@ -130,13 +130,13 @@ class ListObservabilityDestinationsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" workspace_id: Annotated[ diff --git a/src/openrouter/operations/listorganizationmembers.py b/src/openrouter/operations/listorganizationmembers.py index 15662f4..06825ee 100644 --- a/src/openrouter/operations/listorganizationmembers.py +++ b/src/openrouter/operations/listorganizationmembers.py @@ -125,13 +125,13 @@ class ListOrganizationMembersRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listpresets.py b/src/openrouter/operations/listpresets.py index bf21a24..23c66e8 100644 --- a/src/openrouter/operations/listpresets.py +++ b/src/openrouter/operations/listpresets.py @@ -126,13 +126,13 @@ class ListPresetsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listpresetversions.py b/src/openrouter/operations/listpresetversions.py index 36052fb..1224fee 100644 --- a/src/openrouter/operations/listpresetversions.py +++ b/src/openrouter/operations/listpresetversions.py @@ -140,13 +140,13 @@ class ListPresetVersionsRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listworkspacemembers.py b/src/openrouter/operations/listworkspacemembers.py index 9a8706f..ff41be4 100644 --- a/src/openrouter/operations/listworkspacemembers.py +++ b/src/openrouter/operations/listworkspacemembers.py @@ -140,13 +140,13 @@ class ListWorkspaceMembersRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/operations/listworkspaces.py b/src/openrouter/operations/listworkspaces.py index a242ff3..59f628e 100644 --- a/src/openrouter/operations/listworkspaces.py +++ b/src/openrouter/operations/listworkspaces.py @@ -128,13 +128,13 @@ class ListWorkspacesRequest(BaseModel): offset: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 0 r"""Number of records to skip for pagination""" limit: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None + ] = 50 r"""Maximum number of records to return (max 100)""" @model_serializer(mode="wrap") diff --git a/src/openrouter/organization.py b/src/openrouter/organization.py index d24bfa8..31c74ed 100644 --- a/src/openrouter/organization.py +++ b/src/openrouter/organization.py @@ -19,8 +19,8 @@ class Organization(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -123,7 +123,7 @@ class Organization(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -182,8 +182,8 @@ class Organization(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -291,7 +291,7 @@ class Organization(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index 13b309d..250c20d 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -19,8 +19,8 @@ class Presets(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -126,7 +126,7 @@ class Presets(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -185,8 +185,8 @@ class Presets(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -295,7 +295,7 @@ class Presets(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) @@ -2649,8 +2649,8 @@ class Presets(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2758,7 +2758,7 @@ class Presets(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -2824,8 +2824,8 @@ class Presets(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2936,7 +2936,7 @@ class Presets(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) diff --git a/src/openrouter/workspaces.py b/src/openrouter/workspaces.py index f3cf390..d2088f5 100644 --- a/src/openrouter/workspaces.py +++ b/src/openrouter/workspaces.py @@ -19,8 +19,8 @@ class Workspaces(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -123,7 +123,7 @@ class Workspaces(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -177,8 +177,8 @@ class Workspaces(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -284,7 +284,7 @@ class Workspaces(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) @@ -2409,8 +2409,8 @@ class Workspaces(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2515,7 +2515,7 @@ class Workspaces(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return None - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return None next_offset = offset + len(results[0]) @@ -2581,8 +2581,8 @@ class Workspaces(BaseSDK): http_referer: Optional[str] = None, x_open_router_title: Optional[str] = None, x_open_router_categories: Optional[str] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: Optional[int] = 0, + limit: Optional[int] = 50, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2690,7 +2690,7 @@ class Workspaces(BaseSDK): results = JSONPath("$.data").parse(body) if len(results) == 0 or len(results[0]) == 0: return empty_result() - limit_ = request.limit if isinstance(request.limit, int) else 0 + limit_ = request.limit if isinstance(request.limit, int) else 50 if len(results[0]) < limit_: return empty_result() next_offset = offset + len(results[0]) diff --git a/uv.lock b/uv.lock index 78390fc..fa772e2 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.23" +version = "0.11.24" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 68b867f65c795c52390652bfb812607f11dafdfc Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 19:17:05 +0000 Subject: [PATCH 45/62] chore: update OpenAPI spec from monorepo (#437) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 85 +++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 10 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index f40b69a..da4a7e7 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -9646,6 +9646,80 @@ components: - b64_json - created type: object + ImageGenerationProviderPreferences: + description: Provider routing preferences and provider-specific passthrough configuration. + example: + allow_fallbacks: false + only: + - google-ai-studio + properties: + allow_fallbacks: + description: > + Whether to allow backup providers to serve requests + + - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the + next best provider. + + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + nullable: true + type: boolean + ignore: + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider + settings for this request. + example: + - openai + - anthropic + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + nullable: true + type: array + only: + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider + settings for this request. + example: + - openai + - anthropic + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + nullable: true + type: array + options: + allOf: + - $ref: '#/components/schemas/ProviderOptions' + - example: + black-forest-labs: + guidance: 3 + steps: 40 + order: + description: >- + An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this + list that supports your requested model, and fall back to the next if it is unavailable. If no providers are + available, the request will fail with an error message. + example: + - openai + - anthropic + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + nullable: true + type: array + sort: + anyOf: + - $ref: '#/components/schemas/ProviderSort' + - $ref: '#/components/schemas/ProviderSortConfig' + - nullable: true + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is + performed. + example: price + type: object ImageGenerationRequest: description: Image generation request input example: @@ -9722,16 +9796,7 @@ components: minLength: 1 type: string provider: - description: Provider-specific passthrough configuration - properties: - options: - allOf: - - $ref: '#/components/schemas/ProviderOptions' - - example: - black-forest-labs: - guidance: 3 - steps: 40 - type: object + $ref: '#/components/schemas/ImageGenerationProviderPreferences' quality: description: Rendering quality. Providers without a quality knob ignore this. enum: From 4d598caab2842ed5a09231c7eb010a28983ab9d6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 19:22:44 +0000 Subject: [PATCH 46/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.25=20(#438)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 120 +-- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 80 +- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- .../imagegenerationproviderpreferences.mdx | 17 + ...agegenerationproviderpreferencesignore.mdx | 18 + ...imagegenerationproviderpreferencesonly.mdx | 18 + ...egenerationproviderpreferencesoptions.mdx} | 2 +- ...magegenerationproviderpreferencesorder.mdx | 18 + ...imagegenerationproviderpreferencessort.mdx | 27 + docs/components/imagegenerationrequest.mdx | 2 +- .../imagegenerationrequestprovider.mdx | 12 - docs/components/providerpreferences.mdx | 8 +- ...only.mdx => providerpreferencesignore.mdx} | 2 +- ...ignore.mdx => providerpreferencesonly.mdx} | 2 +- ...order.mdx => providerpreferencesorder.mdx} | 2 +- .../{sort.mdx => providerpreferencessort.mdx} | 2 +- docs/sdks/images/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 98 ++- .../imagegenerationproviderpreferences.py | 699 ++++++++++++++++++ .../components/imagegenerationrequest.py | 611 +-------------- .../components/providerpreferences.py | 49 +- src/openrouter/images.py | 52 +- uv.lock | 2 +- 27 files changed, 1101 insertions(+), 772 deletions(-) create mode 100644 docs/components/imagegenerationproviderpreferences.mdx create mode 100644 docs/components/imagegenerationproviderpreferencesignore.mdx create mode 100644 docs/components/imagegenerationproviderpreferencesonly.mdx rename docs/components/{imagegenerationrequestoptions.mdx => imagegenerationproviderpreferencesoptions.mdx} (99%) create mode 100644 docs/components/imagegenerationproviderpreferencesorder.mdx create mode 100644 docs/components/imagegenerationproviderpreferencessort.mdx delete mode 100644 docs/components/imagegenerationrequestprovider.mdx rename docs/components/{only.mdx => providerpreferencesignore.mdx} (83%) rename docs/components/{ignore.mdx => providerpreferencesonly.mdx} (84%) rename docs/components/{order.mdx => providerpreferencesorder.mdx} (84%) rename docs/components/{sort.mdx => providerpreferencessort.mdx} (92%) create mode 100644 src/openrouter/components/imagegenerationproviderpreferences.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 7bcf87c..1fdb3f1 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: 992dd7bf5d636d875da8e17e4faaed29 + docChecksum: a444511ee53d41b62d62b2d23ddd3b64 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.24 - configChecksum: b26850041dd0457b248bd1e3bb936fa6 + releaseVersion: 0.11.25 + configChecksum: b10f43281932fd64b0c43f8577a40816 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: d85ca6f5-dca8-4c80-9b34-a859642d0dd5 - pristine_commit_hash: d8a45b3c5aa026db485cc892cce4ce59f9b2d9e3 - pristine_tree_hash: cb0f77756ac02a67faf406ee499b1f9ea70061f0 + generation_id: 554b7889-8ccd-4aef-a14b-c347df957007 + pristine_commit_hash: 95be3ea8a18d40e9df231449f23161356fdfd5ff + pristine_tree_hash: e9b22615b85a97ffd1078604414fc174d55b227f features: python: acceptHeaders: 3.0.0 @@ -2084,10 +2084,6 @@ trackedFiles: id: ccedea0ab250 last_write_checksum: sha1:08342a9cceb4f7a5dc0b574a429d46af9d9a13f4 pristine_git_object: 9e0a058e6a19b68f470eb0938670dff51b47f4b5 - docs/components/ignore.mdx: - id: 2714aa9d51d7 - last_write_checksum: sha1:fd8114687442350261ba507cd41d1f0ebb067928 - pristine_git_object: 8ba131528ef679ebd2880be85b7732ad5a078174 docs/components/imageconfig.mdx: id: 455a9f530ea8 last_write_checksum: sha1:3ec5e8ac11e823479e41115da31aae29d2a1cbd3 @@ -2136,10 +2132,34 @@ trackedFiles: id: dd9998bc9093 last_write_checksum: sha1:a7d7c52d0a7c5128a40fd9f1524e8b6f372a9061 pristine_git_object: df5a9a53d2ea20bb548913c902b0bffdf2dc5d15 + docs/components/imagegenerationproviderpreferences.mdx: + id: 96067cea4257 + last_write_checksum: sha1:63f1caa2d78a1e1d32c1222e8275155417e7e87f + pristine_git_object: b98f786f64edd693499cd395774d60fca698aa85 + docs/components/imagegenerationproviderpreferencesignore.mdx: + id: 0c7b1553ce53 + last_write_checksum: sha1:6d55c341ed1a68b8656b8b4564794941881b3487 + pristine_git_object: 5f20d5e467c508d7814a43897a4ae35e907b0740 + docs/components/imagegenerationproviderpreferencesonly.mdx: + id: c8343461ec27 + last_write_checksum: sha1:8e2ed740ce1cf64959b7732c12bf664f5cc4a8f3 + pristine_git_object: 11f1471c8b6c04f52af89d74d6dec2e9d12c2d82 + docs/components/imagegenerationproviderpreferencesoptions.mdx: + id: 32d5c4b3e06b + last_write_checksum: sha1:2e7bf9676997ff8ee9a42928a7f236a7870023bb + pristine_git_object: 15d1f0fccbd55826da587a1224021132c9731d6e + docs/components/imagegenerationproviderpreferencesorder.mdx: + id: 0547877073f3 + last_write_checksum: sha1:3e890c691097373cc9a2d7e47c3594f56b57809c + pristine_git_object: 3125f8b2ec3ee98a992c7397978917d47e1043cd + docs/components/imagegenerationproviderpreferencessort.mdx: + id: ce43ddb42deb + last_write_checksum: sha1:acd4609eea738b06a6252ee2ea0a4621eeaad2bd + pristine_git_object: 7696bf5f4a2c4a1f05e148513b70fe96b2f948a8 docs/components/imagegenerationrequest.mdx: id: b093cb0f5e81 - last_write_checksum: sha1:4a0e2091a23f660c3e706c0e695504fb090e94d1 - pristine_git_object: f9b74f407b1fbc065f271341d42c94142b2e2503 + last_write_checksum: sha1:1bccab895149605ba994e84b202c1f7b50c6ccb2 + pristine_git_object: 36805ca3350396bfded85776a3fe88e268ca0a35 docs/components/imagegenerationrequestaspectratio.mdx: id: bda89377f32d last_write_checksum: sha1:9cc231ee222c01ce471ecff3804a9e5acb8a054f @@ -2148,18 +2168,10 @@ trackedFiles: id: cab3c6c6dfc6 last_write_checksum: sha1:ea6f2fa5f8f63600e2d1a67a784e6a93cf295975 pristine_git_object: 8501680bcfebabb3af52b518c01f732d18282120 - docs/components/imagegenerationrequestoptions.mdx: - id: 2245ece0aaf8 - last_write_checksum: sha1:feec51e178c169d3550ef010a94c69c16e137afc - pristine_git_object: 39c52366e3516de4554c93613d8bbbc8b64a8a5a docs/components/imagegenerationrequestoutputformat.mdx: id: 380f12bf77bd last_write_checksum: sha1:afb479dc34118828e988888a8f49e7a5a50a45ab pristine_git_object: 4901416246fb4e34fc9227d3dc0bbbc08aa717e2 - docs/components/imagegenerationrequestprovider.mdx: - id: 8b592ddbab98 - last_write_checksum: sha1:c67183fc76f6e46530829fc5b85b8c164a4c2557 - pristine_git_object: 51188d0f86b2208ae9dc3d797ce3595961162602 docs/components/imagegenerationrequestquality.mdx: id: 7699c7fce91f last_write_checksum: sha1:e0c8abee1332b182aeb1228b9c7a7f4cec83e99b @@ -3112,10 +3124,6 @@ trackedFiles: id: 35262d81b0a1 last_write_checksum: sha1:53220ed66cf059d9f06df81b7f5bb0f2d87f5283 pristine_git_object: bf3c27b8d2da352bd80bb18179159839e69b9b0a - docs/components/only.mdx: - id: cee5f91a1c3b - last_write_checksum: sha1:abccbc4844ea73ff3641b1aa2a98bdfaebf8d216 - pristine_git_object: cc284e22005d61c156fac73624aee6ead3c1e9eb docs/components/openairesponsecustomtoolcall.mdx: id: 090c07768006 last_write_checksum: sha1:34b7e423654fb097e3420b2fa3ef010f15821796 @@ -3320,10 +3328,6 @@ trackedFiles: id: f88a0ae3ee7d last_write_checksum: sha1:196dfc00e44fa232c6e4f0f496f265a163ffe66b pristine_git_object: b4df5fb4757522576e8452d88f22499cee204278 - docs/components/order.mdx: - id: ae1a6aab00d6 - last_write_checksum: sha1:efc73cd83c8f4e0095ba6901df6dc95349b822a2 - pristine_git_object: edc1ffcd263a4fffa0d4d5b7da1e2c0315a61cb8 docs/components/outcome.mdx: id: dc555505ef36 last_write_checksum: sha1:5e99185f9d49f3f404ca4e54ef84d0cdbf31546c @@ -3918,8 +3922,24 @@ trackedFiles: pristine_git_object: 05bcfceecf3e74def73684391a76fa68829271a3 docs/components/providerpreferences.mdx: id: adbdfaa46438 - last_write_checksum: sha1:d0f7b534fbaed359e2f2abd736bd669367371462 - pristine_git_object: 750d3a21ada3133dba71217f0444c2064b2ff081 + last_write_checksum: sha1:26ef79be79d733e12a89acc7687ccbd87ebc2f2e + pristine_git_object: a312c6f654c101959c3f182c268556c01e578a40 + docs/components/providerpreferencesignore.mdx: + id: e0455b31c87b + last_write_checksum: sha1:823f56c785a5c80949105fc0f4297a5b0ff2c2b2 + pristine_git_object: 77ecc57935ce0edf477099eac9550490515be515 + docs/components/providerpreferencesonly.mdx: + id: a72941ff2735 + last_write_checksum: sha1:614acb6d266ffd00b1f4f0b7fb4ab6cee551bc96 + pristine_git_object: a6e0692f2fe4e5f87d3816797118dd19f0ebd480 + docs/components/providerpreferencesorder.mdx: + id: a1fce55fe271 + last_write_checksum: sha1:ccbc5120235aa6a8c3aefe791a49bf1539bde74f + pristine_git_object: b9fce30d460f0ed187b5c81225d41c8f4217d1e8 + docs/components/providerpreferencessort.mdx: + id: 64d54fd9ff0b + last_write_checksum: sha1:4eb43e63950c0481fae29816afe807226bdda4ea + pristine_git_object: 72d68077694236233f2bde5d65959b550210a20d docs/components/providerresponse.mdx: id: 36e1a24f90b6 last_write_checksum: sha1:512adc6bd7e7854ce01d5e5c46ce76b26a1b1174 @@ -4364,10 +4384,6 @@ trackedFiles: id: b35cae5eacec last_write_checksum: sha1:6865169ff4445d70d63c674092812b47236f213f pristine_git_object: 1c0dd3c44cfce8b531e7d89e3db6b2787f060984 - docs/components/sort.mdx: - id: 2423f4a05690 - last_write_checksum: sha1:3443886b2481e8685a1c390530dfd7b763d9f237 - pristine_git_object: b12340f49cd6973329dc305d88b7190bcb5c163b docs/components/sourcecontent.mdx: id: d211413b56ad last_write_checksum: sha1:e9ec235c28760da429e35fea006321e7a697e5c4 @@ -6586,8 +6602,8 @@ trackedFiles: pristine_git_object: 52efbd96250f06588fea44689bed93f27f2e0230 docs/sdks/images/README.mdx: id: 534a6c102c4f - last_write_checksum: sha1:eb919a70e20e9bde335ff1e8ae52ba0a309ca5c3 - pristine_git_object: 8277c7710decc3ee152c7fe725c90bac9784800a + last_write_checksum: sha1:1c0a9c704bdd9090f5a0a74f4d9ae0c4360707bb + pristine_git_object: 4b3508543942b711f2d74df5436748e1815619e2 docs/sdks/models/README.mdx: id: 58f1ca464e0b last_write_checksum: sha1:90e4f262bc449464226d1d83c731709e3352bbb1 @@ -6642,8 +6658,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:451a4be23fc081294b962e2bc0c6f0dbae2c43ab - pristine_git_object: 88b38af4fdfc0341a41fae784c7c78c1137e00a3 + last_write_checksum: sha1:ecba4ec7fe5c538617fb6e42582204ae5711d106 + pristine_git_object: 6804383f389474f6b72740ce0a281ba45ed8251d scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6670,8 +6686,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:5a4d07dc0be8788ed4abef1a2b48b18cdaa1afb1 - pristine_git_object: e328286d4babd45c447a377612162c30d1220393 + last_write_checksum: sha1:a776602f2cf82d2f44e51bbbd69dfeee7a7f46f3 + pristine_git_object: d272f6c0b2f426b678e025f6181287b08ea995ed src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6710,8 +6726,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:1d909d376196542b7bd1a320346e7bbda7cb5f48 - pristine_git_object: 1f755537449f9869a6c5e548ae39bdb03b8f777f + last_write_checksum: sha1:045cf74eb4e03399ac8521ff3db0a2ed9f33b002 + pristine_git_object: 43900430f099cab065756d44e23f9c4118c99180 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -7660,10 +7676,14 @@ trackedFiles: id: 7a791a02cb5b last_write_checksum: sha1:497f9be381527fd1ee961450a2364a898dba875b pristine_git_object: 6b9a8990973466285f9b49b366bbc5fc1ae42e41 + src/openrouter/components/imagegenerationproviderpreferences.py: + id: 100a82a54e2d + last_write_checksum: sha1:63973ed1d6c151ffdb2977626461d911ca8869b4 + pristine_git_object: 692420fd5cf21e77ff5caad6dc34995710cb734c src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 - last_write_checksum: sha1:348c6aa7d1b7a02694e44396e51ab56e20853bb9 - pristine_git_object: 9866560ee4d4d61c0bec89e276bb0a39f6d215ad + last_write_checksum: sha1:48a9640c0b9f48833d5514c7671bfa4b76aac776 + pristine_git_object: 9f5f9caf2d762e3db6affdd2aa20612978821dee src/openrouter/components/imagegenerationresponse.py: id: 53354cd0cbfc last_write_checksum: sha1:53f1cde7b8bfe4f9e786a76f6e57b0a1f76aced2 @@ -8350,8 +8370,8 @@ trackedFiles: pristine_git_object: c85a381a5f596fcbc2e3e599a65e8d03d62fabcd src/openrouter/components/providerpreferences.py: id: cdd58c8d664d - last_write_checksum: sha1:381d12826558a405f980ca338413e472296c12a2 - pristine_git_object: abbb3cb3d7d8946aabdbd5e6b07b2e45954f6948 + last_write_checksum: sha1:93405c39357e66bfe8cb60010622a884122b9197 + pristine_git_object: 2d44eabbe3200d884a5e01589732570d3a3ab7e1 src/openrouter/components/providerresponse.py: id: ad3887be54c5 last_write_checksum: sha1:b8868ce7950808be5b37e964607abab8348e2ab6 @@ -9046,8 +9066,8 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/openrouter/images.py: id: c4d7adf63ae0 - last_write_checksum: sha1:2237619daf56a48c3ee0c8980178d36443ca1b13 - pristine_git_object: b7a120ad3562280aab790be56cbf482286fe40b4 + last_write_checksum: sha1:277721bb6c89aabdc3fd5b8bbb73b9dc6e98d2f9 + pristine_git_object: 8a3080f7b51f197bb357e5e264b173d230b1f293 src/openrouter/models/__init__.py: id: ed73b93abb3f last_write_checksum: sha1:932a790ae66ccd7d7022b39c659bcf72a664ebea @@ -11109,4 +11129,6 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed** (Breaking ⚠️)\n* `open_router.presets.create_presets_messages()`: \n * `request.tools[]` **Changed** (Breaking ⚠️)\n* `open_router.models.list()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.observability.list()`: `request` **Changed**\n* `open_router.guardrails.list_guardrail_member_assignments()`: `request` **Changed**\n* `open_router.guardrails.list_key_assignments()`: `request` **Changed**\n* `open_router.guardrails.list_member_assignments()`: `request` **Changed**\n* `open_router.guardrails.list()`: `request` **Changed**\n* `open_router.models.list_for_user()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.guardrails.list_guardrail_key_assignments()`: `request` **Changed**\n* `open_router.organization.list_members()`: `request` **Changed**\n* `open_router.presets.list()`: `request` **Changed**\n* `open_router.embeddings.list_models()`: \n * `request` **Changed**\n * `response` **Changed**\n* `open_router.byok.list()`: `request` **Changed**\n* `open_router.presets.list_versions()`: `request` **Changed**\n* `open_router.workspaces.list()`: `request` **Changed**\n* `open_router.workspaces.list_members()`: `request` **Changed**\n" +releaseNotes: | + ## Python SDK Changes: + * `open_router.images.generate()`: `request.provider` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0640159..46c1783 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.24 + version: 0.11.25 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 2fd440f..e340148 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9590,6 +9590,75 @@ components: - b64_json - created type: object + ImageGenerationProviderPreferences: + description: Provider routing preferences and provider-specific passthrough configuration. + example: + allow_fallbacks: false + only: + - google-ai-studio + properties: + allow_fallbacks: + description: > + Whether to allow backup providers to serve requests + + - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. + + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + nullable: true + type: boolean + ignore: + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. + example: + - openai + - anthropic + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + nullable: true + type: array + only: + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. + example: + - openai + - anthropic + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + nullable: true + type: array + options: + allOf: + - $ref: '#/components/schemas/ProviderOptions' + - example: + black-forest-labs: + guidance: 3 + steps: 40 + order: + description: >- + An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. + example: + - openai + - anthropic + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + nullable: true + type: array + sort: + anyOf: + - $ref: '#/components/schemas/ProviderSort' + - $ref: '#/components/schemas/ProviderSortConfig' + - nullable: true + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + example: price + type: object ImageGenerationRequest: description: Image generation request input example: @@ -9668,16 +9737,7 @@ components: minLength: 1 type: string provider: - description: Provider-specific passthrough configuration - properties: - options: - allOf: - - $ref: '#/components/schemas/ProviderOptions' - - example: - black-forest-labs: - guidance: 3 - steps: 40 - type: object + $ref: '#/components/schemas/ImageGenerationProviderPreferences' quality: description: Rendering quality. Providers without a quality knob ignore this. enum: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index ddd35cc..650819f 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:aa9148968ef9a66307aca31b047a12fb8a955aa957482a3b06a582537f259cb4 - sourceBlobDigest: sha256:ac0a0e1f34d3f5e342c3ba497bf58ea2d83107f59302dd2c399a70116dfe8845 + sourceRevisionDigest: sha256:c4b604e524d65fc80cad85d0620c391b70d087ed384bbb1ed03166267524ec3d + sourceBlobDigest: sha256:59fc42341a3b4ae0f2344e88df306b70fb85b526e84e1c274c006afb7d99153b tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:aa9148968ef9a66307aca31b047a12fb8a955aa957482a3b06a582537f259cb4 - sourceBlobDigest: sha256:ac0a0e1f34d3f5e342c3ba497bf58ea2d83107f59302dd2c399a70116dfe8845 + sourceRevisionDigest: sha256:c4b604e524d65fc80cad85d0620c391b70d087ed384bbb1ed03166267524ec3d + sourceBlobDigest: sha256:59fc42341a3b4ae0f2344e88df306b70fb85b526e84e1c274c006afb7d99153b codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:252d3909d3f6fce4c2605924214b126af1fe4c3162dd52ba9cf9ad32ddd7dbda + codeSamplesRevisionDigest: sha256:b959c03fc95af18ab71b3e8edc54d3a74d06d0a3f0d786576f3ab1a1c049cdd0 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index f8b0a1d..ab81e86 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -348,4 +348,14 @@ Based on: ### Generated - [python v0.11.24] . ### Releases -- [PyPI v0.11.24] https://pypi.org/project/openrouter/0.11.24 - . \ No newline at end of file +- [PyPI v0.11.24] https://pypi.org/project/openrouter/0.11.24 - . + +## 2026-07-13 19:18:28 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.25] . +### Releases +- [PyPI v0.11.25] https://pypi.org/project/openrouter/0.11.25 - . \ No newline at end of file diff --git a/docs/components/imagegenerationproviderpreferences.mdx b/docs/components/imagegenerationproviderpreferences.mdx new file mode 100644 index 0000000..b98f786 --- /dev/null +++ b/docs/components/imagegenerationproviderpreferences.mdx @@ -0,0 +1,17 @@ +--- +title: "ImageGenerationProviderPreferences" +--- + +Provider routing preferences and provider-specific passthrough configuration. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| | +| `ignore` | List[[components.ImageGenerationProviderPreferencesIgnore](../components/imagegenerationproviderpreferencesignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] | +| `only` | List[[components.ImageGenerationProviderPreferencesOnly](../components/imagegenerationproviderpreferencesonly.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] | +| `options` | [Optional[components.ImageGenerationProviderPreferencesOptions]](../components/imagegenerationproviderpreferencesoptions.mdx) | :heavy_minus_sign: | N/A | \{
"black-forest-labs": \{
"guidance": 3,
"steps": 40
}
} | +| `order` | List[[components.ImageGenerationProviderPreferencesOrder](../components/imagegenerationproviderpreferencesorder.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] | +| `sort` | [OptionalNullable[components.ImageGenerationProviderPreferencesSort]](../components/imagegenerationproviderpreferencessort.mdx) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | \ No newline at end of file diff --git a/docs/components/imagegenerationproviderpreferencesignore.mdx b/docs/components/imagegenerationproviderpreferencesignore.mdx new file mode 100644 index 0000000..5f20d5e --- /dev/null +++ b/docs/components/imagegenerationproviderpreferencesignore.mdx @@ -0,0 +1,18 @@ +--- +title: "ImageGenerationProviderPreferencesIgnore" +--- + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/imagegenerationproviderpreferencesonly.mdx b/docs/components/imagegenerationproviderpreferencesonly.mdx new file mode 100644 index 0000000..11f1471 --- /dev/null +++ b/docs/components/imagegenerationproviderpreferencesonly.mdx @@ -0,0 +1,18 @@ +--- +title: "ImageGenerationProviderPreferencesOnly" +--- + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/imagegenerationrequestoptions.mdx b/docs/components/imagegenerationproviderpreferencesoptions.mdx similarity index 99% rename from docs/components/imagegenerationrequestoptions.mdx rename to docs/components/imagegenerationproviderpreferencesoptions.mdx index 39c5236..15d1f0f 100644 --- a/docs/components/imagegenerationrequestoptions.mdx +++ b/docs/components/imagegenerationproviderpreferencesoptions.mdx @@ -1,5 +1,5 @@ --- -title: "ImageGenerationRequestOptions" +title: "ImageGenerationProviderPreferencesOptions" --- Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped. diff --git a/docs/components/imagegenerationproviderpreferencesorder.mdx b/docs/components/imagegenerationproviderpreferencesorder.mdx new file mode 100644 index 0000000..3125f8b --- /dev/null +++ b/docs/components/imagegenerationproviderpreferencesorder.mdx @@ -0,0 +1,18 @@ +--- +title: "ImageGenerationProviderPreferencesOrder" +--- + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/imagegenerationproviderpreferencessort.mdx b/docs/components/imagegenerationproviderpreferencessort.mdx new file mode 100644 index 0000000..7696bf5 --- /dev/null +++ b/docs/components/imagegenerationproviderpreferencessort.mdx @@ -0,0 +1,27 @@ +--- +title: "ImageGenerationProviderPreferencesSort" +--- + +The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + + +## Supported Types + +### `components.ProviderSort` + +```python +value: components.ProviderSort = /* values here */ +``` + +### `components.ProviderSortConfig` + +```python +value: components.ProviderSortConfig = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/components/imagegenerationrequest.mdx b/docs/components/imagegenerationrequest.mdx index f9b74f4..36805ca 100644 --- a/docs/components/imagegenerationrequest.mdx +++ b/docs/components/imagegenerationrequest.mdx @@ -17,7 +17,7 @@ Image generation request input | `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 | | `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png | | `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting | -| `provider` | [Optional[components.ImageGenerationRequestProvider]](../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `provider` | [Optional[components.ImageGenerationProviderPreferences]](../components/imagegenerationproviderpreferences.mdx) | :heavy_minus_sign: | Provider routing preferences and provider-specific passthrough configuration. | \{
"allow_fallbacks": false,
"only": [
"google-ai-studio"
]
} | | `quality` | [Optional[components.ImageGenerationRequestQuality]](../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high | | `resolution` | [Optional[components.ImageGenerationRequestResolution]](../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K | | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | diff --git a/docs/components/imagegenerationrequestprovider.mdx b/docs/components/imagegenerationrequestprovider.mdx deleted file mode 100644 index 51188d0..0000000 --- a/docs/components/imagegenerationrequestprovider.mdx +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "ImageGenerationRequestProvider" ---- - -Provider-specific passthrough configuration - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `options` | [Optional[components.ImageGenerationRequestOptions]](../components/imagegenerationrequestoptions.mdx) | :heavy_minus_sign: | N/A | \{
"black-forest-labs": \{
"guidance": 3,
"steps": 40
}
} | \ No newline at end of file diff --git a/docs/components/providerpreferences.mdx b/docs/components/providerpreferences.mdx index 750d3a2..a312c6f 100644 --- a/docs/components/providerpreferences.mdx +++ b/docs/components/providerpreferences.mdx @@ -12,13 +12,13 @@ When multiple model providers are available, optionally indicate your routing pr | `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| | | `data_collection` | [OptionalNullable[components.DataCollection]](../components/datacollection.mdx) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it

- deny: use only providers which do not collect user data. | allow | | `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true | -| `ignore` | List[[components.Ignore](../components/ignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] | +| `ignore` | List[[components.ProviderPreferencesIgnore](../components/providerpreferencesignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [
"openai",
"anthropic"
] | | `max_price` | [Optional[components.MaxPrice]](../components/maxprice.mdx) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | | -| `only` | List[[components.Only](../components/only.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] | -| `order` | List[[components.Order](../components/order.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] | +| `only` | List[[components.ProviderPreferencesOnly](../components/providerpreferencesonly.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [
"openai",
"anthropic"
] | +| `order` | List[[components.ProviderPreferencesOrder](../components/providerpreferencesorder.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [
"openai",
"anthropic"
] | | `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.mdx) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 | | `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.mdx) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 | | `quantizations` | List[[components.Quantization](../components/quantization.mdx)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | | `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | | -| `sort` | [OptionalNullable[components.Sort]](../components/sort.mdx) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | +| `sort` | [OptionalNullable[components.ProviderPreferencesSort]](../components/providerpreferencessort.mdx) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price | | `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | \ No newline at end of file diff --git a/docs/components/only.mdx b/docs/components/providerpreferencesignore.mdx similarity index 83% rename from docs/components/only.mdx rename to docs/components/providerpreferencesignore.mdx index cc284e2..77ecc57 100644 --- a/docs/components/only.mdx +++ b/docs/components/providerpreferencesignore.mdx @@ -1,5 +1,5 @@ --- -title: "Only" +title: "ProviderPreferencesIgnore" --- ## Supported Types diff --git a/docs/components/ignore.mdx b/docs/components/providerpreferencesonly.mdx similarity index 84% rename from docs/components/ignore.mdx rename to docs/components/providerpreferencesonly.mdx index 8ba1315..a6e0692 100644 --- a/docs/components/ignore.mdx +++ b/docs/components/providerpreferencesonly.mdx @@ -1,5 +1,5 @@ --- -title: "Ignore" +title: "ProviderPreferencesOnly" --- ## Supported Types diff --git a/docs/components/order.mdx b/docs/components/providerpreferencesorder.mdx similarity index 84% rename from docs/components/order.mdx rename to docs/components/providerpreferencesorder.mdx index edc1ffc..b9fce30 100644 --- a/docs/components/order.mdx +++ b/docs/components/providerpreferencesorder.mdx @@ -1,5 +1,5 @@ --- -title: "Order" +title: "ProviderPreferencesOrder" --- ## Supported Types diff --git a/docs/components/sort.mdx b/docs/components/providerpreferencessort.mdx similarity index 92% rename from docs/components/sort.mdx rename to docs/components/providerpreferencessort.mdx index b12340f..72d6807 100644 --- a/docs/components/sort.mdx +++ b/docs/components/providerpreferencessort.mdx @@ -1,5 +1,5 @@ --- -title: "Sort" +title: "ProviderPreferencesSort" --- The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. diff --git a/docs/sdks/images/README.mdx b/docs/sdks/images/README.mdx index 8277c77..4b35085 100644 --- a/docs/sdks/images/README.mdx +++ b/docs/sdks/images/README.mdx @@ -55,7 +55,7 @@ with OpenRouter( | `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 | | `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 | | `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png | -| `provider` | [Optional[components.ImageGenerationRequestProvider]](../../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | | +| `provider` | [Optional[components.ImageGenerationProviderPreferences]](../../components/imagegenerationproviderpreferences.mdx) | :heavy_minus_sign: | Provider routing preferences and provider-specific passthrough configuration. | \{
"allow_fallbacks": false,
"only": [
"google-ai-studio"
]
} | | `quality` | [Optional[components.ImageGenerationRequestQuality]](../../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high | | `resolution` | [Optional[components.ImageGenerationRequestResolution]](../../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K | | `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | | diff --git a/pyproject.toml b/pyproject.toml index 88b38af..6804383 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.24" +version = "0.11.25" 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 e328286..d272f6c 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.24" +__version__: str = "0.11.25" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.24 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.25 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 1f75553..4390043 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1149,15 +1149,25 @@ if TYPE_CHECKING: ImageGenCompletedEventType, ImageGenCompletedEventTypedDict, ) + from .imagegenerationproviderpreferences import ( + ImageGenerationProviderPreferences, + ImageGenerationProviderPreferencesIgnore, + ImageGenerationProviderPreferencesIgnoreTypedDict, + ImageGenerationProviderPreferencesOnly, + ImageGenerationProviderPreferencesOnlyTypedDict, + ImageGenerationProviderPreferencesOptions, + ImageGenerationProviderPreferencesOptionsTypedDict, + ImageGenerationProviderPreferencesOrder, + ImageGenerationProviderPreferencesOrderTypedDict, + ImageGenerationProviderPreferencesSort, + ImageGenerationProviderPreferencesSortTypedDict, + ImageGenerationProviderPreferencesTypedDict, + ) from .imagegenerationrequest import ( ImageGenerationRequest, ImageGenerationRequestAspectRatio, ImageGenerationRequestBackground, - ImageGenerationRequestOptions, - ImageGenerationRequestOptionsTypedDict, ImageGenerationRequestOutputFormat, - ImageGenerationRequestProvider, - ImageGenerationRequestProviderTypedDict, ImageGenerationRequestQuality, ImageGenerationRequestResolution, ImageGenerationRequestTypedDict, @@ -2212,18 +2222,18 @@ if TYPE_CHECKING: ) from .providerpreferences import ( DataCollection, - Ignore, - IgnoreTypedDict, MaxPrice, MaxPriceTypedDict, - Only, - OnlyTypedDict, - Order, - OrderTypedDict, ProviderPreferences, + ProviderPreferencesIgnore, + ProviderPreferencesIgnoreTypedDict, + ProviderPreferencesOnly, + ProviderPreferencesOnlyTypedDict, + ProviderPreferencesOrder, + ProviderPreferencesOrderTypedDict, + ProviderPreferencesSort, + ProviderPreferencesSortTypedDict, ProviderPreferencesTypedDict, - Sort, - SortTypedDict, ) from .providerresponse import ( ProviderResponse, @@ -3625,8 +3635,6 @@ __all__ = [ "Guardrail", "GuardrailInterval", "GuardrailTypedDict", - "Ignore", - "IgnoreTypedDict", "ImageConfig", "ImageConfigTypedDict", "ImageEndpoint", @@ -3658,14 +3666,22 @@ __all__ = [ "ImageGenTextChunkEventPhase", "ImageGenTextChunkEventType", "ImageGenTextChunkEventTypedDict", + "ImageGenerationProviderPreferences", + "ImageGenerationProviderPreferencesIgnore", + "ImageGenerationProviderPreferencesIgnoreTypedDict", + "ImageGenerationProviderPreferencesOnly", + "ImageGenerationProviderPreferencesOnlyTypedDict", + "ImageGenerationProviderPreferencesOptions", + "ImageGenerationProviderPreferencesOptionsTypedDict", + "ImageGenerationProviderPreferencesOrder", + "ImageGenerationProviderPreferencesOrderTypedDict", + "ImageGenerationProviderPreferencesSort", + "ImageGenerationProviderPreferencesSortTypedDict", + "ImageGenerationProviderPreferencesTypedDict", "ImageGenerationRequest", "ImageGenerationRequestAspectRatio", "ImageGenerationRequestBackground", - "ImageGenerationRequestOptions", - "ImageGenerationRequestOptionsTypedDict", "ImageGenerationRequestOutputFormat", - "ImageGenerationRequestProvider", - "ImageGenerationRequestProviderTypedDict", "ImageGenerationRequestQuality", "ImageGenerationRequestResolution", "ImageGenerationRequestTypedDict", @@ -4041,8 +4057,6 @@ __all__ = [ "ObservabilityWebhookDestinationConfigTypedDict", "ObservabilityWebhookDestinationType", "ObservabilityWebhookDestinationTypedDict", - "Only", - "OnlyTypedDict", "OpenAIResponseCustomToolCall", "OpenAIResponseCustomToolCallOutput", "OpenAIResponseCustomToolCallOutputOutput1", @@ -4119,8 +4133,6 @@ __all__ = [ "OpenRouterWebSearchServerToolType", "OpenRouterWebSearchServerToolTypedDict", "Operator", - "Order", - "OrderTypedDict", "Outcome", "OutcomeExit", "OutcomeExitTypedDict", @@ -4348,6 +4360,14 @@ __all__ = [ "ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorDataTypedDict", "ProviderPreferences", + "ProviderPreferencesIgnore", + "ProviderPreferencesIgnoreTypedDict", + "ProviderPreferencesOnly", + "ProviderPreferencesOnlyTypedDict", + "ProviderPreferencesOrder", + "ProviderPreferencesOrderTypedDict", + "ProviderPreferencesSort", + "ProviderPreferencesSortTypedDict", "ProviderPreferencesTypedDict", "ProviderResponse", "ProviderResponseProviderName", @@ -4534,8 +4554,6 @@ __all__ = [ "ShellServerToolOpenRouterTypedDict", "ShellServerToolType", "ShellServerToolTypedDict", - "Sort", - "SortTypedDict", "SourceContent", "SourceContentTypedDict", "SourceType", @@ -5694,14 +5712,22 @@ _dynamic_imports: dict[str, str] = { "ImageGenCompletedEvent": ".imagegencompletedevent", "ImageGenCompletedEventType": ".imagegencompletedevent", "ImageGenCompletedEventTypedDict": ".imagegencompletedevent", + "ImageGenerationProviderPreferences": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesIgnore": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesIgnoreTypedDict": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesOnly": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesOnlyTypedDict": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesOptions": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesOptionsTypedDict": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesOrder": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesOrderTypedDict": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesSort": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesSortTypedDict": ".imagegenerationproviderpreferences", + "ImageGenerationProviderPreferencesTypedDict": ".imagegenerationproviderpreferences", "ImageGenerationRequest": ".imagegenerationrequest", "ImageGenerationRequestAspectRatio": ".imagegenerationrequest", "ImageGenerationRequestBackground": ".imagegenerationrequest", - "ImageGenerationRequestOptions": ".imagegenerationrequest", - "ImageGenerationRequestOptionsTypedDict": ".imagegenerationrequest", "ImageGenerationRequestOutputFormat": ".imagegenerationrequest", - "ImageGenerationRequestProvider": ".imagegenerationrequest", - "ImageGenerationRequestProviderTypedDict": ".imagegenerationrequest", "ImageGenerationRequestQuality": ".imagegenerationrequest", "ImageGenerationRequestResolution": ".imagegenerationrequest", "ImageGenerationRequestTypedDict": ".imagegenerationrequest", @@ -6529,18 +6555,18 @@ _dynamic_imports: dict[str, str] = { "ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata", "ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata", "DataCollection": ".providerpreferences", - "Ignore": ".providerpreferences", - "IgnoreTypedDict": ".providerpreferences", "MaxPrice": ".providerpreferences", "MaxPriceTypedDict": ".providerpreferences", - "Only": ".providerpreferences", - "OnlyTypedDict": ".providerpreferences", - "Order": ".providerpreferences", - "OrderTypedDict": ".providerpreferences", "ProviderPreferences": ".providerpreferences", + "ProviderPreferencesIgnore": ".providerpreferences", + "ProviderPreferencesIgnoreTypedDict": ".providerpreferences", + "ProviderPreferencesOnly": ".providerpreferences", + "ProviderPreferencesOnlyTypedDict": ".providerpreferences", + "ProviderPreferencesOrder": ".providerpreferences", + "ProviderPreferencesOrderTypedDict": ".providerpreferences", + "ProviderPreferencesSort": ".providerpreferences", + "ProviderPreferencesSortTypedDict": ".providerpreferences", "ProviderPreferencesTypedDict": ".providerpreferences", - "Sort": ".providerpreferences", - "SortTypedDict": ".providerpreferences", "ProviderResponse": ".providerresponse", "ProviderResponseProviderName": ".providerresponse", "ProviderResponseTypedDict": ".providerresponse", diff --git a/src/openrouter/components/imagegenerationproviderpreferences.py b/src/openrouter/components/imagegenerationproviderpreferences.py new file mode 100644 index 0000000..692420f --- /dev/null +++ b/src/openrouter/components/imagegenerationproviderpreferences.py @@ -0,0 +1,699 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .providername import ProviderName +from .providersort import ProviderSort +from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, List, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +ImageGenerationProviderPreferencesIgnoreTypedDict = TypeAliasType( + "ImageGenerationProviderPreferencesIgnoreTypedDict", Union[ProviderName, str] +) + + +ImageGenerationProviderPreferencesIgnore = TypeAliasType( + "ImageGenerationProviderPreferencesIgnore", Union[ProviderName, str] +) + + +ImageGenerationProviderPreferencesOnlyTypedDict = TypeAliasType( + "ImageGenerationProviderPreferencesOnlyTypedDict", Union[ProviderName, str] +) + + +ImageGenerationProviderPreferencesOnly = TypeAliasType( + "ImageGenerationProviderPreferencesOnly", Union[ProviderName, str] +) + + +class ImageGenerationProviderPreferencesOptionsTypedDict(TypedDict): + r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" + + oneai: NotRequired[Dict[str, Nullable[Any]]] + ai21: NotRequired[Dict[str, Nullable[Any]]] + aion_labs: NotRequired[Dict[str, Nullable[Any]]] + akashml: NotRequired[Dict[str, Nullable[Any]]] + alibaba: NotRequired[Dict[str, Nullable[Any]]] + amazon_bedrock: NotRequired[Dict[str, Nullable[Any]]] + amazon_nova: NotRequired[Dict[str, Nullable[Any]]] + ambient: NotRequired[Dict[str, Nullable[Any]]] + anthropic: NotRequired[Dict[str, Nullable[Any]]] + anyscale: NotRequired[Dict[str, Nullable[Any]]] + arcee_ai: NotRequired[Dict[str, Nullable[Any]]] + atlas_cloud: NotRequired[Dict[str, Nullable[Any]]] + atoma: NotRequired[Dict[str, Nullable[Any]]] + avian: NotRequired[Dict[str, Nullable[Any]]] + azure: NotRequired[Dict[str, Nullable[Any]]] + baidu: NotRequired[Dict[str, Nullable[Any]]] + baseten: NotRequired[Dict[str, Nullable[Any]]] + black_forest_labs: NotRequired[Dict[str, Nullable[Any]]] + byteplus: NotRequired[Dict[str, Nullable[Any]]] + centml: NotRequired[Dict[str, Nullable[Any]]] + cerebras: NotRequired[Dict[str, Nullable[Any]]] + chutes: NotRequired[Dict[str, Nullable[Any]]] + cirrascale: NotRequired[Dict[str, Nullable[Any]]] + clarifai: NotRequired[Dict[str, Nullable[Any]]] + cloudflare: NotRequired[Dict[str, Nullable[Any]]] + cohere: NotRequired[Dict[str, Nullable[Any]]] + crofai: NotRequired[Dict[str, Nullable[Any]]] + crucible: NotRequired[Dict[str, Nullable[Any]]] + crusoe: NotRequired[Dict[str, Nullable[Any]]] + darkbloom: NotRequired[Dict[str, Nullable[Any]]] + decart: NotRequired[Dict[str, Nullable[Any]]] + deepgram: NotRequired[Dict[str, Nullable[Any]]] + deepinfra: NotRequired[Dict[str, Nullable[Any]]] + deepseek: NotRequired[Dict[str, Nullable[Any]]] + dekallm: NotRequired[Dict[str, Nullable[Any]]] + digitalocean: NotRequired[Dict[str, Nullable[Any]]] + enfer: NotRequired[Dict[str, Nullable[Any]]] + fake_provider: NotRequired[Dict[str, Nullable[Any]]] + featherless: NotRequired[Dict[str, Nullable[Any]]] + fireworks: NotRequired[Dict[str, Nullable[Any]]] + friendli: NotRequired[Dict[str, Nullable[Any]]] + gmicloud: NotRequired[Dict[str, Nullable[Any]]] + google_ai_studio: NotRequired[Dict[str, Nullable[Any]]] + google_vertex: NotRequired[Dict[str, Nullable[Any]]] + gopomelo: NotRequired[Dict[str, Nullable[Any]]] + groq: NotRequired[Dict[str, Nullable[Any]]] + heygen: NotRequired[Dict[str, Nullable[Any]]] + huggingface: NotRequired[Dict[str, Nullable[Any]]] + hyperbolic: NotRequired[Dict[str, Nullable[Any]]] + hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]] + inception: NotRequired[Dict[str, Nullable[Any]]] + inceptron: NotRequired[Dict[str, Nullable[Any]]] + inferact_vllm: NotRequired[Dict[str, Nullable[Any]]] + inference_net: NotRequired[Dict[str, Nullable[Any]]] + infermatic: NotRequired[Dict[str, Nullable[Any]]] + inflection: NotRequired[Dict[str, Nullable[Any]]] + inocloud: NotRequired[Dict[str, Nullable[Any]]] + io_net: NotRequired[Dict[str, Nullable[Any]]] + ionstream: NotRequired[Dict[str, Nullable[Any]]] + klusterai: NotRequired[Dict[str, Nullable[Any]]] + lambda_: NotRequired[Dict[str, Nullable[Any]]] + lepton: NotRequired[Dict[str, Nullable[Any]]] + liquid: NotRequired[Dict[str, Nullable[Any]]] + lynn: NotRequired[Dict[str, Nullable[Any]]] + lynn_private: NotRequired[Dict[str, Nullable[Any]]] + mancer: NotRequired[Dict[str, Nullable[Any]]] + mancer_old: NotRequired[Dict[str, Nullable[Any]]] + mara: NotRequired[Dict[str, Nullable[Any]]] + meta: NotRequired[Dict[str, Nullable[Any]]] + minimax: NotRequired[Dict[str, Nullable[Any]]] + mistral: NotRequired[Dict[str, Nullable[Any]]] + modal: NotRequired[Dict[str, Nullable[Any]]] + modelrun: NotRequired[Dict[str, Nullable[Any]]] + modular: NotRequired[Dict[str, Nullable[Any]]] + moonshotai: NotRequired[Dict[str, Nullable[Any]]] + morph: NotRequired[Dict[str, Nullable[Any]]] + ncompass: NotRequired[Dict[str, Nullable[Any]]] + nebius: NotRequired[Dict[str, Nullable[Any]]] + nex_agi: NotRequired[Dict[str, Nullable[Any]]] + nextbit: NotRequired[Dict[str, Nullable[Any]]] + nineteen: NotRequired[Dict[str, Nullable[Any]]] + novita: NotRequired[Dict[str, Nullable[Any]]] + nvidia: NotRequired[Dict[str, Nullable[Any]]] + octoai: NotRequired[Dict[str, Nullable[Any]]] + open_inference: NotRequired[Dict[str, Nullable[Any]]] + openai: NotRequired[Dict[str, Nullable[Any]]] + parasail: NotRequired[Dict[str, Nullable[Any]]] + perceptron: NotRequired[Dict[str, Nullable[Any]]] + perplexity: NotRequired[Dict[str, Nullable[Any]]] + phala: NotRequired[Dict[str, Nullable[Any]]] + poolside: NotRequired[Dict[str, Nullable[Any]]] + quiver: NotRequired[Dict[str, Nullable[Any]]] + recraft: NotRequired[Dict[str, Nullable[Any]]] + recursal: NotRequired[Dict[str, Nullable[Any]]] + reflection: NotRequired[Dict[str, Nullable[Any]]] + reka: NotRequired[Dict[str, Nullable[Any]]] + relace: NotRequired[Dict[str, Nullable[Any]]] + replicate: NotRequired[Dict[str, Nullable[Any]]] + sakana: NotRequired[Dict[str, Nullable[Any]]] + sambanova: NotRequired[Dict[str, Nullable[Any]]] + sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] + seed: NotRequired[Dict[str, Nullable[Any]]] + sf_compute: NotRequired[Dict[str, Nullable[Any]]] + siliconflow: NotRequired[Dict[str, Nullable[Any]]] + sourceful: NotRequired[Dict[str, Nullable[Any]]] + stealth: NotRequired[Dict[str, Nullable[Any]]] + stepfun: NotRequired[Dict[str, Nullable[Any]]] + streamlake: NotRequired[Dict[str, Nullable[Any]]] + switchpoint: NotRequired[Dict[str, Nullable[Any]]] + targon: NotRequired[Dict[str, Nullable[Any]]] + tenstorrent: NotRequired[Dict[str, Nullable[Any]]] + together: NotRequired[Dict[str, Nullable[Any]]] + together_lite: NotRequired[Dict[str, Nullable[Any]]] + ubicloud: NotRequired[Dict[str, Nullable[Any]]] + upstage: NotRequired[Dict[str, Nullable[Any]]] + venice: NotRequired[Dict[str, Nullable[Any]]] + wafer: NotRequired[Dict[str, Nullable[Any]]] + wandb: NotRequired[Dict[str, Nullable[Any]]] + xai: NotRequired[Dict[str, Nullable[Any]]] + xiaomi: NotRequired[Dict[str, Nullable[Any]]] + z_ai: NotRequired[Dict[str, Nullable[Any]]] + + +class ImageGenerationProviderPreferencesOptions(BaseModel): + r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" + + oneai: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai") + ] = None + + ai21: Optional[Dict[str, Nullable[Any]]] = None + + aion_labs: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="aion-labs") + ] = None + + akashml: Optional[Dict[str, Nullable[Any]]] = None + + alibaba: Optional[Dict[str, Nullable[Any]]] = None + + amazon_bedrock: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-bedrock") + ] = None + + amazon_nova: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-nova") + ] = None + + ambient: Optional[Dict[str, Nullable[Any]]] = None + + anthropic: Optional[Dict[str, Nullable[Any]]] = None + + anyscale: Optional[Dict[str, Nullable[Any]]] = None + + arcee_ai: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="arcee-ai") + ] = None + + atlas_cloud: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="atlas-cloud") + ] = None + + atoma: Optional[Dict[str, Nullable[Any]]] = None + + avian: Optional[Dict[str, Nullable[Any]]] = None + + azure: Optional[Dict[str, Nullable[Any]]] = None + + baidu: Optional[Dict[str, Nullable[Any]]] = None + + baseten: Optional[Dict[str, Nullable[Any]]] = None + + black_forest_labs: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="black-forest-labs") + ] = None + + byteplus: Optional[Dict[str, Nullable[Any]]] = None + + centml: Optional[Dict[str, Nullable[Any]]] = None + + cerebras: Optional[Dict[str, Nullable[Any]]] = None + + chutes: Optional[Dict[str, Nullable[Any]]] = None + + cirrascale: Optional[Dict[str, Nullable[Any]]] = None + + clarifai: Optional[Dict[str, Nullable[Any]]] = None + + cloudflare: Optional[Dict[str, Nullable[Any]]] = None + + cohere: Optional[Dict[str, Nullable[Any]]] = None + + crofai: Optional[Dict[str, Nullable[Any]]] = None + + crucible: Optional[Dict[str, Nullable[Any]]] = None + + crusoe: Optional[Dict[str, Nullable[Any]]] = None + + darkbloom: Optional[Dict[str, Nullable[Any]]] = None + + decart: Optional[Dict[str, Nullable[Any]]] = None + + deepgram: Optional[Dict[str, Nullable[Any]]] = None + + deepinfra: Optional[Dict[str, Nullable[Any]]] = None + + deepseek: Optional[Dict[str, Nullable[Any]]] = None + + dekallm: Optional[Dict[str, Nullable[Any]]] = None + + digitalocean: Optional[Dict[str, Nullable[Any]]] = None + + enfer: Optional[Dict[str, Nullable[Any]]] = None + + fake_provider: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="fake-provider") + ] = None + + featherless: Optional[Dict[str, Nullable[Any]]] = None + + fireworks: Optional[Dict[str, Nullable[Any]]] = None + + friendli: Optional[Dict[str, Nullable[Any]]] = None + + gmicloud: Optional[Dict[str, Nullable[Any]]] = None + + google_ai_studio: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-ai-studio") + ] = None + + google_vertex: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-vertex") + ] = None + + gopomelo: Optional[Dict[str, Nullable[Any]]] = None + + groq: Optional[Dict[str, Nullable[Any]]] = None + + heygen: Optional[Dict[str, Nullable[Any]]] = None + + huggingface: Optional[Dict[str, Nullable[Any]]] = None + + hyperbolic: Optional[Dict[str, Nullable[Any]]] = None + + hyperbolic_quantized: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="hyperbolic-quantized") + ] = None + + inception: Optional[Dict[str, Nullable[Any]]] = None + + inceptron: Optional[Dict[str, Nullable[Any]]] = None + + inferact_vllm: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inferact-vllm") + ] = None + + inference_net: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net") + ] = None + + infermatic: Optional[Dict[str, Nullable[Any]]] = None + + inflection: Optional[Dict[str, Nullable[Any]]] = None + + inocloud: Optional[Dict[str, Nullable[Any]]] = None + + io_net: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="io-net") + ] = None + + ionstream: Optional[Dict[str, Nullable[Any]]] = None + + klusterai: Optional[Dict[str, Nullable[Any]]] = None + + lambda_: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lambda") + ] = None + + lepton: Optional[Dict[str, Nullable[Any]]] = None + + liquid: Optional[Dict[str, Nullable[Any]]] = None + + lynn: Optional[Dict[str, Nullable[Any]]] = None + + lynn_private: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lynn-private") + ] = None + + mancer: Optional[Dict[str, Nullable[Any]]] = None + + mancer_old: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="mancer-old") + ] = None + + mara: Optional[Dict[str, Nullable[Any]]] = None + + meta: Optional[Dict[str, Nullable[Any]]] = None + + minimax: Optional[Dict[str, Nullable[Any]]] = None + + mistral: Optional[Dict[str, Nullable[Any]]] = None + + modal: Optional[Dict[str, Nullable[Any]]] = None + + modelrun: Optional[Dict[str, Nullable[Any]]] = None + + modular: Optional[Dict[str, Nullable[Any]]] = None + + moonshotai: Optional[Dict[str, Nullable[Any]]] = None + + morph: Optional[Dict[str, Nullable[Any]]] = None + + ncompass: Optional[Dict[str, Nullable[Any]]] = None + + nebius: Optional[Dict[str, Nullable[Any]]] = None + + nex_agi: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="nex-agi") + ] = None + + nextbit: Optional[Dict[str, Nullable[Any]]] = None + + nineteen: Optional[Dict[str, Nullable[Any]]] = None + + novita: Optional[Dict[str, Nullable[Any]]] = None + + nvidia: Optional[Dict[str, Nullable[Any]]] = None + + octoai: Optional[Dict[str, Nullable[Any]]] = None + + open_inference: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="open-inference") + ] = None + + openai: Optional[Dict[str, Nullable[Any]]] = None + + parasail: Optional[Dict[str, Nullable[Any]]] = None + + perceptron: Optional[Dict[str, Nullable[Any]]] = None + + perplexity: Optional[Dict[str, Nullable[Any]]] = None + + phala: Optional[Dict[str, Nullable[Any]]] = None + + poolside: Optional[Dict[str, Nullable[Any]]] = None + + quiver: Optional[Dict[str, Nullable[Any]]] = None + + recraft: Optional[Dict[str, Nullable[Any]]] = None + + recursal: Optional[Dict[str, Nullable[Any]]] = None + + reflection: Optional[Dict[str, Nullable[Any]]] = None + + reka: Optional[Dict[str, Nullable[Any]]] = None + + relace: Optional[Dict[str, Nullable[Any]]] = None + + replicate: Optional[Dict[str, Nullable[Any]]] = None + + sakana: Optional[Dict[str, Nullable[Any]]] = None + + sambanova: Optional[Dict[str, Nullable[Any]]] = None + + sambanova_cloaked: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sambanova-cloaked") + ] = None + + seed: Optional[Dict[str, Nullable[Any]]] = None + + sf_compute: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sf-compute") + ] = None + + siliconflow: Optional[Dict[str, Nullable[Any]]] = None + + sourceful: Optional[Dict[str, Nullable[Any]]] = None + + stealth: Optional[Dict[str, Nullable[Any]]] = None + + stepfun: Optional[Dict[str, Nullable[Any]]] = None + + streamlake: Optional[Dict[str, Nullable[Any]]] = None + + switchpoint: Optional[Dict[str, Nullable[Any]]] = None + + targon: Optional[Dict[str, Nullable[Any]]] = None + + tenstorrent: Optional[Dict[str, Nullable[Any]]] = None + + together: Optional[Dict[str, Nullable[Any]]] = None + + together_lite: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="together-lite") + ] = None + + ubicloud: Optional[Dict[str, Nullable[Any]]] = None + + upstage: Optional[Dict[str, Nullable[Any]]] = None + + venice: Optional[Dict[str, Nullable[Any]]] = None + + wafer: Optional[Dict[str, Nullable[Any]]] = None + + wandb: Optional[Dict[str, Nullable[Any]]] = None + + xai: Optional[Dict[str, Nullable[Any]]] = None + + xiaomi: Optional[Dict[str, Nullable[Any]]] = None + + z_ai: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="z-ai") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "01ai", + "ai21", + "aion-labs", + "akashml", + "alibaba", + "amazon-bedrock", + "amazon-nova", + "ambient", + "anthropic", + "anyscale", + "arcee-ai", + "atlas-cloud", + "atoma", + "avian", + "azure", + "baidu", + "baseten", + "black-forest-labs", + "byteplus", + "centml", + "cerebras", + "chutes", + "cirrascale", + "clarifai", + "cloudflare", + "cohere", + "crofai", + "crucible", + "crusoe", + "darkbloom", + "decart", + "deepgram", + "deepinfra", + "deepseek", + "dekallm", + "digitalocean", + "enfer", + "fake-provider", + "featherless", + "fireworks", + "friendli", + "gmicloud", + "google-ai-studio", + "google-vertex", + "gopomelo", + "groq", + "heygen", + "huggingface", + "hyperbolic", + "hyperbolic-quantized", + "inception", + "inceptron", + "inferact-vllm", + "inference-net", + "infermatic", + "inflection", + "inocloud", + "io-net", + "ionstream", + "klusterai", + "lambda", + "lepton", + "liquid", + "lynn", + "lynn-private", + "mancer", + "mancer-old", + "mara", + "meta", + "minimax", + "mistral", + "modal", + "modelrun", + "modular", + "moonshotai", + "morph", + "ncompass", + "nebius", + "nex-agi", + "nextbit", + "nineteen", + "novita", + "nvidia", + "octoai", + "open-inference", + "openai", + "parasail", + "perceptron", + "perplexity", + "phala", + "poolside", + "quiver", + "recraft", + "recursal", + "reflection", + "reka", + "relace", + "replicate", + "sakana", + "sambanova", + "sambanova-cloaked", + "seed", + "sf-compute", + "siliconflow", + "sourceful", + "stealth", + "stepfun", + "streamlake", + "switchpoint", + "targon", + "tenstorrent", + "together", + "together-lite", + "ubicloud", + "upstage", + "venice", + "wafer", + "wandb", + "xai", + "xiaomi", + "z-ai", + ] + ) + 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 + + +ImageGenerationProviderPreferencesOrderTypedDict = TypeAliasType( + "ImageGenerationProviderPreferencesOrderTypedDict", Union[ProviderName, str] +) + + +ImageGenerationProviderPreferencesOrder = TypeAliasType( + "ImageGenerationProviderPreferencesOrder", Union[ProviderName, str] +) + + +ImageGenerationProviderPreferencesSortTypedDict = TypeAliasType( + "ImageGenerationProviderPreferencesSortTypedDict", + Union[ProviderSortConfigTypedDict, ProviderSort, Any], +) +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + +ImageGenerationProviderPreferencesSort = TypeAliasType( + "ImageGenerationProviderPreferencesSort", + Union[ProviderSortConfig, ProviderSort, Any], +) +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + +class ImageGenerationProviderPreferencesTypedDict(TypedDict): + r"""Provider routing preferences and provider-specific passthrough configuration.""" + + allow_fallbacks: NotRequired[Nullable[bool]] + r"""Whether to allow backup providers to serve requests + - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + """ + ignore: NotRequired[ + Nullable[List[ImageGenerationProviderPreferencesIgnoreTypedDict]] + ] + r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" + only: NotRequired[Nullable[List[ImageGenerationProviderPreferencesOnlyTypedDict]]] + r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + options: NotRequired[ImageGenerationProviderPreferencesOptionsTypedDict] + order: NotRequired[Nullable[List[ImageGenerationProviderPreferencesOrderTypedDict]]] + r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + sort: NotRequired[Nullable[ImageGenerationProviderPreferencesSortTypedDict]] + r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + +class ImageGenerationProviderPreferences(BaseModel): + r"""Provider routing preferences and provider-specific passthrough configuration.""" + + allow_fallbacks: OptionalNullable[bool] = UNSET + r"""Whether to allow backup providers to serve requests + - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + """ + + ignore: OptionalNullable[List[ImageGenerationProviderPreferencesIgnore]] = UNSET + r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" + + only: OptionalNullable[List[ImageGenerationProviderPreferencesOnly]] = UNSET + r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + + options: Optional[ImageGenerationProviderPreferencesOptions] = None + + order: OptionalNullable[List[ImageGenerationProviderPreferencesOrder]] = UNSET + r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + + sort: OptionalNullable[ImageGenerationProviderPreferencesSort] = UNSET + r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["allow_fallbacks", "ignore", "only", "options", "order", "sort"] + ) + nullable_fields = set(["allow_fallbacks", "ignore", "only", "order", "sort"]) + 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 + + +try: + ImageGenerationProviderPreferencesOptions.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/imagegenerationrequest.py b/src/openrouter/components/imagegenerationrequest.py index 9866560..9f5f9ca 100644 --- a/src/openrouter/components/imagegenerationrequest.py +++ b/src/openrouter/components/imagegenerationrequest.py @@ -2,11 +2,14 @@ from __future__ import annotations from .contentpartimage import ContentPartImage, ContentPartImageTypedDict -from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr -import pydantic +from .imagegenerationproviderpreferences import ( + ImageGenerationProviderPreferences, + ImageGenerationProviderPreferencesTypedDict, +) +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer -from typing import Any, Dict, List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict ImageGenerationRequestAspectRatio = Union[ @@ -62,592 +65,6 @@ ImageGenerationRequestOutputFormat = Union[ r"""Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.""" -class ImageGenerationRequestOptionsTypedDict(TypedDict): - r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" - - oneai: NotRequired[Dict[str, Nullable[Any]]] - ai21: NotRequired[Dict[str, Nullable[Any]]] - aion_labs: NotRequired[Dict[str, Nullable[Any]]] - akashml: NotRequired[Dict[str, Nullable[Any]]] - alibaba: NotRequired[Dict[str, Nullable[Any]]] - amazon_bedrock: NotRequired[Dict[str, Nullable[Any]]] - amazon_nova: NotRequired[Dict[str, Nullable[Any]]] - ambient: NotRequired[Dict[str, Nullable[Any]]] - anthropic: NotRequired[Dict[str, Nullable[Any]]] - anyscale: NotRequired[Dict[str, Nullable[Any]]] - arcee_ai: NotRequired[Dict[str, Nullable[Any]]] - atlas_cloud: NotRequired[Dict[str, Nullable[Any]]] - atoma: NotRequired[Dict[str, Nullable[Any]]] - avian: NotRequired[Dict[str, Nullable[Any]]] - azure: NotRequired[Dict[str, Nullable[Any]]] - baidu: NotRequired[Dict[str, Nullable[Any]]] - baseten: NotRequired[Dict[str, Nullable[Any]]] - black_forest_labs: NotRequired[Dict[str, Nullable[Any]]] - byteplus: NotRequired[Dict[str, Nullable[Any]]] - centml: NotRequired[Dict[str, Nullable[Any]]] - cerebras: NotRequired[Dict[str, Nullable[Any]]] - chutes: NotRequired[Dict[str, Nullable[Any]]] - cirrascale: NotRequired[Dict[str, Nullable[Any]]] - clarifai: NotRequired[Dict[str, Nullable[Any]]] - cloudflare: NotRequired[Dict[str, Nullable[Any]]] - cohere: NotRequired[Dict[str, Nullable[Any]]] - crofai: NotRequired[Dict[str, Nullable[Any]]] - crucible: NotRequired[Dict[str, Nullable[Any]]] - crusoe: NotRequired[Dict[str, Nullable[Any]]] - darkbloom: NotRequired[Dict[str, Nullable[Any]]] - decart: NotRequired[Dict[str, Nullable[Any]]] - deepgram: NotRequired[Dict[str, Nullable[Any]]] - deepinfra: NotRequired[Dict[str, Nullable[Any]]] - deepseek: NotRequired[Dict[str, Nullable[Any]]] - dekallm: NotRequired[Dict[str, Nullable[Any]]] - digitalocean: NotRequired[Dict[str, Nullable[Any]]] - enfer: NotRequired[Dict[str, Nullable[Any]]] - fake_provider: NotRequired[Dict[str, Nullable[Any]]] - featherless: NotRequired[Dict[str, Nullable[Any]]] - fireworks: NotRequired[Dict[str, Nullable[Any]]] - friendli: NotRequired[Dict[str, Nullable[Any]]] - gmicloud: NotRequired[Dict[str, Nullable[Any]]] - google_ai_studio: NotRequired[Dict[str, Nullable[Any]]] - google_vertex: NotRequired[Dict[str, Nullable[Any]]] - gopomelo: NotRequired[Dict[str, Nullable[Any]]] - groq: NotRequired[Dict[str, Nullable[Any]]] - heygen: NotRequired[Dict[str, Nullable[Any]]] - huggingface: NotRequired[Dict[str, Nullable[Any]]] - hyperbolic: NotRequired[Dict[str, Nullable[Any]]] - hyperbolic_quantized: NotRequired[Dict[str, Nullable[Any]]] - inception: NotRequired[Dict[str, Nullable[Any]]] - inceptron: NotRequired[Dict[str, Nullable[Any]]] - inferact_vllm: NotRequired[Dict[str, Nullable[Any]]] - inference_net: NotRequired[Dict[str, Nullable[Any]]] - infermatic: NotRequired[Dict[str, Nullable[Any]]] - inflection: NotRequired[Dict[str, Nullable[Any]]] - inocloud: NotRequired[Dict[str, Nullable[Any]]] - io_net: NotRequired[Dict[str, Nullable[Any]]] - ionstream: NotRequired[Dict[str, Nullable[Any]]] - klusterai: NotRequired[Dict[str, Nullable[Any]]] - lambda_: NotRequired[Dict[str, Nullable[Any]]] - lepton: NotRequired[Dict[str, Nullable[Any]]] - liquid: NotRequired[Dict[str, Nullable[Any]]] - lynn: NotRequired[Dict[str, Nullable[Any]]] - lynn_private: NotRequired[Dict[str, Nullable[Any]]] - mancer: NotRequired[Dict[str, Nullable[Any]]] - mancer_old: NotRequired[Dict[str, Nullable[Any]]] - mara: NotRequired[Dict[str, Nullable[Any]]] - meta: NotRequired[Dict[str, Nullable[Any]]] - minimax: NotRequired[Dict[str, Nullable[Any]]] - mistral: NotRequired[Dict[str, Nullable[Any]]] - modal: NotRequired[Dict[str, Nullable[Any]]] - modelrun: NotRequired[Dict[str, Nullable[Any]]] - modular: NotRequired[Dict[str, Nullable[Any]]] - moonshotai: NotRequired[Dict[str, Nullable[Any]]] - morph: NotRequired[Dict[str, Nullable[Any]]] - ncompass: NotRequired[Dict[str, Nullable[Any]]] - nebius: NotRequired[Dict[str, Nullable[Any]]] - nex_agi: NotRequired[Dict[str, Nullable[Any]]] - nextbit: NotRequired[Dict[str, Nullable[Any]]] - nineteen: NotRequired[Dict[str, Nullable[Any]]] - novita: NotRequired[Dict[str, Nullable[Any]]] - nvidia: NotRequired[Dict[str, Nullable[Any]]] - octoai: NotRequired[Dict[str, Nullable[Any]]] - open_inference: NotRequired[Dict[str, Nullable[Any]]] - openai: NotRequired[Dict[str, Nullable[Any]]] - parasail: NotRequired[Dict[str, Nullable[Any]]] - perceptron: NotRequired[Dict[str, Nullable[Any]]] - perplexity: NotRequired[Dict[str, Nullable[Any]]] - phala: NotRequired[Dict[str, Nullable[Any]]] - poolside: NotRequired[Dict[str, Nullable[Any]]] - quiver: NotRequired[Dict[str, Nullable[Any]]] - recraft: NotRequired[Dict[str, Nullable[Any]]] - recursal: NotRequired[Dict[str, Nullable[Any]]] - reflection: NotRequired[Dict[str, Nullable[Any]]] - reka: NotRequired[Dict[str, Nullable[Any]]] - relace: NotRequired[Dict[str, Nullable[Any]]] - replicate: NotRequired[Dict[str, Nullable[Any]]] - sakana: NotRequired[Dict[str, Nullable[Any]]] - sambanova: NotRequired[Dict[str, Nullable[Any]]] - sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] - seed: NotRequired[Dict[str, Nullable[Any]]] - sf_compute: NotRequired[Dict[str, Nullable[Any]]] - siliconflow: NotRequired[Dict[str, Nullable[Any]]] - sourceful: NotRequired[Dict[str, Nullable[Any]]] - stealth: NotRequired[Dict[str, Nullable[Any]]] - stepfun: NotRequired[Dict[str, Nullable[Any]]] - streamlake: NotRequired[Dict[str, Nullable[Any]]] - switchpoint: NotRequired[Dict[str, Nullable[Any]]] - targon: NotRequired[Dict[str, Nullable[Any]]] - tenstorrent: NotRequired[Dict[str, Nullable[Any]]] - together: NotRequired[Dict[str, Nullable[Any]]] - together_lite: NotRequired[Dict[str, Nullable[Any]]] - ubicloud: NotRequired[Dict[str, Nullable[Any]]] - upstage: NotRequired[Dict[str, Nullable[Any]]] - venice: NotRequired[Dict[str, Nullable[Any]]] - wafer: NotRequired[Dict[str, Nullable[Any]]] - wandb: NotRequired[Dict[str, Nullable[Any]]] - xai: NotRequired[Dict[str, Nullable[Any]]] - xiaomi: NotRequired[Dict[str, Nullable[Any]]] - z_ai: NotRequired[Dict[str, Nullable[Any]]] - - -class ImageGenerationRequestOptions(BaseModel): - r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.""" - - oneai: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai") - ] = None - - ai21: Optional[Dict[str, Nullable[Any]]] = None - - aion_labs: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="aion-labs") - ] = None - - akashml: Optional[Dict[str, Nullable[Any]]] = None - - alibaba: Optional[Dict[str, Nullable[Any]]] = None - - amazon_bedrock: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-bedrock") - ] = None - - amazon_nova: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="amazon-nova") - ] = None - - ambient: Optional[Dict[str, Nullable[Any]]] = None - - anthropic: Optional[Dict[str, Nullable[Any]]] = None - - anyscale: Optional[Dict[str, Nullable[Any]]] = None - - arcee_ai: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="arcee-ai") - ] = None - - atlas_cloud: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="atlas-cloud") - ] = None - - atoma: Optional[Dict[str, Nullable[Any]]] = None - - avian: Optional[Dict[str, Nullable[Any]]] = None - - azure: Optional[Dict[str, Nullable[Any]]] = None - - baidu: Optional[Dict[str, Nullable[Any]]] = None - - baseten: Optional[Dict[str, Nullable[Any]]] = None - - black_forest_labs: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="black-forest-labs") - ] = None - - byteplus: Optional[Dict[str, Nullable[Any]]] = None - - centml: Optional[Dict[str, Nullable[Any]]] = None - - cerebras: Optional[Dict[str, Nullable[Any]]] = None - - chutes: Optional[Dict[str, Nullable[Any]]] = None - - cirrascale: Optional[Dict[str, Nullable[Any]]] = None - - clarifai: Optional[Dict[str, Nullable[Any]]] = None - - cloudflare: Optional[Dict[str, Nullable[Any]]] = None - - cohere: Optional[Dict[str, Nullable[Any]]] = None - - crofai: Optional[Dict[str, Nullable[Any]]] = None - - crucible: Optional[Dict[str, Nullable[Any]]] = None - - crusoe: Optional[Dict[str, Nullable[Any]]] = None - - darkbloom: Optional[Dict[str, Nullable[Any]]] = None - - decart: Optional[Dict[str, Nullable[Any]]] = None - - deepgram: Optional[Dict[str, Nullable[Any]]] = None - - deepinfra: Optional[Dict[str, Nullable[Any]]] = None - - deepseek: Optional[Dict[str, Nullable[Any]]] = None - - dekallm: Optional[Dict[str, Nullable[Any]]] = None - - digitalocean: Optional[Dict[str, Nullable[Any]]] = None - - enfer: Optional[Dict[str, Nullable[Any]]] = None - - fake_provider: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="fake-provider") - ] = None - - featherless: Optional[Dict[str, Nullable[Any]]] = None - - fireworks: Optional[Dict[str, Nullable[Any]]] = None - - friendli: Optional[Dict[str, Nullable[Any]]] = None - - gmicloud: Optional[Dict[str, Nullable[Any]]] = None - - google_ai_studio: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-ai-studio") - ] = None - - google_vertex: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="google-vertex") - ] = None - - gopomelo: Optional[Dict[str, Nullable[Any]]] = None - - groq: Optional[Dict[str, Nullable[Any]]] = None - - heygen: Optional[Dict[str, Nullable[Any]]] = None - - huggingface: Optional[Dict[str, Nullable[Any]]] = None - - hyperbolic: Optional[Dict[str, Nullable[Any]]] = None - - hyperbolic_quantized: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="hyperbolic-quantized") - ] = None - - inception: Optional[Dict[str, Nullable[Any]]] = None - - inceptron: Optional[Dict[str, Nullable[Any]]] = None - - inferact_vllm: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inferact-vllm") - ] = None - - inference_net: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="inference-net") - ] = None - - infermatic: Optional[Dict[str, Nullable[Any]]] = None - - inflection: Optional[Dict[str, Nullable[Any]]] = None - - inocloud: Optional[Dict[str, Nullable[Any]]] = None - - io_net: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="io-net") - ] = None - - ionstream: Optional[Dict[str, Nullable[Any]]] = None - - klusterai: Optional[Dict[str, Nullable[Any]]] = None - - lambda_: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lambda") - ] = None - - lepton: Optional[Dict[str, Nullable[Any]]] = None - - liquid: Optional[Dict[str, Nullable[Any]]] = None - - lynn: Optional[Dict[str, Nullable[Any]]] = None - - lynn_private: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="lynn-private") - ] = None - - mancer: Optional[Dict[str, Nullable[Any]]] = None - - mancer_old: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="mancer-old") - ] = None - - mara: Optional[Dict[str, Nullable[Any]]] = None - - meta: Optional[Dict[str, Nullable[Any]]] = None - - minimax: Optional[Dict[str, Nullable[Any]]] = None - - mistral: Optional[Dict[str, Nullable[Any]]] = None - - modal: Optional[Dict[str, Nullable[Any]]] = None - - modelrun: Optional[Dict[str, Nullable[Any]]] = None - - modular: Optional[Dict[str, Nullable[Any]]] = None - - moonshotai: Optional[Dict[str, Nullable[Any]]] = None - - morph: Optional[Dict[str, Nullable[Any]]] = None - - ncompass: Optional[Dict[str, Nullable[Any]]] = None - - nebius: Optional[Dict[str, Nullable[Any]]] = None - - nex_agi: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="nex-agi") - ] = None - - nextbit: Optional[Dict[str, Nullable[Any]]] = None - - nineteen: Optional[Dict[str, Nullable[Any]]] = None - - novita: Optional[Dict[str, Nullable[Any]]] = None - - nvidia: Optional[Dict[str, Nullable[Any]]] = None - - octoai: Optional[Dict[str, Nullable[Any]]] = None - - open_inference: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="open-inference") - ] = None - - openai: Optional[Dict[str, Nullable[Any]]] = None - - parasail: Optional[Dict[str, Nullable[Any]]] = None - - perceptron: Optional[Dict[str, Nullable[Any]]] = None - - perplexity: Optional[Dict[str, Nullable[Any]]] = None - - phala: Optional[Dict[str, Nullable[Any]]] = None - - poolside: Optional[Dict[str, Nullable[Any]]] = None - - quiver: Optional[Dict[str, Nullable[Any]]] = None - - recraft: Optional[Dict[str, Nullable[Any]]] = None - - recursal: Optional[Dict[str, Nullable[Any]]] = None - - reflection: Optional[Dict[str, Nullable[Any]]] = None - - reka: Optional[Dict[str, Nullable[Any]]] = None - - relace: Optional[Dict[str, Nullable[Any]]] = None - - replicate: Optional[Dict[str, Nullable[Any]]] = None - - sakana: Optional[Dict[str, Nullable[Any]]] = None - - sambanova: Optional[Dict[str, Nullable[Any]]] = None - - sambanova_cloaked: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sambanova-cloaked") - ] = None - - seed: Optional[Dict[str, Nullable[Any]]] = None - - sf_compute: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sf-compute") - ] = None - - siliconflow: Optional[Dict[str, Nullable[Any]]] = None - - sourceful: Optional[Dict[str, Nullable[Any]]] = None - - stealth: Optional[Dict[str, Nullable[Any]]] = None - - stepfun: Optional[Dict[str, Nullable[Any]]] = None - - streamlake: Optional[Dict[str, Nullable[Any]]] = None - - switchpoint: Optional[Dict[str, Nullable[Any]]] = None - - targon: Optional[Dict[str, Nullable[Any]]] = None - - tenstorrent: Optional[Dict[str, Nullable[Any]]] = None - - together: Optional[Dict[str, Nullable[Any]]] = None - - together_lite: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="together-lite") - ] = None - - ubicloud: Optional[Dict[str, Nullable[Any]]] = None - - upstage: Optional[Dict[str, Nullable[Any]]] = None - - venice: Optional[Dict[str, Nullable[Any]]] = None - - wafer: Optional[Dict[str, Nullable[Any]]] = None - - wandb: Optional[Dict[str, Nullable[Any]]] = None - - xai: Optional[Dict[str, Nullable[Any]]] = None - - xiaomi: Optional[Dict[str, Nullable[Any]]] = None - - z_ai: Annotated[ - Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="z-ai") - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "01ai", - "ai21", - "aion-labs", - "akashml", - "alibaba", - "amazon-bedrock", - "amazon-nova", - "ambient", - "anthropic", - "anyscale", - "arcee-ai", - "atlas-cloud", - "atoma", - "avian", - "azure", - "baidu", - "baseten", - "black-forest-labs", - "byteplus", - "centml", - "cerebras", - "chutes", - "cirrascale", - "clarifai", - "cloudflare", - "cohere", - "crofai", - "crucible", - "crusoe", - "darkbloom", - "decart", - "deepgram", - "deepinfra", - "deepseek", - "dekallm", - "digitalocean", - "enfer", - "fake-provider", - "featherless", - "fireworks", - "friendli", - "gmicloud", - "google-ai-studio", - "google-vertex", - "gopomelo", - "groq", - "heygen", - "huggingface", - "hyperbolic", - "hyperbolic-quantized", - "inception", - "inceptron", - "inferact-vllm", - "inference-net", - "infermatic", - "inflection", - "inocloud", - "io-net", - "ionstream", - "klusterai", - "lambda", - "lepton", - "liquid", - "lynn", - "lynn-private", - "mancer", - "mancer-old", - "mara", - "meta", - "minimax", - "mistral", - "modal", - "modelrun", - "modular", - "moonshotai", - "morph", - "ncompass", - "nebius", - "nex-agi", - "nextbit", - "nineteen", - "novita", - "nvidia", - "octoai", - "open-inference", - "openai", - "parasail", - "perceptron", - "perplexity", - "phala", - "poolside", - "quiver", - "recraft", - "recursal", - "reflection", - "reka", - "relace", - "replicate", - "sakana", - "sambanova", - "sambanova-cloaked", - "seed", - "sf-compute", - "siliconflow", - "sourceful", - "stealth", - "stepfun", - "streamlake", - "switchpoint", - "targon", - "tenstorrent", - "together", - "together-lite", - "ubicloud", - "upstage", - "venice", - "wafer", - "wandb", - "xai", - "xiaomi", - "z-ai", - ] - ) - 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 ImageGenerationRequestProviderTypedDict(TypedDict): - r"""Provider-specific passthrough configuration""" - - options: NotRequired[ImageGenerationRequestOptionsTypedDict] - - -class ImageGenerationRequestProvider(BaseModel): - r"""Provider-specific passthrough configuration""" - - options: Optional[ImageGenerationRequestOptions] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["options"]) - 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 - - ImageGenerationRequestQuality = Union[ Literal[ "auto", @@ -691,8 +108,8 @@ class ImageGenerationRequestTypedDict(TypedDict): r"""Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.""" output_format: NotRequired[ImageGenerationRequestOutputFormat] r"""Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.""" - provider: NotRequired[ImageGenerationRequestProviderTypedDict] - r"""Provider-specific passthrough configuration""" + provider: NotRequired[ImageGenerationProviderPreferencesTypedDict] + r"""Provider routing preferences and provider-specific passthrough configuration.""" quality: NotRequired[ImageGenerationRequestQuality] r"""Rendering quality. Providers without a quality knob ignore this.""" resolution: NotRequired[ImageGenerationRequestResolution] @@ -732,8 +149,8 @@ class ImageGenerationRequest(BaseModel): output_format: Optional[ImageGenerationRequestOutputFormat] = None r"""Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`.""" - provider: Optional[ImageGenerationRequestProvider] = None - r"""Provider-specific passthrough configuration""" + provider: Optional[ImageGenerationProviderPreferences] = None + r"""Provider routing preferences and provider-specific passthrough configuration.""" quality: Optional[ImageGenerationRequestQuality] = None r"""Rendering quality. Providers without a quality knob ignore this.""" @@ -780,9 +197,3 @@ class ImageGenerationRequest(BaseModel): m[k] = val return m - - -try: - ImageGenerationRequestOptions.model_rebuild() -except NameError: - pass diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py index abbb3cb..2d44eab 100644 --- a/src/openrouter/components/providerpreferences.py +++ b/src/openrouter/components/providerpreferences.py @@ -37,10 +37,14 @@ r"""Data collection setting. If no available model provider meets the requiremen """ -IgnoreTypedDict = TypeAliasType("IgnoreTypedDict", Union[ProviderName, str]) +ProviderPreferencesIgnoreTypedDict = TypeAliasType( + "ProviderPreferencesIgnoreTypedDict", Union[ProviderName, str] +) -Ignore = TypeAliasType("Ignore", Union[ProviderName, str]) +ProviderPreferencesIgnore = TypeAliasType( + "ProviderPreferencesIgnore", Union[ProviderName, str] +) class MaxPriceTypedDict(TypedDict): @@ -93,25 +97,36 @@ class MaxPrice(BaseModel): return m -OnlyTypedDict = TypeAliasType("OnlyTypedDict", Union[ProviderName, str]) +ProviderPreferencesOnlyTypedDict = TypeAliasType( + "ProviderPreferencesOnlyTypedDict", Union[ProviderName, str] +) -Only = TypeAliasType("Only", Union[ProviderName, str]) +ProviderPreferencesOnly = TypeAliasType( + "ProviderPreferencesOnly", Union[ProviderName, str] +) -OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str]) +ProviderPreferencesOrderTypedDict = TypeAliasType( + "ProviderPreferencesOrderTypedDict", Union[ProviderName, str] +) -Order = TypeAliasType("Order", Union[ProviderName, str]) +ProviderPreferencesOrder = TypeAliasType( + "ProviderPreferencesOrder", Union[ProviderName, str] +) -SortTypedDict = TypeAliasType( - "SortTypedDict", Union[ProviderSortConfigTypedDict, ProviderSort, Any] +ProviderPreferencesSortTypedDict = TypeAliasType( + "ProviderPreferencesSortTypedDict", + Union[ProviderSortConfigTypedDict, ProviderSort, Any], ) r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" -Sort = TypeAliasType("Sort", Union[ProviderSortConfig, ProviderSort, Any]) +ProviderPreferencesSort = TypeAliasType( + "ProviderPreferencesSort", Union[ProviderSortConfig, ProviderSort, Any] +) r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" @@ -132,13 +147,13 @@ class ProviderPreferencesTypedDict(TypedDict): """ enforce_distillable_text: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.""" - ignore: NotRequired[Nullable[List[IgnoreTypedDict]]] + ignore: NotRequired[Nullable[List[ProviderPreferencesIgnoreTypedDict]]] r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" max_price: NotRequired[MaxPriceTypedDict] r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - only: NotRequired[Nullable[List[OnlyTypedDict]]] + only: NotRequired[Nullable[List[ProviderPreferencesOnlyTypedDict]]] r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" - order: NotRequired[Nullable[List[OrderTypedDict]]] + order: NotRequired[Nullable[List[ProviderPreferencesOrderTypedDict]]] r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" preferred_max_latency: NotRequired[Nullable[PreferredMaxLatencyTypedDict]] r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" @@ -148,7 +163,7 @@ class ProviderPreferencesTypedDict(TypedDict): r"""A list of quantization levels to filter the provider by.""" require_parameters: NotRequired[Nullable[bool]] r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" - sort: NotRequired[Nullable[SortTypedDict]] + sort: NotRequired[Nullable[ProviderPreferencesSortTypedDict]] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" zdr: NotRequired[Nullable[bool]] r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" @@ -174,16 +189,16 @@ class ProviderPreferences(BaseModel): enforce_distillable_text: OptionalNullable[bool] = UNSET r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.""" - ignore: OptionalNullable[List[Ignore]] = UNSET + ignore: OptionalNullable[List[ProviderPreferencesIgnore]] = UNSET r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" max_price: Optional[MaxPrice] = None r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - only: OptionalNullable[List[Only]] = UNSET + only: OptionalNullable[List[ProviderPreferencesOnly]] = UNSET r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" - order: OptionalNullable[List[Order]] = UNSET + order: OptionalNullable[List[ProviderPreferencesOrder]] = UNSET r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" preferred_max_latency: OptionalNullable[PreferredMaxLatency] = UNSET @@ -198,7 +213,7 @@ class ProviderPreferences(BaseModel): require_parameters: OptionalNullable[bool] = UNSET r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" - sort: OptionalNullable[Sort] = UNSET + sort: OptionalNullable[ProviderPreferencesSort] = UNSET r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" zdr: OptionalNullable[bool] = UNSET diff --git a/src/openrouter/images.py b/src/openrouter/images.py index b7a120a..8a3080f 100644 --- a/src/openrouter/images.py +++ b/src/openrouter/images.py @@ -34,8 +34,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -67,7 +67,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -101,8 +101,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -134,7 +134,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -168,8 +168,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -204,7 +204,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -237,8 +237,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -273,7 +273,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -310,7 +310,7 @@ class Images(BaseSDK): output_format=output_format, prompt=prompt, provider=utils.get_pydantic_model( - provider, Optional[components.ImageGenerationRequestProvider] + provider, Optional[components.ImageGenerationProviderPreferences] ), quality=quality, resolution=resolution, @@ -514,8 +514,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -547,7 +547,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -581,8 +581,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -614,7 +614,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -648,8 +648,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -684,7 +684,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -717,8 +717,8 @@ class Images(BaseSDK): output_format: Optional[components.ImageGenerationRequestOutputFormat] = None, provider: Optional[ Union[ - components.ImageGenerationRequestProvider, - components.ImageGenerationRequestProviderTypedDict, + components.ImageGenerationProviderPreferences, + components.ImageGenerationProviderPreferencesTypedDict, ] ] = None, quality: Optional[components.ImageGenerationRequestQuality] = None, @@ -753,7 +753,7 @@ class Images(BaseSDK): :param n: Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. :param output_compression: Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. :param output_format: Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. - :param provider: Provider-specific passthrough configuration + :param provider: Provider routing preferences and provider-specific passthrough configuration. :param quality: Rendering quality. Providers without a quality knob ignore this. :param resolution: Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. :param seed: If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. @@ -790,7 +790,7 @@ class Images(BaseSDK): output_format=output_format, prompt=prompt, provider=utils.get_pydantic_model( - provider, Optional[components.ImageGenerationRequestProvider] + provider, Optional[components.ImageGenerationProviderPreferences] ), quality=quality, resolution=resolution, diff --git a/uv.lock b/uv.lock index fa772e2..07279f2 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.24" +version = "0.11.25" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 8016b1528409915160d81c1fb6ce1ca570cadb0f Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 19:26:12 +0000 Subject: [PATCH 47/62] chore: update OpenAPI spec from monorepo (#439) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index da4a7e7..95b2e22 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -18394,6 +18394,44 @@ components: required: - type type: object + PricingOverride: + description: >- + A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. + min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys + absent from an entry inherit the base price. + example: + completion: '0.00002' + min_prompt_tokens: 200000 + prompt: '0.000005' + properties: + audio: + description: Overridden price in USD per audio input token + type: string + completion: + description: Overridden price in USD per token for completion (output) generation + type: string + input_audio_cache: + description: Overridden price in USD per cached audio input token + type: string + input_cache_read: + description: Overridden price in USD per cached input token (read) + type: string + input_cache_write: + description: Overridden price in USD per cache-write token + type: string + input_cache_write_1h: + description: Overridden price in USD per 1-hour cache-write token + type: string + min_prompt_tokens: + description: >- + Condition: the entry applies when the total prompt tokens of a request are strictly greater than this + threshold + format: double + type: number + prompt: + description: Overridden price in USD per token for prompt (input) processing + type: string + type: object PromptCacheBreakpoint: description: >- Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker @@ -19513,6 +19551,15 @@ components: internal_reasoning: description: Price in USD per internal reasoning token type: string + overrides: + description: >- + Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its + condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win + per key; price keys absent from an entry inherit the base price. The top-level pricing keys always + reflect the price that applies under default conditions. + items: + $ref: '#/components/schemas/PricingOverride' + type: array prompt: description: Price in USD per token for prompt (input) processing type: string @@ -19637,6 +19684,15 @@ components: internal_reasoning: description: Price in USD per internal reasoning token type: string + overrides: + description: >- + Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its + condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per + key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the + price that applies under default conditions. + items: + $ref: '#/components/schemas/PricingOverride' + type: array prompt: description: Price in USD per token for prompt (input) processing type: string From f24188c135340bc4edea00f9eb4bb056b03476d4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 19:31:52 +0000 Subject: [PATCH 48/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.26=20(#440)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 55 ++++++++----- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 47 +++++++++++ .speakeasy/workflow.lock | 10 +-- RELEASES.md | 12 ++- docs/components/pricing.mdx | 35 +++++---- docs/components/pricingoverride.mdx | 19 +++++ docs/components/publicpricing.mdx | 35 +++++---- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 5 ++ src/openrouter/components/pricingoverride.py | 83 ++++++++++++++++++++ src/openrouter/components/publicendpoint.py | 7 ++ src/openrouter/components/publicpricing.py | 9 ++- uv.lock | 2 +- 15 files changed, 260 insertions(+), 67 deletions(-) create mode 100644 docs/components/pricingoverride.mdx create mode 100644 src/openrouter/components/pricingoverride.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1fdb3f1..aa027bc 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: a444511ee53d41b62d62b2d23ddd3b64 + docChecksum: 7263f7a45045933c0fa87b21e7e6fd9b docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.25 - configChecksum: b10f43281932fd64b0c43f8577a40816 + releaseVersion: 0.11.26 + configChecksum: 2a949e81cf5d40ef993b72355e7e75eb repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 554b7889-8ccd-4aef-a14b-c347df957007 - pristine_commit_hash: 95be3ea8a18d40e9df231449f23161356fdfd5ff - pristine_tree_hash: e9b22615b85a97ffd1078604414fc174d55b227f + generation_id: 7695231f-3e30-4c88-921a-f9175c463593 + pristine_commit_hash: 5ccb0c48efa3160204f8671518dd705cc930a0a7 + pristine_tree_hash: 111ea5b13d73fd98a6d6c24a7a46a513a3104a9c features: python: acceptHeaders: 3.0.0 @@ -3886,8 +3886,12 @@ trackedFiles: pristine_git_object: 3d340325d192b54a5d039336cce2bd35d12445ac docs/components/pricing.mdx: id: 6816d700f8b1 - last_write_checksum: sha1:ac5c56af4e56eb98da5686e33a224950dfbb8207 - pristine_git_object: 78ac34b5053103dc4261c2fbeb9833f97ef109db + last_write_checksum: sha1:c9f49a270c1ddcaf2b354b2c0f7ceb277ca5eff4 + pristine_git_object: 0ca9bdf9bf2b1909a4a78e99b58fde78b311becd + docs/components/pricingoverride.mdx: + id: 74675f38c1c6 + last_write_checksum: sha1:5e64e9edbb013f04ee3741fe7c5dbd2fa54b544b + pristine_git_object: f8291256ac4a4aeed8bf79f1bad1e3b45cbaa354 docs/components/promptcachebreakpoint.mdx: id: c135956dc623 last_write_checksum: sha1:1b0c9884eb9b6fe1d4fdf822c75cb566ead67e07 @@ -3966,8 +3970,8 @@ trackedFiles: pristine_git_object: 4498d08fd82f26a210eeed2b9659e6a0b321f9ef docs/components/publicpricing.mdx: id: 61fb18b7ff94 - last_write_checksum: sha1:41c3b03c9eb4883d41e128e1b2d549ddb608c317 - pristine_git_object: 0d8f6cf2cca158ec93dd8afdc29c0cb377053fbd + last_write_checksum: sha1:53550f414931189b91a148ca9039aefb5899a7ee + pristine_git_object: 4a17b2b3dd05ea85ea9847689c13692540007f07 docs/components/quantization.mdx: id: 9d062e4ee362 last_write_checksum: sha1:4cb3588933fe1ca8592669f8ec1bef1cf0986e28 @@ -6658,8 +6662,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:ecba4ec7fe5c538617fb6e42582204ae5711d106 - pristine_git_object: 6804383f389474f6b72740ce0a281ba45ed8251d + last_write_checksum: sha1:a62f150fb014bd2f019526c2847cab9afcd90648 + pristine_git_object: bcd7637f7dd41ea5aa8e3374fbafe096f1d44c11 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6686,8 +6690,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:a776602f2cf82d2f44e51bbbd69dfeee7a7f46f3 - pristine_git_object: d272f6c0b2f426b678e025f6181287b08ea995ed + last_write_checksum: sha1:806eecfbfbd9862cf0fb64efad4b401f93c78e3e + pristine_git_object: b634472cdb3fe62a8422bdd27d30a770bdf652a2 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6726,8 +6730,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:045cf74eb4e03399ac8521ff3db0a2ed9f33b002 - pristine_git_object: 43900430f099cab065756d44e23f9c4118c99180 + last_write_checksum: sha1:5208f1af2c3420c74d0a23810dcf68807b95a130 + pristine_git_object: 92d0e11add040db79f1848e7f697605a0b2e129c src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -8344,6 +8348,10 @@ trackedFiles: id: 40414eada27a last_write_checksum: sha1:0e241830bf9014e8ea814465c573711d8a7caa2c pristine_git_object: 90bdb267893360608210843a5da0d5d68e80d41e + src/openrouter/components/pricingoverride.py: + id: 8984e4cc7422 + last_write_checksum: sha1:0e2c06a0d510bb2fcf64b03f74c693f26c9825ad + pristine_git_object: 21c25933126937fe7c1d10898a42bbe711cf7b9f src/openrouter/components/promptcachebreakpoint.py: id: f1e589a13300 last_write_checksum: sha1:458ef5170c7c9ea1367dcfb090b1b28333aff73d @@ -8386,12 +8394,12 @@ trackedFiles: pristine_git_object: 1798ae9dd8c2e4b629bb99cc5c643827895e8231 src/openrouter/components/publicendpoint.py: id: 848aa2ef9129 - last_write_checksum: sha1:d8788cb95c89974e6339ecaccc6202dfae871225 - pristine_git_object: 270a46db728bbf80ab3c89fde25d71c61f93434e + last_write_checksum: sha1:a94a8a30e3656955780285fa004a2b7e5d162c57 + pristine_git_object: b647b5f88242565b228e6d0bf11d151e6650f6f8 src/openrouter/components/publicpricing.py: id: 96d115d83cc5 - last_write_checksum: sha1:41f834b27573c1f621c99883d27e231a1384c846 - pristine_git_object: fc3f2cdb028345dbeda1c0a6a1493647286f1cc9 + last_write_checksum: sha1:a3733ee6d92eda73562ea1fa2bc834e3a14ac6db + pristine_git_object: 037f4b4e9aa72510a4021e695fe39516eb88d1f3 src/openrouter/components/quantization.py: id: bde317b3d703 last_write_checksum: sha1:96b042899bfb818f20d282be76ad37fc948a599d @@ -11131,4 +11139,9 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.images.generate()`: `request.provider` **Changed** + * `open_router.embeddings.list_models()`: `response.data[].pricing.overrides` **Added** + * `open_router.endpoints.list_zdr_endpoints()`: `response.data[].pricing.overrides` **Added** + * `open_router.endpoints.list()`: `response.data.endpoints[].pricing.overrides` **Added** + * `open_router.models.get()`: `response.data.pricing.overrides` **Added** + * `open_router.models.list()`: `response.data[].pricing.overrides` **Added** + * `open_router.models.list_for_user()`: `response.data[].pricing.overrides` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 46c1783..465bed5 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.25 + version: 0.11.26 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index e340148..dd88871 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -18289,6 +18289,41 @@ components: required: - type type: object + PricingOverride: + description: >- + A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. + example: + completion: '0.00002' + min_prompt_tokens: 200000 + prompt: '0.000005' + properties: + audio: + description: Overridden price in USD per audio input token + type: string + completion: + description: Overridden price in USD per token for completion (output) generation + type: string + input_audio_cache: + description: Overridden price in USD per cached audio input token + type: string + input_cache_read: + description: Overridden price in USD per cached input token (read) + type: string + input_cache_write: + description: Overridden price in USD per cache-write token + type: string + input_cache_write_1h: + description: Overridden price in USD per 1-hour cache-write token + type: string + min_prompt_tokens: + description: >- + Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold + format: double + type: number + prompt: + description: Overridden price in USD per token for prompt (input) processing + type: string + type: object PromptCacheBreakpoint: description: >- Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. @@ -19397,6 +19432,12 @@ components: internal_reasoning: description: Price in USD per internal reasoning token type: string + overrides: + description: >- + Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. + items: + $ref: '#/components/schemas/PricingOverride' + type: array prompt: description: Price in USD per token for prompt (input) processing type: string @@ -19514,6 +19555,12 @@ components: internal_reasoning: description: Price in USD per internal reasoning token type: string + overrides: + description: >- + Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. + items: + $ref: '#/components/schemas/PricingOverride' + type: array prompt: description: Price in USD per token for prompt (input) processing type: string diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 650819f..a710c77 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:c4b604e524d65fc80cad85d0620c391b70d087ed384bbb1ed03166267524ec3d - sourceBlobDigest: sha256:59fc42341a3b4ae0f2344e88df306b70fb85b526e84e1c274c006afb7d99153b + sourceRevisionDigest: sha256:9f8353c6af76d729784ad0e73d4c232043cf6f308a01acd3975ec748a1751559 + sourceBlobDigest: sha256:d2e958ad60806d999cd37686274fff162f0dd4e52954a1edb49f19e037eeda6e tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:c4b604e524d65fc80cad85d0620c391b70d087ed384bbb1ed03166267524ec3d - sourceBlobDigest: sha256:59fc42341a3b4ae0f2344e88df306b70fb85b526e84e1c274c006afb7d99153b + sourceRevisionDigest: sha256:9f8353c6af76d729784ad0e73d4c232043cf6f308a01acd3975ec748a1751559 + sourceBlobDigest: sha256:d2e958ad60806d999cd37686274fff162f0dd4e52954a1edb49f19e037eeda6e codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:b959c03fc95af18ab71b3e8edc54d3a74d06d0a3f0d786576f3ab1a1c049cdd0 + codeSamplesRevisionDigest: sha256:f68472bc77963d676f750b164b9991d49fc9b394fb05f7aba9907616cdaa54b1 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index ab81e86..630044f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -358,4 +358,14 @@ Based on: ### Generated - [python v0.11.25] . ### Releases -- [PyPI v0.11.25] https://pypi.org/project/openrouter/0.11.25 - . \ No newline at end of file +- [PyPI v0.11.25] https://pypi.org/project/openrouter/0.11.25 - . + +## 2026-07-13 19:27:34 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.26] . +### Releases +- [PyPI v0.11.26] https://pypi.org/project/openrouter/0.11.26 - . \ No newline at end of file diff --git a/docs/components/pricing.mdx b/docs/components/pricing.mdx index 78ac34b..0ca9bdf 100644 --- a/docs/components/pricing.mdx +++ b/docs/components/pricing.mdx @@ -4,20 +4,21 @@ title: "Pricing" ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | -| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | -| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | -| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | -| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | -| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | +| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | +| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | +| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | +| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | +| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | +| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file diff --git a/docs/components/pricingoverride.mdx b/docs/components/pricingoverride.mdx new file mode 100644 index 0000000..f829125 --- /dev/null +++ b/docs/components/pricingoverride.mdx @@ -0,0 +1,19 @@ +--- +title: "PricingOverride" +--- + +A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per audio input token | +| `completion` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for completion (output) generation | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cache-write token | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per 1-hour cache-write token | +| `min_prompt_tokens` | *Optional[float]* | :heavy_minus_sign: | Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for prompt (input) processing | \ No newline at end of file diff --git a/docs/components/publicpricing.mdx b/docs/components/publicpricing.mdx index 0d8f6cf..4a17b2b 100644 --- a/docs/components/publicpricing.mdx +++ b/docs/components/publicpricing.mdx @@ -7,20 +7,21 @@ Pricing information for the model ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | -| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | -| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | -| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | -| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | -| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | +| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | +| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | +| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | +| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | +| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | +| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6804383..bcd7637 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.25" +version = "0.11.26" 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 d272f6c..b634472 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.25" +__version__: str = "0.11.26" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.25 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.26 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 4390043..92d0e11 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -2203,6 +2203,7 @@ if TYPE_CHECKING: PreviewWebSearchUserLocationType, PreviewWebSearchUserLocationTypedDict, ) + from .pricingoverride import PricingOverride, PricingOverrideTypedDict from .promptcachebreakpoint import ( PromptCacheBreakpoint, PromptCacheBreakpointMode, @@ -4346,6 +4347,8 @@ __all__ = [ "PreviewWebSearchUserLocationTypedDict", "PriceSource", "Pricing", + "PricingOverride", + "PricingOverrideTypedDict", "PricingTypedDict", "PromptCacheBreakpoint", "PromptCacheBreakpointMode", @@ -6542,6 +6545,8 @@ _dynamic_imports: dict[str, str] = { "PreviewWebSearchUserLocation": ".preview_websearchuserlocation", "PreviewWebSearchUserLocationType": ".preview_websearchuserlocation", "PreviewWebSearchUserLocationTypedDict": ".preview_websearchuserlocation", + "PricingOverride": ".pricingoverride", + "PricingOverrideTypedDict": ".pricingoverride", "PromptCacheBreakpoint": ".promptcachebreakpoint", "PromptCacheBreakpointMode": ".promptcachebreakpoint", "PromptCacheBreakpointTypedDict": ".promptcachebreakpoint", diff --git a/src/openrouter/components/pricingoverride.py b/src/openrouter/components/pricingoverride.py new file mode 100644 index 0000000..21c2593 --- /dev/null +++ b/src/openrouter/components/pricingoverride.py @@ -0,0 +1,83 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class PricingOverrideTypedDict(TypedDict): + r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" + + audio: NotRequired[str] + r"""Overridden price in USD per audio input token""" + completion: NotRequired[str] + r"""Overridden price in USD per token for completion (output) generation""" + input_audio_cache: NotRequired[str] + r"""Overridden price in USD per cached audio input token""" + input_cache_read: NotRequired[str] + r"""Overridden price in USD per cached input token (read)""" + input_cache_write: NotRequired[str] + r"""Overridden price in USD per cache-write token""" + input_cache_write_1h: NotRequired[str] + r"""Overridden price in USD per 1-hour cache-write token""" + min_prompt_tokens: NotRequired[float] + r"""Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold""" + prompt: NotRequired[str] + r"""Overridden price in USD per token for prompt (input) processing""" + + +class PricingOverride(BaseModel): + r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" + + audio: Optional[str] = None + r"""Overridden price in USD per audio input token""" + + completion: Optional[str] = None + r"""Overridden price in USD per token for completion (output) generation""" + + input_audio_cache: Optional[str] = None + r"""Overridden price in USD per cached audio input token""" + + input_cache_read: Optional[str] = None + r"""Overridden price in USD per cached input token (read)""" + + input_cache_write: Optional[str] = None + r"""Overridden price in USD per cache-write token""" + + input_cache_write_1h: Optional[str] = None + r"""Overridden price in USD per 1-hour cache-write token""" + + min_prompt_tokens: Optional[float] = None + r"""Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold""" + + prompt: Optional[str] = None + r"""Overridden price in USD per token for prompt (input) processing""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "audio", + "completion", + "input_audio_cache", + "input_cache_read", + "input_cache_write", + "input_cache_write_1h", + "min_prompt_tokens", + "prompt", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + 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/publicendpoint.py b/src/openrouter/components/publicendpoint.py index 270a46d..b647b5f 100644 --- a/src/openrouter/components/publicendpoint.py +++ b/src/openrouter/components/publicendpoint.py @@ -4,6 +4,7 @@ from __future__ import annotations from .endpointstatus import EndpointStatus from .parameter import Parameter from .percentilestats import PercentileStats, PercentileStatsTypedDict +from .pricingoverride import PricingOverride, PricingOverrideTypedDict from .providername import ProviderName from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer @@ -38,6 +39,8 @@ class PricingTypedDict(TypedDict): r"""Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic.""" internal_reasoning: NotRequired[str] r"""Price in USD per internal reasoning token""" + overrides: NotRequired[List[PricingOverrideTypedDict]] + r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: NotRequired[str] r"""Price in USD per request""" web_search: NotRequired[str] @@ -84,6 +87,9 @@ class Pricing(BaseModel): internal_reasoning: Optional[str] = None r"""Price in USD per internal reasoning token""" + overrides: Optional[List[PricingOverride]] = None + r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + request: Optional[str] = None r"""Price in USD per request""" @@ -105,6 +111,7 @@ class Pricing(BaseModel): "input_cache_write", "input_cache_write_1h", "internal_reasoning", + "overrides", "request", "web_search", ] diff --git a/src/openrouter/components/publicpricing.py b/src/openrouter/components/publicpricing.py index fc3f2cd..037f4b4 100644 --- a/src/openrouter/components/publicpricing.py +++ b/src/openrouter/components/publicpricing.py @@ -1,9 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .pricingoverride import PricingOverride, PricingOverrideTypedDict from openrouter.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer -from typing import Optional +from typing import List, Optional from typing_extensions import NotRequired, TypedDict @@ -36,6 +37,8 @@ class PublicPricingTypedDict(TypedDict): r"""Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic.""" internal_reasoning: NotRequired[str] r"""Price in USD per internal reasoning token""" + overrides: NotRequired[List[PricingOverrideTypedDict]] + r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: NotRequired[str] r"""Price in USD per request""" web_search: NotRequired[str] @@ -84,6 +87,9 @@ class PublicPricing(BaseModel): internal_reasoning: Optional[str] = None r"""Price in USD per internal reasoning token""" + overrides: Optional[List[PricingOverride]] = None + r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + request: Optional[str] = None r"""Price in USD per request""" @@ -105,6 +111,7 @@ class PublicPricing(BaseModel): "input_cache_write", "input_cache_write_1h", "internal_reasoning", + "overrides", "request", "web_search", ] diff --git a/uv.lock b/uv.lock index 07279f2..948a29c 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.25" +version = "0.11.26" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 34860d82a2279c74c20984ba468e0aa94256e82f Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 20:41:14 +0000 Subject: [PATCH 49/62] chore: update OpenAPI spec from monorepo (#441) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 95b2e22..a28f8f6 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -31456,8 +31456,7 @@ paths: schema: description: Minimum context length (tokens). Models with smaller context are excluded. example: 128000 - exclusiveMinimum: true - minimum: 0 + minimum: 1 type: integer - description: Minimum prompt price in $/M tokens. in: query From 94d68f3b3c4562d9676ac791921e9205731b7bd2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 20:47:04 +0000 Subject: [PATCH 50/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.27=20(#442)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 28 ++++++++++------------------ .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 3 +-- .speakeasy/workflow.lock | 10 +++++----- RELEASES.md | 12 +++++++++++- pyproject.toml | 2 +- src/openrouter/_version.py | 4 ++-- uv.lock | 2 +- 8 files changed, 32 insertions(+), 31 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index aa027bc..1454812 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: 7263f7a45045933c0fa87b21e7e6fd9b + docChecksum: 4c1de84906249adffa68289b1272a337 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.26 - configChecksum: 2a949e81cf5d40ef993b72355e7e75eb + releaseVersion: 0.11.27 + configChecksum: 8c481cc9a577b723dec23a1acb6acd44 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 7695231f-3e30-4c88-921a-f9175c463593 - pristine_commit_hash: 5ccb0c48efa3160204f8671518dd705cc930a0a7 - pristine_tree_hash: 111ea5b13d73fd98a6d6c24a7a46a513a3104a9c + generation_id: 29d14705-a7a0-4678-9a14-db322b73e2e9 + pristine_commit_hash: 604984950189ec77e6d3e0907500b9a36193139a + pristine_tree_hash: ac64da59d036426e6a5253061a7139a4a12fd118 features: python: acceptHeaders: 3.0.0 @@ -6662,8 +6662,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:a62f150fb014bd2f019526c2847cab9afcd90648 - pristine_git_object: bcd7637f7dd41ea5aa8e3374fbafe096f1d44c11 + last_write_checksum: sha1:422b5cabaf16017ad5a03653f1cebc804d1b084d + pristine_git_object: feee6a6c23e707d2c4e75602176b723657b31a41 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6690,8 +6690,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:806eecfbfbd9862cf0fb64efad4b401f93c78e3e - pristine_git_object: b634472cdb3fe62a8422bdd27d30a770bdf652a2 + last_write_checksum: sha1:492ccf71ca935892090ce4ccb5391ff14fa90596 + pristine_git_object: d00a5fa67b4b8b39352d9b6491b1854749529f2f src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -11137,11 +11137,3 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.embeddings.list_models()`: `response.data[].pricing.overrides` **Added** - * `open_router.endpoints.list_zdr_endpoints()`: `response.data[].pricing.overrides` **Added** - * `open_router.endpoints.list()`: `response.data.endpoints[].pricing.overrides` **Added** - * `open_router.models.get()`: `response.data.pricing.overrides` **Added** - * `open_router.models.list()`: `response.data[].pricing.overrides` **Added** - * `open_router.models.list_for_user()`: `response.data[].pricing.overrides` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 465bed5..9530cc2 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.26 + version: 0.11.27 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index dd88871..8ba1dfe 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -31265,8 +31265,7 @@ paths: schema: description: Minimum context length (tokens). Models with smaller context are excluded. example: 128000 - exclusiveMinimum: true - minimum: 0 + minimum: 1 type: integer - description: Minimum prompt price in $/M tokens. in: query diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index a710c77..3dc3983 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:9f8353c6af76d729784ad0e73d4c232043cf6f308a01acd3975ec748a1751559 - sourceBlobDigest: sha256:d2e958ad60806d999cd37686274fff162f0dd4e52954a1edb49f19e037eeda6e + sourceRevisionDigest: sha256:6bb42dab7b8c3a170da9cf40c9b52e39be0e93776f2ea0aaa6d806562290594c + sourceBlobDigest: sha256:e2a84cbdb9e0e9e83a48aa80f44d1ae9ad3ef37d469ee705e9409017c065aaa5 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:9f8353c6af76d729784ad0e73d4c232043cf6f308a01acd3975ec748a1751559 - sourceBlobDigest: sha256:d2e958ad60806d999cd37686274fff162f0dd4e52954a1edb49f19e037eeda6e + sourceRevisionDigest: sha256:6bb42dab7b8c3a170da9cf40c9b52e39be0e93776f2ea0aaa6d806562290594c + sourceBlobDigest: sha256:e2a84cbdb9e0e9e83a48aa80f44d1ae9ad3ef37d469ee705e9409017c065aaa5 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f68472bc77963d676f750b164b9991d49fc9b394fb05f7aba9907616cdaa54b1 + codeSamplesRevisionDigest: sha256:620d78e3bc22a91a122ed5516d1800440ee7551693a8bc91d3dcaeefec334c50 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 630044f..260f7c0 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -368,4 +368,14 @@ Based on: ### Generated - [python v0.11.26] . ### Releases -- [PyPI v0.11.26] https://pypi.org/project/openrouter/0.11.26 - . \ No newline at end of file +- [PyPI v0.11.26] https://pypi.org/project/openrouter/0.11.26 - . + +## 2026-07-13 20:42:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.27] . +### Releases +- [PyPI v0.11.27] https://pypi.org/project/openrouter/0.11.27 - . \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bcd7637..feee6a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.26" +version = "0.11.27" 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 b634472..d00a5fa 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.26" +__version__: str = "0.11.27" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.26 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.27 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/uv.lock b/uv.lock index 948a29c..b0cfa15 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.26" +version = "0.11.27" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 7d438092bbc86148d97595c8e2705bb3ea353ade Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 05:33:48 +0000 Subject: [PATCH 51/62] chore: update OpenAPI spec from monorepo (#443) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index a28f8f6..b48d1e4 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -9992,6 +9992,8 @@ components: prompt_tokens: 0 total_tokens: 4175 properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' completion_tokens: description: The tokens generated type: integer @@ -11939,6 +11941,8 @@ components: type: string usage: properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' cache_creation_input_tokens: nullable: true type: integer From 52ad7dde44f878d52233e8034c791d1e11eaf1dc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 05:39:15 +0000 Subject: [PATCH 52/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.28=20(#444)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 43 ++++++++++++------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 4 ++ .speakeasy/workflow.lock | 10 ++--- RELEASES.md | 12 +++++- docs/components/anthropiccachecreation.mdx | 10 +++++ docs/components/imagegenerationusage.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 8 ++++ .../components/anthropiccachecreation.py | 16 +++++++ .../components/imagegenerationusage.py | 9 ++++ uv.lock | 2 +- 13 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 docs/components/anthropiccachecreation.mdx create mode 100644 src/openrouter/components/anthropiccachecreation.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1454812..fa92dd7 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: 4c1de84906249adffa68289b1272a337 + docChecksum: 913314e7b77524966693bb56c9a3dd24 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.27 - configChecksum: 8c481cc9a577b723dec23a1acb6acd44 + releaseVersion: 0.11.28 + configChecksum: ce48138720beb4eb8841b187c03d254f repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 29d14705-a7a0-4678-9a14-db322b73e2e9 - pristine_commit_hash: 604984950189ec77e6d3e0907500b9a36193139a - pristine_tree_hash: ac64da59d036426e6a5253061a7139a4a12fd118 + generation_id: e656f374-a717-4315-90c0-6ee70ed0cf9c + pristine_commit_hash: 3d5b10a16d484690e232f230a59576340aa52303 + pristine_tree_hash: f9fc6333f4a8952a56a6ca33eb92a50cc9b98d90 features: python: acceptHeaders: 3.0.0 @@ -244,6 +244,10 @@ trackedFiles: id: f047a00a8826 last_write_checksum: sha1:7731c7cecebc8d0ea5d779a811809d4d570ed7c1 pristine_git_object: bd3e799f85c07638dff4daf50d361bc718c47b0f + docs/components/anthropiccachecreation.mdx: + id: 76d410a5e73e + last_write_checksum: sha1:3b9e3d49c378acbdada5129434dc5e469ff0137f + pristine_git_object: c9562a64e41c396aee705ef025650900df0b43e4 docs/components/anthropiccitationcharlocationparam.mdx: id: c40e539e0fb1 last_write_checksum: sha1:bf7cb3fdf2b38b00e4b026e7c0304d9e308cbb75 @@ -2230,8 +2234,8 @@ trackedFiles: pristine_git_object: cabf0cccfa7d7bee9faa823d66650bc395220966 docs/components/imagegenerationusage.mdx: id: 0f8faafc5148 - last_write_checksum: sha1:be2ebcd80f3299ec6e38bf8c580ac5e28ba67d85 - pristine_git_object: be9fe8ffa3ea8829bf61cbbdcfd5f1a17aad439d + last_write_checksum: sha1:7662a98019e0fb829b124d14f938ee07f5ef5519 + pristine_git_object: cb01cf31c16ba5f1caea0be6b376e83ee0d82b59 docs/components/imagegenerationusagecompletiontokensdetails.mdx: id: 71ecb25e164d last_write_checksum: sha1:f0843acffd7d7540b07bb384f299557e7309950d @@ -6662,8 +6666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:422b5cabaf16017ad5a03653f1cebc804d1b084d - pristine_git_object: feee6a6c23e707d2c4e75602176b723657b31a41 + last_write_checksum: sha1:04c19e27f55c549187e8134f7ff3696cd428f3df + pristine_git_object: 38e011e2029916eabc14394ca864b6516da19017 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6690,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:492ccf71ca935892090ce4ccb5391ff14fa90596 - pristine_git_object: d00a5fa67b4b8b39352d9b6491b1854749529f2f + last_write_checksum: sha1:fd94190abbfad4aff1ecc18a06a3b466ddd7c2b8 + pristine_git_object: fb15497c9ae07185c9379f5151156e976ce297f5 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6730,8 +6734,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:5208f1af2c3420c74d0a23810dcf68807b95a130 - pristine_git_object: 92d0e11add040db79f1848e7f697605a0b2e129c + last_write_checksum: sha1:84999e85717da3612e618f3115f0cf56ea91b268 + pristine_git_object: bf5e3e9d282db9aefb6629dbe70240294aadd3d8 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -6796,6 +6800,10 @@ trackedFiles: id: 2ec3e3546afe last_write_checksum: sha1:338e193bd6929eb6ed69da9bdb4e608e5db6121b pristine_git_object: 05a105c6e4f6c9037f953e4620576a8494645865 + src/openrouter/components/anthropiccachecreation.py: + id: 10d4a3bde2d9 + last_write_checksum: sha1:5e3b33cda7e69aeb2e683374815796ca76ee2368 + pristine_git_object: b08b10ce6b317954ebf7f12d09157d5cc4a19f26 src/openrouter/components/anthropiccitationcharlocationparam.py: id: 6f6f0732b22f last_write_checksum: sha1:f06cdcdd405abb4222450f027fd38f29b05efbec @@ -7714,8 +7722,8 @@ trackedFiles: pristine_git_object: eb59bfd0d4b89dde72504f8aa57533c689474ced src/openrouter/components/imagegenerationusage.py: id: f51151e8dbfa - last_write_checksum: sha1:810fd7e3dd1808d3c846fa4791ce3ba728dc32d6 - pristine_git_object: 83ae9b1bc1e7624550cf432b440c20ebe6eb16f5 + last_write_checksum: sha1:7f3f93e29e3b5018e8bf218dc167665794cf1d65 + pristine_git_object: 089d12ed821830575a14bf6b279a750f9737c1a4 src/openrouter/components/imagegenpartialimageevent.py: id: f88cea0c67fc last_write_checksum: sha1:2ee76cbb50b60ebe624bdfe0769a7bbdce047cd0 @@ -11137,3 +11145,6 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 +releaseNotes: | + ## Python SDK Changes: + * `open_router.images.generate()`: `response` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 9530cc2..f6d28fd 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.27 + version: 0.11.28 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 8ba1dfe..cfa4187 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -9933,6 +9933,8 @@ components: prompt_tokens: 0 total_tokens: 4175 properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' completion_tokens: description: The tokens generated type: integer @@ -11882,6 +11884,8 @@ components: type: string usage: properties: + cache_creation: + $ref: '#/components/schemas/AnthropicCacheCreation' cache_creation_input_tokens: nullable: true type: integer diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3dc3983..05cc9df 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:6bb42dab7b8c3a170da9cf40c9b52e39be0e93776f2ea0aaa6d806562290594c - sourceBlobDigest: sha256:e2a84cbdb9e0e9e83a48aa80f44d1ae9ad3ef37d469ee705e9409017c065aaa5 + sourceRevisionDigest: sha256:edca79a14bbe673bb4bb252f55acbe2d94ac37355ff7dace80c025796f462cec + sourceBlobDigest: sha256:0d80dbc0f8174d90dd172c8c20c8c2aa51e915a33a0bdef18806f2bc5f215ba4 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:6bb42dab7b8c3a170da9cf40c9b52e39be0e93776f2ea0aaa6d806562290594c - sourceBlobDigest: sha256:e2a84cbdb9e0e9e83a48aa80f44d1ae9ad3ef37d469ee705e9409017c065aaa5 + sourceRevisionDigest: sha256:edca79a14bbe673bb4bb252f55acbe2d94ac37355ff7dace80c025796f462cec + sourceBlobDigest: sha256:0d80dbc0f8174d90dd172c8c20c8c2aa51e915a33a0bdef18806f2bc5f215ba4 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:620d78e3bc22a91a122ed5516d1800440ee7551693a8bc91d3dcaeefec334c50 + codeSamplesRevisionDigest: sha256:2f083adce0aad1ea67dd838546080b632140c054b28495cc56c4f449cfc35f2e workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 260f7c0..efcceda 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -378,4 +378,14 @@ Based on: ### Generated - [python v0.11.27] . ### Releases -- [PyPI v0.11.27] https://pypi.org/project/openrouter/0.11.27 - . \ No newline at end of file +- [PyPI v0.11.27] https://pypi.org/project/openrouter/0.11.27 - . + +## 2026-07-14 05:35:17 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.28] . +### Releases +- [PyPI v0.11.28] https://pypi.org/project/openrouter/0.11.28 - . \ No newline at end of file diff --git a/docs/components/anthropiccachecreation.mdx b/docs/components/anthropiccachecreation.mdx new file mode 100644 index 0000000..c9562a6 --- /dev/null +++ b/docs/components/anthropiccachecreation.mdx @@ -0,0 +1,10 @@ +--- +title: "AnthropicCacheCreation" +--- + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `ephemeral_1h_input_tokens` | *int* | :heavy_check_mark: | N/A | +| `ephemeral_5m_input_tokens` | *int* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/imagegenerationusage.mdx b/docs/components/imagegenerationusage.mdx index be9fe8f..cb01cf3 100644 --- a/docs/components/imagegenerationusage.mdx +++ b/docs/components/imagegenerationusage.mdx @@ -9,6 +9,7 @@ Token and cost usage for the image generation request, when available | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `cache_creation` | [OptionalNullable[components.AnthropicCacheCreation]](../components/anthropiccachecreation.mdx) | :heavy_minus_sign: | N/A | \{
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 100
} | | `completion_tokens` | *int* | :heavy_check_mark: | The tokens generated | | | `completion_tokens_details` | [OptionalNullable[components.ImageGenerationUsageCompletionTokensDetails]](../components/imagegenerationusagecompletiontokensdetails.mdx) | :heavy_minus_sign: | N/A | | | `cost` | *OptionalNullable[float]* | :heavy_minus_sign: | Cost of the completion | | diff --git a/pyproject.toml b/pyproject.toml index feee6a6..38e011e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.27" +version = "0.11.28" 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 d00a5fa..fb15497 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.27" +__version__: str = "0.11.28" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.27 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.28 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 92d0e11..bf5e3e9 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -80,6 +80,10 @@ if TYPE_CHECKING: AnthropicCacheControlDirectiveTypedDict, ) from .anthropiccachecontrolttl import AnthropicCacheControlTTL + from .anthropiccachecreation import ( + AnthropicCacheCreation, + AnthropicCacheCreationTypedDict, + ) from .anthropiccitationcharlocationparam import ( AnthropicCitationCharLocationParam, AnthropicCitationCharLocationParamType, @@ -2895,6 +2899,8 @@ __all__ = [ "AnthropicCacheControlDirectiveType", "AnthropicCacheControlDirectiveTypedDict", "AnthropicCacheControlTTL", + "AnthropicCacheCreation", + "AnthropicCacheCreationTypedDict", "AnthropicCitationCharLocationParam", "AnthropicCitationCharLocationParamType", "AnthropicCitationCharLocationParamTypedDict", @@ -4960,6 +4966,8 @@ _dynamic_imports: dict[str, str] = { "AnthropicCacheControlDirectiveType": ".anthropiccachecontroldirective", "AnthropicCacheControlDirectiveTypedDict": ".anthropiccachecontroldirective", "AnthropicCacheControlTTL": ".anthropiccachecontrolttl", + "AnthropicCacheCreation": ".anthropiccachecreation", + "AnthropicCacheCreationTypedDict": ".anthropiccachecreation", "AnthropicCitationCharLocationParam": ".anthropiccitationcharlocationparam", "AnthropicCitationCharLocationParamType": ".anthropiccitationcharlocationparam", "AnthropicCitationCharLocationParamTypedDict": ".anthropiccitationcharlocationparam", diff --git a/src/openrouter/components/anthropiccachecreation.py b/src/openrouter/components/anthropiccachecreation.py new file mode 100644 index 0000000..b08b10c --- /dev/null +++ b/src/openrouter/components/anthropiccachecreation.py @@ -0,0 +1,16 @@ +"""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 AnthropicCacheCreationTypedDict(TypedDict): + ephemeral_1h_input_tokens: int + ephemeral_5m_input_tokens: int + + +class AnthropicCacheCreation(BaseModel): + ephemeral_1h_input_tokens: int + + ephemeral_5m_input_tokens: int diff --git a/src/openrouter/components/imagegenerationusage.py b/src/openrouter/components/imagegenerationusage.py index 83ae9b1..089d12e 100644 --- a/src/openrouter/components/imagegenerationusage.py +++ b/src/openrouter/components/imagegenerationusage.py @@ -1,6 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .anthropiccachecreation import ( + AnthropicCacheCreation, + AnthropicCacheCreationTypedDict, +) from .anthropicspeed import AnthropicSpeed from .anthropicusageiteration import ( AnthropicUsageIteration, @@ -201,6 +205,7 @@ class ImageGenerationUsageTypedDict(TypedDict): r"""Including images, input audio, and tools if any""" total_tokens: int r"""Sum of the above two fields""" + cache_creation: NotRequired[Nullable[AnthropicCacheCreationTypedDict]] completion_tokens_details: NotRequired[ Nullable[ImageGenerationUsageCompletionTokensDetailsTypedDict] ] @@ -234,6 +239,8 @@ class ImageGenerationUsage(BaseModel): total_tokens: int r"""Sum of the above two fields""" + cache_creation: OptionalNullable[AnthropicCacheCreation] = UNSET + completion_tokens_details: OptionalNullable[ ImageGenerationUsageCompletionTokensDetails ] = UNSET @@ -266,6 +273,7 @@ class ImageGenerationUsage(BaseModel): def serialize_model(self, handler): optional_fields = set( [ + "cache_creation", "completion_tokens_details", "cost", "cost_details", @@ -279,6 +287,7 @@ class ImageGenerationUsage(BaseModel): ) nullable_fields = set( [ + "cache_creation", "completion_tokens_details", "cost", "cost_details", diff --git a/uv.lock b/uv.lock index b0cfa15..0c59b75 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.27" +version = "0.11.28" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 44313b0aa3855da99b0d2490fa96f8900af0ad37 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 14:48:06 +0000 Subject: [PATCH 53/62] chore: update OpenAPI spec from monorepo (#445) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index b48d1e4..104b5a9 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -18401,8 +18401,8 @@ components: PricingOverride: description: >- A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. - min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys - absent from an entry inherit the base price. + min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later + entries win per price key; price keys absent from an entry inherit the base price. example: completion: '0.00002' min_prompt_tokens: 200000 @@ -18435,6 +18435,17 @@ components: prompt: description: Overridden price in USD per token for prompt (input) processing type: string + utc_end: + description: 'Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)' + format: double + type: number + utc_start: + description: >- + Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = + 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), + which may wrap past midnight (utc_start > utc_end). + format: double + type: number type: object PromptCacheBreakpoint: description: >- @@ -19557,10 +19568,11 @@ components: type: string overrides: description: >- - Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its - condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win - per key; price keys absent from an entry inherit the base price. The top-level pricing keys always - reflect the price that applies under default conditions. + Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies + when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match + the request; among applicable entries, later entries win per key; price keys absent from an entry + inherit the base price. The top-level pricing keys always reflect the price that applies under default + conditions. items: $ref: '#/components/schemas/PricingOverride' type: array @@ -19690,10 +19702,10 @@ components: type: string overrides: description: >- - Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its - condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per - key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the - price that applies under default conditions. + Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when + all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the + request; among applicable entries, later entries win per key; price keys absent from an entry inherit the + base price. The top-level pricing keys always reflect the price that applies under default conditions. items: $ref: '#/components/schemas/PricingOverride' type: array From 2a65de50d32f02e5a3fc0fc143108beb4903aef5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 14:53:50 +0000 Subject: [PATCH 54/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.29=20(#446)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 51 +++++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 15 ++++-- .speakeasy/workflow.lock | 10 ++-- RELEASES.md | 12 ++++- docs/components/pricing.mdx | 36 +++++++------- docs/components/pricingoverride.mdx | 24 ++++----- docs/components/publicpricing.mdx | 36 +++++++------- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/pricingoverride.py | 16 +++++- src/openrouter/components/publicendpoint.py | 4 +- src/openrouter/components/publicpricing.py | 4 +- uv.lock | 2 +- 14 files changed, 128 insertions(+), 90 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index fa92dd7..a66bcf8 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: 913314e7b77524966693bb56c9a3dd24 + docChecksum: ff4478e1428e58273d7375ea639734d6 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.28 - configChecksum: ce48138720beb4eb8841b187c03d254f + releaseVersion: 0.11.29 + configChecksum: e092e139147af5b5a502f15607d75192 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: e656f374-a717-4315-90c0-6ee70ed0cf9c - pristine_commit_hash: 3d5b10a16d484690e232f230a59576340aa52303 - pristine_tree_hash: f9fc6333f4a8952a56a6ca33eb92a50cc9b98d90 + generation_id: d53fc2a4-a065-484e-b315-dc8906615c95 + pristine_commit_hash: a593a152775480385c6cd2612c40dfb00014f443 + pristine_tree_hash: 4c87fa8a5b2aa4e90475f48c263b2f8da0222530 features: python: acceptHeaders: 3.0.0 @@ -3890,12 +3890,12 @@ trackedFiles: pristine_git_object: 3d340325d192b54a5d039336cce2bd35d12445ac docs/components/pricing.mdx: id: 6816d700f8b1 - last_write_checksum: sha1:c9f49a270c1ddcaf2b354b2c0f7ceb277ca5eff4 - pristine_git_object: 0ca9bdf9bf2b1909a4a78e99b58fde78b311becd + last_write_checksum: sha1:4b1943b79c3f1b054236d4e35f843b91108decd0 + pristine_git_object: e60ec6cfd7c0882a02067bfbe246e5cf6d5208c0 docs/components/pricingoverride.mdx: id: 74675f38c1c6 - last_write_checksum: sha1:5e64e9edbb013f04ee3741fe7c5dbd2fa54b544b - pristine_git_object: f8291256ac4a4aeed8bf79f1bad1e3b45cbaa354 + last_write_checksum: sha1:ca4bf606df26dd9e2b636d7d9e9f0fd183b21145 + pristine_git_object: 5fb1b765b2b0e46d40042f341bbcc91aa0d92762 docs/components/promptcachebreakpoint.mdx: id: c135956dc623 last_write_checksum: sha1:1b0c9884eb9b6fe1d4fdf822c75cb566ead67e07 @@ -3974,8 +3974,8 @@ trackedFiles: pristine_git_object: 4498d08fd82f26a210eeed2b9659e6a0b321f9ef docs/components/publicpricing.mdx: id: 61fb18b7ff94 - last_write_checksum: sha1:53550f414931189b91a148ca9039aefb5899a7ee - pristine_git_object: 4a17b2b3dd05ea85ea9847689c13692540007f07 + last_write_checksum: sha1:e241420249fcbd1bf515b0f5e84934de0b207948 + pristine_git_object: 894ca95c033795d50895fec5b8a6a18cd4a459c3 docs/components/quantization.mdx: id: 9d062e4ee362 last_write_checksum: sha1:4cb3588933fe1ca8592669f8ec1bef1cf0986e28 @@ -6666,8 +6666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:04c19e27f55c549187e8134f7ff3696cd428f3df - pristine_git_object: 38e011e2029916eabc14394ca864b6516da19017 + last_write_checksum: sha1:1117ced9033fbecc539bceaa0497773110a561fa + pristine_git_object: 390707512d3febdc96fb763f9d077eee7567d046 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6694,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:fd94190abbfad4aff1ecc18a06a3b466ddd7c2b8 - pristine_git_object: fb15497c9ae07185c9379f5151156e976ce297f5 + last_write_checksum: sha1:fda5045f9e84313bfc3c002291fef7a1dba3ee40 + pristine_git_object: 86673258f99094629fb4fd3a5c17d5f944bf63fd src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -8358,8 +8358,8 @@ trackedFiles: pristine_git_object: 90bdb267893360608210843a5da0d5d68e80d41e src/openrouter/components/pricingoverride.py: id: 8984e4cc7422 - last_write_checksum: sha1:0e2c06a0d510bb2fcf64b03f74c693f26c9825ad - pristine_git_object: 21c25933126937fe7c1d10898a42bbe711cf7b9f + last_write_checksum: sha1:0f72b9806164907aacce785f2d0c79a3e9374ac9 + pristine_git_object: a7c4599ac6ab794f54968f12cd6b15c3137a5159 src/openrouter/components/promptcachebreakpoint.py: id: f1e589a13300 last_write_checksum: sha1:458ef5170c7c9ea1367dcfb090b1b28333aff73d @@ -8402,12 +8402,12 @@ trackedFiles: pristine_git_object: 1798ae9dd8c2e4b629bb99cc5c643827895e8231 src/openrouter/components/publicendpoint.py: id: 848aa2ef9129 - last_write_checksum: sha1:a94a8a30e3656955780285fa004a2b7e5d162c57 - pristine_git_object: b647b5f88242565b228e6d0bf11d151e6650f6f8 + last_write_checksum: sha1:cfd3d1e8d5c62bbd494bd35e92d4d574103a189a + pristine_git_object: f91d6ae5aa526c51cf218eaaed2cb77514737ae8 src/openrouter/components/publicpricing.py: id: 96d115d83cc5 - last_write_checksum: sha1:a3733ee6d92eda73562ea1fa2bc834e3a14ac6db - pristine_git_object: 037f4b4e9aa72510a4021e695fe39516eb88d1f3 + last_write_checksum: sha1:fd8c320ac83b282eaf2405045329b55076d4311a + pristine_git_object: 34b9d18bf50bcce3c150fffff684f41e8e79a2bd src/openrouter/components/quantization.py: id: bde317b3d703 last_write_checksum: sha1:96b042899bfb818f20d282be76ad37fc948a599d @@ -11147,4 +11147,9 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.images.generate()`: `response` **Changed** + * `open_router.embeddings.list_models()`: `response.data[].pricing.overrides[]` **Changed** + * `open_router.endpoints.list_zdr_endpoints()`: `response.data[].pricing.overrides[]` **Changed** + * `open_router.endpoints.list()`: `response.data.endpoints[].pricing.overrides[]` **Changed** + * `open_router.models.get()`: `response.data.pricing.overrides[]` **Changed** + * `open_router.models.list()`: `response.data[].pricing.overrides[]` **Changed** + * `open_router.models.list_for_user()`: `response.data[].pricing.overrides[]` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f6d28fd..0db77a9 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.28 + version: 0.11.29 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index cfa4187..a825e61 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -18295,7 +18295,7 @@ components: type: object PricingOverride: description: >- - A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. + A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. example: completion: '0.00002' min_prompt_tokens: 200000 @@ -18327,6 +18327,15 @@ components: prompt: description: Overridden price in USD per token for prompt (input) processing type: string + utc_end: + description: 'Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)' + format: double + type: number + utc_start: + description: >- + Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end). + format: double + type: number type: object PromptCacheBreakpoint: description: >- @@ -19438,7 +19447,7 @@ components: type: string overrides: description: >- - Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. + Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. items: $ref: '#/components/schemas/PricingOverride' type: array @@ -19561,7 +19570,7 @@ components: type: string overrides: description: >- - Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. + Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. items: $ref: '#/components/schemas/PricingOverride' type: array diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 05cc9df..d77ab63 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:edca79a14bbe673bb4bb252f55acbe2d94ac37355ff7dace80c025796f462cec - sourceBlobDigest: sha256:0d80dbc0f8174d90dd172c8c20c8c2aa51e915a33a0bdef18806f2bc5f215ba4 + sourceRevisionDigest: sha256:bd088c96e6b4db61858c4c25ba4a2276bd36fec50b25bc32d1121c7ab534afa4 + sourceBlobDigest: sha256:bf34b1b3df01fa14f7be4166938bbbd81645bc8f1045b09e547c9f9fae84f890 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:edca79a14bbe673bb4bb252f55acbe2d94ac37355ff7dace80c025796f462cec - sourceBlobDigest: sha256:0d80dbc0f8174d90dd172c8c20c8c2aa51e915a33a0bdef18806f2bc5f215ba4 + sourceRevisionDigest: sha256:bd088c96e6b4db61858c4c25ba4a2276bd36fec50b25bc32d1121c7ab534afa4 + sourceBlobDigest: sha256:bf34b1b3df01fa14f7be4166938bbbd81645bc8f1045b09e547c9f9fae84f890 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:2f083adce0aad1ea67dd838546080b632140c054b28495cc56c4f449cfc35f2e + codeSamplesRevisionDigest: sha256:7273c5d01f944ef1d07660238a38770b6cf0bcf8fe421b90c142f70bd9182305 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index efcceda..ffddaf3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -388,4 +388,14 @@ Based on: ### Generated - [python v0.11.28] . ### Releases -- [PyPI v0.11.28] https://pypi.org/project/openrouter/0.11.28 - . \ No newline at end of file +- [PyPI v0.11.28] https://pypi.org/project/openrouter/0.11.28 - . + +## 2026-07-14 14:49:30 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.29] . +### Releases +- [PyPI v0.11.29] https://pypi.org/project/openrouter/0.11.29 - . \ No newline at end of file diff --git a/docs/components/pricing.mdx b/docs/components/pricing.mdx index 0ca9bdf..e60ec6c 100644 --- a/docs/components/pricing.mdx +++ b/docs/components/pricing.mdx @@ -4,21 +4,21 @@ title: "Pricing" ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | -| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | -| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | -| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | -| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | -| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | -| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | +| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | +| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | +| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | +| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | +| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | +| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file diff --git a/docs/components/pricingoverride.mdx b/docs/components/pricingoverride.mdx index f829125..5fb1b76 100644 --- a/docs/components/pricingoverride.mdx +++ b/docs/components/pricingoverride.mdx @@ -2,18 +2,20 @@ title: "PricingOverride" --- -A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. +A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price. ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per audio input token | -| `completion` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for completion (output) generation | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cache-write token | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per 1-hour cache-write token | -| `min_prompt_tokens` | *Optional[float]* | :heavy_minus_sign: | Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold | -| `prompt` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for prompt (input) processing | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per audio input token | +| `completion` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for completion (output) generation | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per cache-write token | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per 1-hour cache-write token | +| `min_prompt_tokens` | *Optional[float]* | :heavy_minus_sign: | Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Overridden price in USD per token for prompt (input) processing | +| `utc_end` | *Optional[float]* | :heavy_minus_sign: | Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00) | +| `utc_start` | *Optional[float]* | :heavy_minus_sign: | Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end). | \ No newline at end of file diff --git a/docs/components/publicpricing.mdx b/docs/components/publicpricing.mdx index 4a17b2b..894ca95 100644 --- a/docs/components/publicpricing.mdx +++ b/docs/components/publicpricing.mdx @@ -7,21 +7,21 @@ Pricing information for the model ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | -| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | -| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | -| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | -| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | -| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | -| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | -| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | -| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | -| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | -| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | -| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | -| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | -| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | -| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | -| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token | +| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token | +| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation | +| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) | +| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image | +| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image | +| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token | +| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token | +| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) | +| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. | +| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. | +| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token | +| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. | +| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing | +| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request | +| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 38e011e..3907075 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.28" +version = "0.11.29" 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 fb15497..8667325 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.28" +__version__: str = "0.11.29" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.28 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.29 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/pricingoverride.py b/src/openrouter/components/pricingoverride.py index 21c2593..a7c4599 100644 --- a/src/openrouter/components/pricingoverride.py +++ b/src/openrouter/components/pricingoverride.py @@ -8,7 +8,7 @@ from typing_extensions import NotRequired, TypedDict class PricingOverrideTypedDict(TypedDict): - r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" + r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" audio: NotRequired[str] r"""Overridden price in USD per audio input token""" @@ -26,10 +26,14 @@ class PricingOverrideTypedDict(TypedDict): r"""Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold""" prompt: NotRequired[str] r"""Overridden price in USD per token for prompt (input) processing""" + utc_end: NotRequired[float] + r"""Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)""" + utc_start: NotRequired[float] + r"""Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end).""" class PricingOverride(BaseModel): - r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" + r"""A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.""" audio: Optional[str] = None r"""Overridden price in USD per audio input token""" @@ -55,6 +59,12 @@ class PricingOverride(BaseModel): prompt: Optional[str] = None r"""Overridden price in USD per token for prompt (input) processing""" + utc_end: Optional[float] = None + r"""Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)""" + + utc_start: Optional[float] = None + r"""Condition: inclusive start of a daily UTC time window as an HHMM clock number (e.g. 100 = 01:00, 1030 = 10:30). The entry applies while the current UTC time is inside the half-open window [utc_start, utc_end), which may wrap past midnight (utc_start > utc_end).""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -67,6 +77,8 @@ class PricingOverride(BaseModel): "input_cache_write_1h", "min_prompt_tokens", "prompt", + "utc_end", + "utc_start", ] ) serialized = handler(self) diff --git a/src/openrouter/components/publicendpoint.py b/src/openrouter/components/publicendpoint.py index b647b5f..f91d6ae 100644 --- a/src/openrouter/components/publicendpoint.py +++ b/src/openrouter/components/publicendpoint.py @@ -40,7 +40,7 @@ class PricingTypedDict(TypedDict): internal_reasoning: NotRequired[str] r"""Price in USD per internal reasoning token""" overrides: NotRequired[List[PricingOverrideTypedDict]] - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: NotRequired[str] r"""Price in USD per request""" web_search: NotRequired[str] @@ -88,7 +88,7 @@ class Pricing(BaseModel): r"""Price in USD per internal reasoning token""" overrides: Optional[List[PricingOverride]] = None - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: Optional[str] = None r"""Price in USD per request""" diff --git a/src/openrouter/components/publicpricing.py b/src/openrouter/components/publicpricing.py index 037f4b4..34b9d18 100644 --- a/src/openrouter/components/publicpricing.py +++ b/src/openrouter/components/publicpricing.py @@ -38,7 +38,7 @@ class PublicPricingTypedDict(TypedDict): internal_reasoning: NotRequired[str] r"""Price in USD per internal reasoning token""" overrides: NotRequired[List[PricingOverrideTypedDict]] - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: NotRequired[str] r"""Price in USD per request""" web_search: NotRequired[str] @@ -88,7 +88,7 @@ class PublicPricing(BaseModel): r"""Price in USD per internal reasoning token""" overrides: Optional[List[PricingOverride]] = None - r"""Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" + r"""Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.""" request: Optional[str] = None r"""Price in USD per request""" diff --git a/uv.lock b/uv.lock index 0c59b75..914f2ad 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.28" +version = "0.11.29" source = { editable = "." } dependencies = [ { name = "httpcore" }, From a4f029471372452b894048f0e532f0e2b3f01dc4 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:47:53 +0000 Subject: [PATCH 55/62] chore: update OpenAPI spec from monorepo (#447) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 50 ++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 104b5a9..9c91947 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -5790,27 +5790,7 @@ components: type: integer type: object server_tool_use_details: - description: Usage for server-side tool execution (e.g., web search) - nullable: true - properties: - tool_calls_executed: - description: Number of OpenRouter server tool calls that executed and produced a result - nullable: true - type: integer - tool_calls_requested: - description: >- - Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. - Provider-native tools (e.g. native web search) are not counted here. - nullable: true - type: integer - web_search_requests: - description: >- - Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search - is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. - Do not sum the two. - nullable: true - type: integer - type: object + $ref: '#/components/schemas/ServerToolUseDetails' total_tokens: description: Total number of tokens type: integer @@ -20715,6 +20695,32 @@ components: - high example: medium type: string + ServerToolUseDetails: + description: Usage for server-side tool execution (e.g., web search) + example: + tool_calls_executed: 2 + tool_calls_requested: 2 + web_search_requests: 2 + nullable: true + properties: + tool_calls_executed: + description: Number of OpenRouter server tool calls that executed and produced a result. + nullable: true + type: integer + tool_calls_requested: + description: >- + Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. + Provider-native tools (e.g. native web search) are not counted here. + nullable: true + type: integer + web_search_requests: + description: >- + Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is + also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not + sum the two. + nullable: true + type: integer + type: object ServiceTier: enum: - auto @@ -23025,6 +23031,8 @@ components: is_byok: description: Whether a request was made using a Bring Your Own Key configuration type: boolean + server_tool_use_details: + $ref: '#/components/schemas/ServerToolUseDetails' type: object description: Token usage information for the response example: From 4d4ff3efdd92097c0e97462e26d7d50a88a19f77 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:53:19 +0000 Subject: [PATCH 56/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.30=20(#448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 55 ++++++++-------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 44 ++++++++----- .speakeasy/workflow.lock | 10 +-- RELEASES.md | 12 +++- docs/components/chatusage.mdx | 2 +- docs/components/servertoolusedetails.mdx | 2 +- docs/components/usage.mdx | 21 +++--- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/__init__.py | 10 +-- src/openrouter/components/chatusage.py | 54 +-------------- .../components/servertoolusedetails.py | 65 +++++++++++++++++++ src/openrouter/components/usage.py | 12 +++- uv.lock | 2 +- 15 files changed, 169 insertions(+), 128 deletions(-) create mode 100644 src/openrouter/components/servertoolusedetails.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index a66bcf8..7f49b41 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: ff4478e1428e58273d7375ea639734d6 + docChecksum: 2b57a910ce900868d69481fbdbb107e2 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.29 - configChecksum: e092e139147af5b5a502f15607d75192 + releaseVersion: 0.11.30 + configChecksum: 7dc0b5387e8da51843faaa2b3abeb965 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: d53fc2a4-a065-484e-b315-dc8906615c95 - pristine_commit_hash: a593a152775480385c6cd2612c40dfb00014f443 - pristine_tree_hash: 4c87fa8a5b2aa4e90475f48c263b2f8da0222530 + generation_id: a22f6b13-0ff1-4813-b7be-a4b1fab6b7d6 + pristine_commit_hash: 7f32faacc61245f0cf537d83ad96f0cbae0c5e25 + pristine_tree_hash: e68b33ac89a39aaeca3434449e5272b7549f89d5 features: python: acceptHeaders: 3.0.0 @@ -1122,8 +1122,8 @@ trackedFiles: pristine_git_object: 48386287b072381a9b59de6ae804b0ffbbab221a docs/components/chatusage.mdx: id: d7c2bc8b3eb2 - last_write_checksum: sha1:7f8bf402accabcc12f92b52bf6101cac3ef0363e - pristine_git_object: a45747f57783767d91fe66f212525f7578d7345c + last_write_checksum: sha1:94539927996d770b9629c64bde6d8188976eec1d + pristine_git_object: a32fff446094a26dfa62cdfcd02b5bc3c1293a72 docs/components/chatusagecompletiontokensdetails.mdx: id: 0274e721a9d9 last_write_checksum: sha1:77e7b8ae3c4456f4284f4fbd0093d00fdefd06c9 @@ -4322,8 +4322,8 @@ trackedFiles: pristine_git_object: a90fbbefe76853f92638f4ae7ad63cf67951efc4 docs/components/servertoolusedetails.mdx: id: 5a7d75562dec - last_write_checksum: sha1:28d1fa7491c62f6fc5592fc8092afa9cfaa0b4f5 - pristine_git_object: a9f0d64b5351c9d5f5839b29c8c8c9c79a2d0c3a + last_write_checksum: sha1:c2a156aba0f34118e3c681561f817d8deb4a06ac + pristine_git_object: de0d677d4f188af0688f78b8c8a25ae07ca3a093 docs/components/serviceunavailableresponseerrordata.mdx: id: 72f01d77e774 last_write_checksum: sha1:7b53cfdd92a87ef0b70e0b5f7d2031e73bcbe033 @@ -5046,8 +5046,8 @@ trackedFiles: pristine_git_object: c5fe94ebc3791026c16a9636c7d6077773297e19 docs/components/usage.mdx: id: d84b29a6ea8c - last_write_checksum: sha1:e9adc633c75f1e77e76fe32545662cc27c6304fc - pristine_git_object: c400fc42927885901a17ce82529b39c2cdadce6e + last_write_checksum: sha1:b279f416f251c361dd705a2960b17e23c63aa508 + pristine_git_object: 2b203365a2a132a20be296a0acf7ba080780f44b docs/components/usagecostdetails.mdx: id: 95d8a52fead9 last_write_checksum: sha1:d8b2597a2921b79c43fd30173a8c395cd60584b2 @@ -6666,8 +6666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:1117ced9033fbecc539bceaa0497773110a561fa - pristine_git_object: 390707512d3febdc96fb763f9d077eee7567d046 + last_write_checksum: sha1:7fff6806442d03388a1eeba7ced666a73f0b9e4b + pristine_git_object: b5955b6fb83f318988510683756edc44d54bf68d scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6694,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:fda5045f9e84313bfc3c002291fef7a1dba3ee40 - pristine_git_object: 86673258f99094629fb4fd3a5c17d5f944bf63fd + last_write_checksum: sha1:6fc2a852500a272de2537814ccf9d5ecba9f032e + pristine_git_object: 4f9e877e356b1d5d1e23594d3f7de4c2f389c1f6 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6734,8 +6734,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:84999e85717da3612e618f3115f0cf56ea91b268 - pristine_git_object: bf5e3e9d282db9aefb6629dbe70240294aadd3d8 + last_write_checksum: sha1:94b5ed66b643a74f91ce1c3ec98744e1146f729e + pristine_git_object: c2d2d47304bce289181c2cba8ddc3ab3f947e3b8 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:fab4d9a24d2cea937bb749d46c5f83941e99d65c @@ -7246,8 +7246,8 @@ trackedFiles: pristine_git_object: 2ccba8386486b7a730816a9829b01754935a2e96 src/openrouter/components/chatusage.py: id: f224a054bf45 - last_write_checksum: sha1:3cdcb6cbf944509ef966f90f7d6e3af967323277 - pristine_git_object: 1410ca9d1ed4032acb4a59569be77cea2fb4432b + last_write_checksum: sha1:ea708aa417bad1c480ef113ec9c4491f1cdfcf44 + pristine_git_object: 4fd2be35dd11a5c81fcc575f766ae23cbdc4e78e src/openrouter/components/chatusermessage.py: id: 7777191e729a last_write_checksum: sha1:6e9d3d1a827832b947bbb688a8f78f43aaaa9f81 @@ -8576,6 +8576,10 @@ trackedFiles: id: ae2ca334218a last_write_checksum: sha1:4f739c60ede675286c18e898f4cc9505480897a4 pristine_git_object: fce3d0742de43f714ec40da747e6dcf7ff5e4075 + src/openrouter/components/servertoolusedetails.py: + id: b681965db7f8 + last_write_checksum: sha1:071f2fee04f80ccff9139c7909b4e3ed331fdb0c + pristine_git_object: 16ca66ee3f2402e06b9395a78be7def7da172e79 src/openrouter/components/serviceunavailableresponseerrordata.py: id: 606d51d201e8 last_write_checksum: sha1:275a171422155df8447f1b250f0a8af61d266b68 @@ -8854,8 +8858,8 @@ trackedFiles: pristine_git_object: a0491cc8fd3bd9986146cb1176e27d5b9c9beb60 src/openrouter/components/usage.py: id: 965ca6748bf6 - last_write_checksum: sha1:712340f3df2194c53f37d0491e220296ad3c3dbd - pristine_git_object: 572d04f457607099ae7e041922de146de10e2eae + last_write_checksum: sha1:ffc3d82f236daff144c71e0c48c201b428d3201a + pristine_git_object: 09f7248804ba12bfbef924b934f57c34974d965b src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c last_write_checksum: sha1:5dfb79ba40785ce3a31b00f66b5fba956dca1f0d @@ -11147,9 +11151,4 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.embeddings.list_models()`: `response.data[].pricing.overrides[]` **Changed** - * `open_router.endpoints.list_zdr_endpoints()`: `response.data[].pricing.overrides[]` **Changed** - * `open_router.endpoints.list()`: `response.data.endpoints[].pricing.overrides[]` **Changed** - * `open_router.models.get()`: `response.data.pricing.overrides[]` **Changed** - * `open_router.models.list()`: `response.data[].pricing.overrides[]` **Changed** - * `open_router.models.list_for_user()`: `response.data[].pricing.overrides[]` **Changed** + * `open_router.beta.responses.send()`: `response` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0db77a9..6bad913 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.29 + version: 0.11.30 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index a825e61..504784f 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -5783,24 +5783,7 @@ components: type: integer type: object server_tool_use_details: - description: Usage for server-side tool execution (e.g., web search) - nullable: true - properties: - tool_calls_executed: - description: Number of OpenRouter server tool calls that executed and produced a result - nullable: true - type: integer - tool_calls_requested: - description: >- - Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here. - nullable: true - type: integer - web_search_requests: - description: >- - Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two. - nullable: true - type: integer - type: object + $ref: '#/components/schemas/ServerToolUseDetails' total_tokens: description: Total number of tokens type: integer @@ -20568,6 +20551,29 @@ components: example: medium type: string x-speakeasy-unknown-values: allow + ServerToolUseDetails: + description: Usage for server-side tool execution (e.g., web search) + example: + tool_calls_executed: 2 + tool_calls_requested: 2 + web_search_requests: 2 + nullable: true + properties: + tool_calls_executed: + description: Number of OpenRouter server tool calls that executed and produced a result. + nullable: true + type: integer + tool_calls_requested: + description: >- + Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here. + nullable: true + type: integer + web_search_requests: + description: >- + Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two. + nullable: true + type: integer + type: object ServiceTier: enum: - auto @@ -22847,6 +22853,8 @@ components: is_byok: description: Whether a request was made using a Bring Your Own Key configuration type: boolean + server_tool_use_details: + $ref: '#/components/schemas/ServerToolUseDetails' type: object description: Token usage information for the response example: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d77ab63..1152f69 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:bd088c96e6b4db61858c4c25ba4a2276bd36fec50b25bc32d1121c7ab534afa4 - sourceBlobDigest: sha256:bf34b1b3df01fa14f7be4166938bbbd81645bc8f1045b09e547c9f9fae84f890 + sourceRevisionDigest: sha256:c6936e0c99ab2b3eb7457eff0cd75cbdb6c29db355e576ef66d79f8e1537ca61 + sourceBlobDigest: sha256:24d9b45658f2838dd80fdea05a8ebb456d32fd16300e8e2f0f438aa54a8c91ee tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:bd088c96e6b4db61858c4c25ba4a2276bd36fec50b25bc32d1121c7ab534afa4 - sourceBlobDigest: sha256:bf34b1b3df01fa14f7be4166938bbbd81645bc8f1045b09e547c9f9fae84f890 + sourceRevisionDigest: sha256:c6936e0c99ab2b3eb7457eff0cd75cbdb6c29db355e576ef66d79f8e1537ca61 + sourceBlobDigest: sha256:24d9b45658f2838dd80fdea05a8ebb456d32fd16300e8e2f0f438aa54a8c91ee codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:7273c5d01f944ef1d07660238a38770b6cf0bcf8fe421b90c142f70bd9182305 + codeSamplesRevisionDigest: sha256:5ffb925a925219f8c5a35ef3f8eb6b82780cd36ac1a2246ae78f35213af457e4 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index ffddaf3..4274290 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -398,4 +398,14 @@ Based on: ### Generated - [python v0.11.29] . ### Releases -- [PyPI v0.11.29] https://pypi.org/project/openrouter/0.11.29 - . \ No newline at end of file +- [PyPI v0.11.29] https://pypi.org/project/openrouter/0.11.29 - . + +## 2026-07-14 17:49:24 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.30] . +### Releases +- [PyPI v0.11.30] https://pypi.org/project/openrouter/0.11.30 - . \ No newline at end of file diff --git a/docs/components/chatusage.mdx b/docs/components/chatusage.mdx index a45747f..a32fff4 100644 --- a/docs/components/chatusage.mdx +++ b/docs/components/chatusage.mdx @@ -16,5 +16,5 @@ Token usage statistics | `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | | | `prompt_tokens` | *int* | :heavy_check_mark: | Number of tokens in the prompt | | | `prompt_tokens_details` | [OptionalNullable[components.ChatUsagePromptTokensDetails]](../components/chatusageprompttokensdetails.mdx) | :heavy_minus_sign: | Detailed prompt token usage | | -| `server_tool_use_details` | [OptionalNullable[components.ServerToolUseDetails]](../components/servertoolusedetails.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | | +| `server_tool_use_details` | [OptionalNullable[components.ServerToolUseDetails]](../components/servertoolusedetails.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | \{
"tool_calls_executed": 2,
"tool_calls_requested": 2,
"web_search_requests": 2
} | | `total_tokens` | *int* | :heavy_check_mark: | Total number of tokens | | \ No newline at end of file diff --git a/docs/components/servertoolusedetails.mdx b/docs/components/servertoolusedetails.mdx index a9f0d64..de0d677 100644 --- a/docs/components/servertoolusedetails.mdx +++ b/docs/components/servertoolusedetails.mdx @@ -9,6 +9,6 @@ Usage for server-side tool execution (e.g., web search) | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `tool_calls_executed` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of OpenRouter server tool calls that executed and produced a result | +| `tool_calls_executed` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of OpenRouter server tool calls that executed and produced a result. | | `tool_calls_requested` | *OptionalNullable[int]* | :heavy_minus_sign: | Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here. | | `web_search_requests` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two. | \ No newline at end of file diff --git a/docs/components/usage.mdx b/docs/components/usage.mdx index c400fc4..2b20336 100644 --- a/docs/components/usage.mdx +++ b/docs/components/usage.mdx @@ -7,13 +7,14 @@ Token usage information for the response ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `input_tokens` | *int* | :heavy_check_mark: | N/A | -| `input_tokens_details` | [components.InputTokensDetails](../components/inputtokensdetails.mdx) | :heavy_check_mark: | N/A | -| `output_tokens` | *int* | :heavy_check_mark: | N/A | -| `output_tokens_details` | [components.OutputTokensDetails](../components/outputtokensdetails.mdx) | :heavy_check_mark: | N/A | -| `total_tokens` | *int* | :heavy_check_mark: | N/A | -| `cost` | *OptionalNullable[float]* | :heavy_minus_sign: | Cost of the completion | -| `cost_details` | [Optional[components.UsageCostDetails]](../components/usagecostdetails.mdx) | :heavy_minus_sign: | N/A | -| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `input_tokens` | *int* | :heavy_check_mark: | N/A | | +| `input_tokens_details` | [components.InputTokensDetails](../components/inputtokensdetails.mdx) | :heavy_check_mark: | N/A | | +| `output_tokens` | *int* | :heavy_check_mark: | N/A | | +| `output_tokens_details` | [components.OutputTokensDetails](../components/outputtokensdetails.mdx) | :heavy_check_mark: | N/A | | +| `total_tokens` | *int* | :heavy_check_mark: | N/A | | +| `cost` | *OptionalNullable[float]* | :heavy_minus_sign: | Cost of the completion | | +| `cost_details` | [Optional[components.UsageCostDetails]](../components/usagecostdetails.mdx) | :heavy_minus_sign: | N/A | | +| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | | +| `server_tool_use_details` | [OptionalNullable[components.ServerToolUseDetails]](../components/servertoolusedetails.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | \{
"tool_calls_executed": 2,
"tool_calls_requested": 2,
"web_search_requests": 2
} | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3907075..b5955b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.29" +version = "0.11.30" 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 8667325..4f9e877 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.29" +__version__: str = "0.11.30" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.29 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.30 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 bf5e3e9..c2d2d47 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -611,8 +611,6 @@ if TYPE_CHECKING: ChatUsagePromptTokensDetails, ChatUsagePromptTokensDetailsTypedDict, ChatUsageTypedDict, - ServerToolUseDetails, - ServerToolUseDetailsTypedDict, ) from .chatusermessage import ( ChatUserMessage, @@ -2423,6 +2421,10 @@ if TYPE_CHECKING: ) from .searchqualitylevel import SearchQualityLevel from .security import Security, SecurityTypedDict + from .servertoolusedetails import ( + ServerToolUseDetails, + ServerToolUseDetailsTypedDict, + ) from .serviceunavailableresponseerrordata import ( ServiceUnavailableResponseErrorData, ServiceUnavailableResponseErrorDataTypedDict, @@ -5331,8 +5333,6 @@ _dynamic_imports: dict[str, str] = { "ChatUsagePromptTokensDetails": ".chatusage", "ChatUsagePromptTokensDetailsTypedDict": ".chatusage", "ChatUsageTypedDict": ".chatusage", - "ServerToolUseDetails": ".chatusage", - "ServerToolUseDetailsTypedDict": ".chatusage", "ChatUserMessage": ".chatusermessage", "ChatUserMessageContent": ".chatusermessage", "ChatUserMessageContentTypedDict": ".chatusermessage", @@ -6709,6 +6709,8 @@ _dynamic_imports: dict[str, str] = { "SearchQualityLevel": ".searchqualitylevel", "Security": ".security", "SecurityTypedDict": ".security", + "ServerToolUseDetails": ".servertoolusedetails", + "ServerToolUseDetailsTypedDict": ".servertoolusedetails", "ServiceUnavailableResponseErrorData": ".serviceunavailableresponseerrordata", "ServiceUnavailableResponseErrorDataTypedDict": ".serviceunavailableresponseerrordata", "ShellCallItem": ".shellcallitem", diff --git a/src/openrouter/components/chatusage.py b/src/openrouter/components/chatusage.py index 1410ca9..4fd2be3 100644 --- a/src/openrouter/components/chatusage.py +++ b/src/openrouter/components/chatusage.py @@ -2,6 +2,7 @@ from __future__ import annotations from .costdetails import CostDetails, CostDetailsTypedDict +from .servertoolusedetails import ServerToolUseDetails, ServerToolUseDetailsTypedDict from openrouter.types import ( BaseModel, Nullable, @@ -129,59 +130,6 @@ class ChatUsagePromptTokensDetails(BaseModel): return m -class ServerToolUseDetailsTypedDict(TypedDict): - r"""Usage for server-side tool execution (e.g., web search)""" - - tool_calls_executed: NotRequired[Nullable[int]] - r"""Number of OpenRouter server tool calls that executed and produced a result""" - tool_calls_requested: NotRequired[Nullable[int]] - r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" - web_search_requests: NotRequired[Nullable[int]] - r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" - - -class ServerToolUseDetails(BaseModel): - r"""Usage for server-side tool execution (e.g., web search)""" - - tool_calls_executed: OptionalNullable[int] = UNSET - r"""Number of OpenRouter server tool calls that executed and produced a result""" - - tool_calls_requested: OptionalNullable[int] = UNSET - r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" - - web_search_requests: OptionalNullable[int] = UNSET - r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] - ) - nullable_fields = set( - ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - class ChatUsageTypedDict(TypedDict): r"""Token usage statistics""" diff --git a/src/openrouter/components/servertoolusedetails.py b/src/openrouter/components/servertoolusedetails.py new file mode 100644 index 0000000..16ca66e --- /dev/null +++ b/src/openrouter/components/servertoolusedetails.py @@ -0,0 +1,65 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing_extensions import NotRequired, TypedDict + + +class ServerToolUseDetailsTypedDict(TypedDict): + r"""Usage for server-side tool execution (e.g., web search)""" + + tool_calls_executed: NotRequired[Nullable[int]] + r"""Number of OpenRouter server tool calls that executed and produced a result.""" + tool_calls_requested: NotRequired[Nullable[int]] + r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" + web_search_requests: NotRequired[Nullable[int]] + r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" + + +class ServerToolUseDetails(BaseModel): + r"""Usage for server-side tool execution (e.g., web search)""" + + tool_calls_executed: OptionalNullable[int] = UNSET + r"""Number of OpenRouter server tool calls that executed and produced a result.""" + + tool_calls_requested: OptionalNullable[int] = UNSET + r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.""" + + web_search_requests: OptionalNullable[int] = UNSET + r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] + ) + nullable_fields = set( + ["tool_calls_executed", "tool_calls_requested", "web_search_requests"] + ) + 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/components/usage.py b/src/openrouter/components/usage.py index 572d04f..09f7248 100644 --- a/src/openrouter/components/usage.py +++ b/src/openrouter/components/usage.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .servertoolusedetails import ServerToolUseDetails, ServerToolUseDetailsTypedDict from openrouter.types import ( BaseModel, Nullable, @@ -109,6 +110,8 @@ class UsageTypedDict(TypedDict): cost_details: NotRequired[UsageCostDetailsTypedDict] is_byok: NotRequired[bool] r"""Whether a request was made using a Bring Your Own Key configuration""" + server_tool_use_details: NotRequired[Nullable[ServerToolUseDetailsTypedDict]] + r"""Usage for server-side tool execution (e.g., web search)""" class Usage(BaseModel): @@ -132,10 +135,15 @@ class Usage(BaseModel): is_byok: Optional[bool] = None r"""Whether a request was made using a Bring Your Own Key configuration""" + server_tool_use_details: OptionalNullable[ServerToolUseDetails] = UNSET + r"""Usage for server-side tool execution (e.g., web search)""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["cost", "cost_details", "is_byok"]) - nullable_fields = set(["cost"]) + optional_fields = set( + ["cost", "cost_details", "is_byok", "server_tool_use_details"] + ) + nullable_fields = set(["cost", "server_tool_use_details"]) serialized = handler(self) m = {} diff --git a/uv.lock b/uv.lock index 914f2ad..7c5e31e 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.29" +version = "0.11.30" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 869165cefebed1bd29d605218b8b7010dda46a21 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 21:02:39 +0000 Subject: [PATCH 57/62] chore: update OpenAPI spec from monorepo (#449) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 57 +++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 9c91947..5e05f05 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -6643,6 +6643,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false ignored_models: null ignored_providers: null limit_usd: 50 @@ -6701,9 +6702,9 @@ components: enforce_zdr: deprecated: true description: >- - Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other - instead. When provided, its value is copied into any of those per-provider fields that are not explicitly - specified on the request. + Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and + enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are + not explicitly specified on the request. example: false nullable: true type: boolean @@ -6724,8 +6725,13 @@ components: type: boolean enforce_zdr_other: description: >- - Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back - to enforce_zdr when not provided. + Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls + back to enforce_zdr when not provided. + example: false + nullable: true + type: boolean + enforce_zdr_xai: + description: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. example: false nullable: true type: boolean @@ -6789,6 +6795,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -9130,6 +9137,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -9312,6 +9320,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -9375,9 +9384,9 @@ components: enforce_zdr: deprecated: true description: >- - Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other - instead. When provided, its value is copied into any of those per-provider fields that are not explicitly - specified on the request. + Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and + enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are + not explicitly specified on the request. example: false nullable: true type: boolean @@ -9398,8 +9407,13 @@ components: type: boolean enforce_zdr_other: description: >- - Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back - to enforce_zdr when not provided. + Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls + back to enforce_zdr when not provided. + example: false + nullable: true + type: boolean + enforce_zdr_xai: + description: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. example: false nullable: true type: boolean @@ -11112,6 +11126,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -22682,9 +22697,9 @@ components: enforce_zdr: deprecated: true description: >- - Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other - instead. When provided, its value is copied into any of those per-provider fields that are not explicitly - specified on the request. + Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and + enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are + not explicitly specified on the request. example: true nullable: true type: boolean @@ -22705,8 +22720,13 @@ components: type: boolean enforce_zdr_other: description: >- - Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back - to enforce_zdr when not provided. + Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls + back to enforce_zdr when not provided. + example: true + nullable: true + type: boolean + enforce_zdr_xai: + description: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. example: true nullable: true type: boolean @@ -22761,6 +22781,7 @@ components: enforce_zdr_google: true enforce_zdr_openai: true enforce_zdr_other: true + enforce_zdr_xai: true id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -28280,6 +28301,7 @@ paths: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false ignored_models: null ignored_providers: null limit_usd: 50 @@ -28306,6 +28328,7 @@ paths: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -28532,6 +28555,7 @@ paths: enforce_zdr_google: true enforce_zdr_openai: true enforce_zdr_other: true + enforce_zdr_xai: true id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -35663,7 +35687,8 @@ paths: post: description: >- Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. - [Management key](/docs/guides/overview/auth/management-api-keys) required. + SCIM-managed members cannot be removed; changes must be made in your identity provider. [Management + key](/docs/guides/overview/auth/management-api-keys) required. operationId: bulkRemoveWorkspaceMembers parameters: - description: The workspace ID (UUID) or slug From 06daeeb11fb65cb66c349ca57c8d6dc05733b79d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 21:08:12 +0000 Subject: [PATCH 58/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.31=20(#450)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 84 +++++++++-------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 38 ++++++-- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 ++- docs/components/createguardrailrequest.mdx | 37 ++++---- docs/components/createguardrailresponse.mdx | 6 +- docs/components/getguardrailresponse.mdx | 6 +- docs/components/guardrail.mdx | 43 ++++----- docs/components/updateguardrailrequest.mdx | 35 +++---- docs/components/updateguardrailresponse.mdx | 6 +- docs/operations/createguardrailrequest.mdx | 12 +-- docs/operations/listguardrailsresponse.mdx | 6 +- docs/sdks/guardrails/README.mdx | 92 ++++++++++--------- docs/sdks/workspaces/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- .../components/createguardrailrequest.py | 15 ++- src/openrouter/components/guardrail.py | 15 ++- .../components/updateguardrailrequest.py | 15 ++- src/openrouter/guardrails.py | 28 ++++-- src/openrouter/workspaces.py | 4 +- uv.lock | 2 +- 23 files changed, 273 insertions(+), 203 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 7f49b41..082440b 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: 2b57a910ce900868d69481fbdbb107e2 + docChecksum: 71daa6f89575defb9d76a73e5fb672ae docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.30 - configChecksum: 7dc0b5387e8da51843faaa2b3abeb965 + releaseVersion: 0.11.31 + configChecksum: 96b0d171f179dadfbe9d5efdfff0c4c2 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: a22f6b13-0ff1-4813-b7be-a4b1fab6b7d6 - pristine_commit_hash: 7f32faacc61245f0cf537d83ad96f0cbae0c5e25 - pristine_tree_hash: e68b33ac89a39aaeca3434449e5272b7549f89d5 + generation_id: 056b9ee4-a227-4cc6-b7e0-3c97d424d043 + pristine_commit_hash: 9daff37b2becb50eb2fe167e87e1149e4213b27e + pristine_tree_hash: 26d42d8bfd711f5fb23141b6ab241881fd7137a9 features: python: acceptHeaders: 3.0.0 @@ -1422,12 +1422,12 @@ trackedFiles: pristine_git_object: 67494d04412539e0cb0b406ef4e4cce61b3a6c87 docs/components/createguardrailrequest.mdx: id: c1a768f054c0 - last_write_checksum: sha1:8e8d8f957c48303ea3eb1955c182b26e8c2d5729 - pristine_git_object: f26042f6c6a5c769f5c13030df4f9e48a8077e6b + last_write_checksum: sha1:4be348500854ec5c2cb903ad498730b1893de714 + pristine_git_object: 1c7c87df72d92253b110e550066407bcd057ef87 docs/components/createguardrailresponse.mdx: id: 1477eebdf505 - last_write_checksum: sha1:5b260347acddb3d10bcb9283673646950b4b3c6b - pristine_git_object: e876cac85124ae1a612a2611c11e7039a7eed07a + last_write_checksum: sha1:15a74cf2abd149416117cc525e6fad918d536afc + pristine_git_object: b7e89dc116e820a8748af87b83e66f2706ec5599 docs/components/createobservabilitydestinationrequest.mdx: id: 8d942a601a6e last_write_checksum: sha1:968666d16e4c3b3249f7e533829d510c5c043179 @@ -2062,8 +2062,8 @@ trackedFiles: pristine_git_object: 5730056ada30b50ff129f1da9e021fe69310d5b7 docs/components/getguardrailresponse.mdx: id: a5ffd4aa91ea - last_write_checksum: sha1:511fa1f74b06e6f9c8b39ec95dbd976d31daa3fe - pristine_git_object: 7a49600a95781a703124f690ab3440201b3613fe + last_write_checksum: sha1:f1f2143e99650fb602f8c5a14c953b9e0b4ebecd + pristine_git_object: 0b5936faf7249661e98170af74382cfcd8b7b69c docs/components/getobservabilitydestinationresponse.mdx: id: fc89b94d297e last_write_checksum: sha1:43e6002bcb78df9ee766e6d97c08a6b238f8cae5 @@ -2082,8 +2082,8 @@ trackedFiles: pristine_git_object: bb16c1fd514e8e4d4f98dfbebd3a29bcdf8ee192 docs/components/guardrail.mdx: id: 91791d4c83b6 - last_write_checksum: sha1:071ca3eb0a6f158e4107d7f337c3f7a8e6ac95f8 - pristine_git_object: dc72fbb152e23a7e3903e9aa6479e68baf10f556 + last_write_checksum: sha1:d10ad674399ad65710d1dd4d4d20fc87d2317e14 + pristine_git_object: 7d6c170b4990eb92cc3e252c1ffa82836a4875c5 docs/components/guardrailinterval.mdx: id: ccedea0ab250 last_write_checksum: sha1:08342a9cceb4f7a5dc0b574a429d46af9d9a13f4 @@ -5006,12 +5006,12 @@ trackedFiles: pristine_git_object: 335feb18256a83af9c732525307d1432a718f3a1 docs/components/updateguardrailrequest.mdx: id: 450912b18db6 - last_write_checksum: sha1:7f4d97114ddca06c474d4a47ea585d6119d7ec89 - pristine_git_object: 6127914dd10312a4fc00e387c9af8d2d2f1a7150 + last_write_checksum: sha1:fe895becd42233f628907590d8cde52a7a0c2499 + pristine_git_object: be349dd72e39c127967315f3914d3f7fc6c6b71f docs/components/updateguardrailresponse.mdx: id: e00dc0a0c6e0 - last_write_checksum: sha1:528476cf3a4f15900eb0f4d293498450f0b5079a - pristine_git_object: 9c95861831e9f31f54efd7d48d8f48eece10e369 + last_write_checksum: sha1:9fa2b237c77138fad34fce39a922eeafb11964a8 + pristine_git_object: 7fd2bcafeabc1be627f99a868c06c6f597d04856 docs/components/updateobservabilitydestinationrequest.mdx: id: b54091567003 last_write_checksum: sha1:9ba0d6c18b145237efd307d621834669669838f8 @@ -5502,8 +5502,8 @@ trackedFiles: pristine_git_object: 89d6df049a07dd0c7fb980daeee97309cc3ce74a docs/operations/createguardrailrequest.mdx: id: 3d30aa9a4ec7 - last_write_checksum: sha1:0440e47100b0ce6309e6ea0d16b7e4e9be50ac59 - pristine_git_object: 906c993096e226923d9aac19bf0bb82ffd35936a + last_write_checksum: sha1:aa4af15191dde1fc6b51d7139be1ef3e35fabd28 + pristine_git_object: 645bf9a23e67ec35700da73403da763ceabcd34c docs/operations/createimagesglobals.mdx: id: 3eca6cb49159 last_write_checksum: sha1:9ac3837e42882bcb0edab9d0d801c0893d53d3e5 @@ -6114,8 +6114,8 @@ trackedFiles: pristine_git_object: 285cb55ce46435b741ac96d7f980a609067d432d docs/operations/listguardrailsresponse.mdx: id: b96388a22ab2 - last_write_checksum: sha1:0996fb66661b831820683fa58ca3c0819783aa1d - pristine_git_object: 519808b7794ecf8c5951991a0857cb27106fc130 + last_write_checksum: sha1:d2b73aa9c8f8f99290b92c0c891595ea01fab031 + pristine_git_object: 48f98d5e32fbde3b9fe06d53f93588e6bc351fdf docs/operations/listimagemodelendpointsglobals.mdx: id: ac044b2c8762 last_write_checksum: sha1:b8b8e4ba63cd49b7eb1b58f0d01c0c43d6cd6a43 @@ -6606,8 +6606,8 @@ trackedFiles: pristine_git_object: f262b34982a18293f5ae22bfbbf385010bfcdc9c docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa - last_write_checksum: sha1:a21e4a94d1ee8d031f862e23b9282f8977d38fc2 - pristine_git_object: 52efbd96250f06588fea44689bed93f27f2e0230 + last_write_checksum: sha1:a559f40ebf9b9f04680cc87be4aebfef34bbb6dd + pristine_git_object: db67983c1b2386a3ed60fb23a1610faca0785d69 docs/sdks/images/README.mdx: id: 534a6c102c4f last_write_checksum: sha1:1c0a9c704bdd9090f5a0a74f4d9ae0c4360707bb @@ -6658,16 +6658,16 @@ trackedFiles: pristine_git_object: 429ca7dad6a66516aec6bb1e674af1e09dc42dd5 docs/sdks/workspaces/README.mdx: id: 0c75d023ef6b - last_write_checksum: sha1:d44b36396b3773c8522f57b64fdd2b80a925d7f9 - pristine_git_object: 547d8b71101d58f89209eb7354d40cb96dce03fa + last_write_checksum: sha1:177cf8e7c0b14f92eadee9e7fbd1282ed6c8f679 + pristine_git_object: 0c43dff087b5657ea22168564472c35b7e81d63d py.typed: id: 258c3ed47ae4 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:7fff6806442d03388a1eeba7ced666a73f0b9e4b - pristine_git_object: b5955b6fb83f318988510683756edc44d54bf68d + last_write_checksum: sha1:836c2f803d896f76e749fcfbae9070ea43880710 + pristine_git_object: cc31c2921b9b60ab306c0e306efc843bf847ff03 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6694,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:6fc2a852500a272de2537814ccf9d5ecba9f032e - pristine_git_object: 4f9e877e356b1d5d1e23594d3f7de4c2f389c1f6 + last_write_checksum: sha1:94d5d591203cb4700f3decbcd7e864a271821999 + pristine_git_object: e72721452a9f36dce4f645bd1d995077867882a8 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -7370,8 +7370,8 @@ trackedFiles: pristine_git_object: fcfd9d646f216fdbb715cbbaefa4382d75750b79 src/openrouter/components/createguardrailrequest.py: id: 34d69149fb33 - last_write_checksum: sha1:4138e0c0ec26c3ec904a49846f9ed70f65227a0e - pristine_git_object: fb9dae6f51b5cd214cc05653f92014e87bc029ab + last_write_checksum: sha1:de39a253f2045f0185536b24c8a4983b9f96fb74 + pristine_git_object: 83ee2b358b34064762f7560d3c3c9fded954f8d4 src/openrouter/components/createguardrailresponse.py: id: b4e1bdf1de5b last_write_checksum: sha1:ae20a5e7425510c240e5697d847b1cae65940bd6 @@ -7654,8 +7654,8 @@ trackedFiles: pristine_git_object: acda534cb0ced2a391479b720434cf0f57f46276 src/openrouter/components/guardrail.py: id: 67ee78dd06e6 - last_write_checksum: sha1:d3c96a79c8f1b033378f4c2f21fd74c172457185 - pristine_git_object: b087dc33e958e24a59a4e04584d9af3d6538a990 + last_write_checksum: sha1:911c0b3d65f34d1bad1b55d963fc8d6394c6e25b + pristine_git_object: 7839f84e779127c3c97764efbf7434816245f5a6 src/openrouter/components/guardrailinterval.py: id: 01687fc135ab last_write_checksum: sha1:430f886f371b85777346de663202d62708cd84cf @@ -8822,8 +8822,8 @@ trackedFiles: pristine_git_object: a3664695c9722c531f7694851da76e51c2efe4fb src/openrouter/components/updateguardrailrequest.py: id: 6a557cd822a0 - last_write_checksum: sha1:cbdb7d942739143b727a64ad5330116c96aa6402 - pristine_git_object: d80389ace4e8b02227c7b1fab4496789761a26dd + last_write_checksum: sha1:b5377f5f986039b0ff74b9f5d1b8a45247b6c4b1 + pristine_git_object: 22e9f13f221efafeb7c2828e22c63cdc30cd86c4 src/openrouter/components/updateguardrailresponse.py: id: 7b068d26ce31 last_write_checksum: sha1:2b63cbb90747f07f775d9a22e80f74c67221fea8 @@ -9078,8 +9078,8 @@ trackedFiles: pristine_git_object: f6dbf5440466ba6b1d92442cad1b91e2b3587c52 src/openrouter/guardrails.py: id: 705839f34e66 - last_write_checksum: sha1:65e0cab899a38685f01c55aaac154d7c34e4cf71 - pristine_git_object: 0e06ce70572df1bf0dfc202de4fb6f918f27d1c5 + last_write_checksum: sha1:45c6fa317d2c33c9fc5c3b59ef6b0e2979ccc16a + pristine_git_object: b9fa12541a1210e1ba7b50c75ef9acf3c9ab0cbd src/openrouter/httpclient.py: id: e9311185443d last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 @@ -9602,8 +9602,8 @@ trackedFiles: pristine_git_object: 4a82cde858211c0f5a01b08980cee0e9e3d0f52c src/openrouter/workspaces.py: id: cd6c533b1802 - last_write_checksum: sha1:02edbeb467aca20ca454d2bc420aceefd6ef340c - pristine_git_object: d2088f5ad8c1adcd8824271f322b16bfe03731df + last_write_checksum: sha1:3c465ee2641e0d0b42b28de96788f0b38e825f75 + pristine_git_object: 0e31f05047b6c176effc21f3540fcffc9a2cb6b5 examples: createResponses: speakeasy-default-create-responses: @@ -11149,6 +11149,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: | - ## Python SDK Changes: - * `open_router.beta.responses.send()`: `response` **Changed** +releaseNotes: "## Python SDK Changes:\n* `open_router.guardrails.list()`: `response.data[].enforce_zdr_xai` **Added**\n* `open_router.guardrails.create()`: \n * `request.enforce_zdr_xai` **Added**\n * `response.data.enforce_zdr_xai` **Added**\n* `open_router.guardrails.get()`: `response.data.enforce_zdr_xai` **Added**\n* `open_router.guardrails.update()`: \n * `request.enforce_zdr_xai` **Added**\n * `response.data.enforce_zdr_xai` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 6bad913..2c82d29 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.30 + version: 0.11.31 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 504784f..e787443 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -6626,6 +6626,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false ignored_models: null ignored_providers: null limit_usd: 50 @@ -6683,7 +6684,7 @@ components: enforce_zdr: deprecated: true description: >- - Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. + Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. example: false nullable: true type: boolean @@ -6704,7 +6705,12 @@ components: type: boolean enforce_zdr_other: description: >- - Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. + Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. + example: false + nullable: true + type: boolean + enforce_zdr_xai: + description: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. example: false nullable: true type: boolean @@ -6768,6 +6774,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -9084,6 +9091,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -9264,6 +9272,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -9326,7 +9335,7 @@ components: enforce_zdr: deprecated: true description: >- - Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. + Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. example: false nullable: true type: boolean @@ -9347,7 +9356,12 @@ components: type: boolean enforce_zdr_other: description: >- - Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. + Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. + example: false + nullable: true + type: boolean + enforce_zdr_xai: + description: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. example: false nullable: true type: boolean @@ -11058,6 +11072,7 @@ components: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -22510,7 +22525,7 @@ components: enforce_zdr: deprecated: true description: >- - Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. + Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. example: true nullable: true type: boolean @@ -22531,7 +22546,12 @@ components: type: boolean enforce_zdr_other: description: >- - Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. + Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. + example: true + nullable: true + type: boolean + enforce_zdr_xai: + description: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. example: true nullable: true type: boolean @@ -22586,6 +22606,7 @@ components: enforce_zdr_google: true enforce_zdr_openai: true enforce_zdr_other: true + enforce_zdr_xai: true id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -28079,6 +28100,7 @@ paths: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false ignored_models: null ignored_providers: null limit_usd: 50 @@ -28105,6 +28127,7 @@ paths: enforce_zdr_google: false enforce_zdr_openai: true enforce_zdr_other: false + enforce_zdr_xai: false id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -28334,6 +28357,7 @@ paths: enforce_zdr_google: true enforce_zdr_openai: true enforce_zdr_other: true + enforce_zdr_xai: true id: 550e8400-e29b-41d4-a716-446655440000 ignored_models: null ignored_providers: null @@ -35533,7 +35557,7 @@ paths: /workspaces/{id}/members/remove: post: description: >- - Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. SCIM-managed members cannot be removed; changes must be made in your identity provider. [Management key](/docs/guides/overview/auth/management-api-keys) required. operationId: bulkRemoveWorkspaceMembers parameters: - description: The workspace ID (UUID) or slug diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 1152f69..3caf57a 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:c6936e0c99ab2b3eb7457eff0cd75cbdb6c29db355e576ef66d79f8e1537ca61 - sourceBlobDigest: sha256:24d9b45658f2838dd80fdea05a8ebb456d32fd16300e8e2f0f438aa54a8c91ee + sourceRevisionDigest: sha256:e41d9374b62c6364b29b039f24a6fa33b6e1aecd74f3d592b4e5dc0e8915f539 + sourceBlobDigest: sha256:3395078b604c8be9e707ef5d4bfc1861adb8b27ec5b3e960694744eb75dce17c tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:c6936e0c99ab2b3eb7457eff0cd75cbdb6c29db355e576ef66d79f8e1537ca61 - sourceBlobDigest: sha256:24d9b45658f2838dd80fdea05a8ebb456d32fd16300e8e2f0f438aa54a8c91ee + sourceRevisionDigest: sha256:e41d9374b62c6364b29b039f24a6fa33b6e1aecd74f3d592b4e5dc0e8915f539 + sourceBlobDigest: sha256:3395078b604c8be9e707ef5d4bfc1861adb8b27ec5b3e960694744eb75dce17c codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:5ffb925a925219f8c5a35ef3f8eb6b82780cd36ac1a2246ae78f35213af457e4 + codeSamplesRevisionDigest: sha256:4cb898e1201b335e38601e54fb5999ae9b324e5a45e518a0b443bd823affee26 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 4274290..8ccf878 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -408,4 +408,14 @@ Based on: ### Generated - [python v0.11.30] . ### Releases -- [PyPI v0.11.30] https://pypi.org/project/openrouter/0.11.30 - . \ No newline at end of file +- [PyPI v0.11.30] https://pypi.org/project/openrouter/0.11.30 - . + +## 2026-07-14 21:03:59 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.31] . +### Releases +- [PyPI v0.11.31] https://pypi.org/project/openrouter/0.11.31 - . \ No newline at end of file diff --git a/docs/components/createguardrailrequest.mdx b/docs/components/createguardrailrequest.mdx index f26042f..1c7c87d 100644 --- a/docs/components/createguardrailrequest.mdx +++ b/docs/components/createguardrailrequest.mdx @@ -4,21 +4,22 @@ title: "CreateGuardrailRequest" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. | false | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | -| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | +| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/createguardrailresponse.mdx b/docs/components/createguardrailresponse.mdx index e876cac..b7e89dc 100644 --- a/docs/components/createguardrailresponse.mdx +++ b/docs/components/createguardrailresponse.mdx @@ -4,6 +4,6 @@ title: "CreateGuardrailResponse" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file diff --git a/docs/components/getguardrailresponse.mdx b/docs/components/getguardrailresponse.mdx index 7a49600..0b5936f 100644 --- a/docs/components/getguardrailresponse.mdx +++ b/docs/components/getguardrailresponse.mdx @@ -4,6 +4,6 @@ title: "GetGuardrailResponse" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file diff --git a/docs/components/guardrail.mdx b/docs/components/guardrail.mdx index dc72fbb..7d6c170 100644 --- a/docs/components/guardrail.mdx +++ b/docs/components/guardrail.mdx @@ -4,24 +4,25 @@ title: "Guardrail" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs (immutable identifiers) | [
"openai/gpt-5.2-20251211",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"google"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | :heavy_minus_sign: | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters applied to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | Guardrail for production environment | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. | false | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs to exclude from routing | [
"openai/gpt-4o-mini-2024-07-18"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 100 | -| `name` | *str* | :heavy_check_mark: | Name of the guardrail | Production Guardrail | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `updated_at` | *OptionalNullable[str]* | :heavy_minus_sign: | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z | -| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this guardrail belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs (immutable identifiers) | [
"openai/gpt-5.2-20251211",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"google"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | :heavy_minus_sign: | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters applied to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | Guardrail for production environment | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs to exclude from routing | [
"openai/gpt-4o-mini-2024-07-18"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 100 | +| `name` | *str* | :heavy_check_mark: | Name of the guardrail | Production Guardrail | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `updated_at` | *OptionalNullable[str]* | :heavy_minus_sign: | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z | +| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this guardrail belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 | \ No newline at end of file diff --git a/docs/components/updateguardrailrequest.mdx b/docs/components/updateguardrailrequest.mdx index 6127914..be349dd 100644 --- a/docs/components/updateguardrailrequest.mdx +++ b/docs/components/updateguardrailrequest.mdx @@ -4,20 +4,21 @@ title: "UpdateGuardrailRequest" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | -| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. | true | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | -| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | +| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | +| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | \ No newline at end of file diff --git a/docs/components/updateguardrailresponse.mdx b/docs/components/updateguardrailresponse.mdx index 9c95861..7fd2bca 100644 --- a/docs/components/updateguardrailresponse.mdx +++ b/docs/components/updateguardrailresponse.mdx @@ -4,6 +4,6 @@ title: "UpdateGuardrailResponse" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
} | \ No newline at end of file diff --git a/docs/operations/createguardrailrequest.mdx b/docs/operations/createguardrailrequest.mdx index 906c993..645bf9a 100644 --- a/docs/operations/createguardrailrequest.mdx +++ b/docs/operations/createguardrailrequest.mdx @@ -4,9 +4,9 @@ title: "CreateGuardrailRequest" ## 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.
| | -| `create_guardrail_request` | [components.CreateGuardrailRequest](../components/createguardrailrequest.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"deepseek"
],
"content_filter_builtins": [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
],
"content_filters": null,
"description": "A guardrail for limiting API usage",
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 50,
"name": "My New Guardrail",
"reset_interval": "monthly"
} | \ No newline at end of file +| 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.
| | +| `create_guardrail_request` | [components.CreateGuardrailRequest](../components/createguardrailrequest.mdx) | :heavy_check_mark: | N/A | \{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"deepseek"
],
"content_filter_builtins": [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
],
"content_filters": null,
"description": "A guardrail for limiting API usage",
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 50,
"name": "My New Guardrail",
"reset_interval": "monthly"
} | \ No newline at end of file diff --git a/docs/operations/listguardrailsresponse.mdx b/docs/operations/listguardrailsresponse.mdx index 519808b..48f98d5 100644 --- a/docs/operations/listguardrailsresponse.mdx +++ b/docs/operations/listguardrailsresponse.mdx @@ -4,6 +4,6 @@ title: "ListGuardrailsResponse" ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `result` | [components.ListGuardrailsResponse](../components/listguardrailsresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}
],
"total_count": 1
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `result` | [components.ListGuardrailsResponse](../components/listguardrailsresponse.mdx) | :heavy_check_mark: | N/A | \{
"data": [
\{
"allowed_models": null,
"allowed_providers": [
"openai",
"anthropic",
"google"
],
"content_filter_builtins": [
\{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}
],
"total_count": 1
} | \ No newline at end of file diff --git a/docs/sdks/guardrails/README.mdx b/docs/sdks/guardrails/README.mdx index 52efbd9..db67983 100644 --- a/docs/sdks/guardrails/README.mdx +++ b/docs/sdks/guardrails/README.mdx @@ -96,7 +96,7 @@ with OpenRouter( "openai", "anthropic", "deepseek", - ], description="A guardrail for limiting API usage", enforce_zdr_anthropic=True, enforce_zdr_google=False, enforce_zdr_openai=True, enforce_zdr_other=False, ignored_models=None, ignored_providers=None, limit_usd=50, reset_interval="monthly") + ], description="A guardrail for limiting API usage", enforce_zdr_anthropic=True, enforce_zdr_google=False, enforce_zdr_openai=True, enforce_zdr_other=False, enforce_zdr_xai=False, ignored_models=None, ignored_providers=None, limit_usd=50, reset_interval="monthly") # Handle response print(res) @@ -105,28 +105,29 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | -| `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.
| | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | -| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. | false | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail | +| `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.
| | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [
\{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"
}
] | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage | +| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -265,28 +266,29 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | -| `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.
| | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | -| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | -| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | -| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | -| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | -| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | -| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. | true | -| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | -| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | -| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | -| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | -| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | +| `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.
| | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [
"openai/gpt-5.2"
] | +| `allowed_providers` | List[*str*] | :heavy_minus_sign: | New list of allowed provider IDs | [
"openai",
"anthropic",
"deepseek"
] | +| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. Set to null to remove. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [
\{
"action": "block",
"slug": "regex-prompt-injection"
}
] | +| `content_filters` | List[[components.ContentFilterEntry](../../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply. Set to null to remove. | null | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | New description for the guardrail | Updated description | +| `enforce_zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | true | +| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | true | +| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | true | +| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [
"openai/gpt-4o-mini"
] | +| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [
"azure"
] | +| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | New spending limit in USD | 75 | +| `name` | *Optional[str]* | :heavy_minus_sign: | New name for the guardrail | Updated Guardrail Name | +| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/workspaces/README.mdx b/docs/sdks/workspaces/README.mdx index 547d8b7..0c43dff 100644 --- a/docs/sdks/workspaces/README.mdx +++ b/docs/sdks/workspaces/README.mdx @@ -546,7 +546,7 @@ with OpenRouter( ## bulk_remove_members -Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. +Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. SCIM-managed members cannot be removed; changes must be made in your identity provider. [Management key](/docs/guides/overview/auth/management-api-keys) required. ### Example Usage diff --git a/pyproject.toml b/pyproject.toml index b5955b6..cc31c29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.30" +version = "0.11.31" 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 4f9e877..e727214 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.30" +__version__: str = "0.11.31" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.30 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.31 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/createguardrailrequest.py b/src/openrouter/components/createguardrailrequest.py index fb9dae6..83ee2b3 100644 --- a/src/openrouter/components/createguardrailrequest.py +++ b/src/openrouter/components/createguardrailrequest.py @@ -36,7 +36,7 @@ class CreateGuardrailRequestTypedDict(TypedDict): description: NotRequired[Nullable[str]] r"""Description of the guardrail""" enforce_zdr: NotRequired[Nullable[bool]] - r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" + r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" enforce_zdr_anthropic: NotRequired[Nullable[bool]] r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.""" enforce_zdr_google: NotRequired[Nullable[bool]] @@ -44,7 +44,9 @@ class CreateGuardrailRequestTypedDict(TypedDict): enforce_zdr_openai: NotRequired[Nullable[bool]] r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.""" enforce_zdr_other: NotRequired[Nullable[bool]] - r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.""" + r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided.""" + enforce_zdr_xai: NotRequired[Nullable[bool]] + r"""Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.""" ignored_models: NotRequired[Nullable[List[str]]] r"""Array of model identifiers to exclude from routing (slug or canonical_slug accepted)""" ignored_providers: NotRequired[Nullable[List[str]]] @@ -84,7 +86,7 @@ class CreateGuardrailRequest(BaseModel): deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ), ] = UNSET - r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" + r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" enforce_zdr_anthropic: OptionalNullable[bool] = UNSET r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.""" @@ -96,7 +98,10 @@ class CreateGuardrailRequest(BaseModel): r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.""" enforce_zdr_other: OptionalNullable[bool] = UNSET - r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.""" + r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided.""" + + enforce_zdr_xai: OptionalNullable[bool] = UNSET + r"""Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.""" ignored_models: OptionalNullable[List[str]] = UNSET r"""Array of model identifiers to exclude from routing (slug or canonical_slug accepted)""" @@ -127,6 +132,7 @@ class CreateGuardrailRequest(BaseModel): "enforce_zdr_google", "enforce_zdr_openai", "enforce_zdr_other", + "enforce_zdr_xai", "ignored_models", "ignored_providers", "limit_usd", @@ -146,6 +152,7 @@ class CreateGuardrailRequest(BaseModel): "enforce_zdr_google", "enforce_zdr_openai", "enforce_zdr_other", + "enforce_zdr_xai", "ignored_models", "ignored_providers", "limit_usd", diff --git a/src/openrouter/components/guardrail.py b/src/openrouter/components/guardrail.py index b087dc3..7839f84 100644 --- a/src/openrouter/components/guardrail.py +++ b/src/openrouter/components/guardrail.py @@ -42,7 +42,7 @@ class GuardrailTypedDict(TypedDict): description: NotRequired[Nullable[str]] r"""Description of the guardrail""" enforce_zdr: NotRequired[Nullable[bool]] - r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" + r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" enforce_zdr_anthropic: NotRequired[Nullable[bool]] r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.""" enforce_zdr_google: NotRequired[Nullable[bool]] @@ -50,7 +50,9 @@ class GuardrailTypedDict(TypedDict): enforce_zdr_openai: NotRequired[Nullable[bool]] r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.""" enforce_zdr_other: NotRequired[Nullable[bool]] - r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.""" + r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided.""" + enforce_zdr_xai: NotRequired[Nullable[bool]] + r"""Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.""" ignored_models: NotRequired[Nullable[List[str]]] r"""Array of model canonical_slugs to exclude from routing""" ignored_providers: NotRequired[Nullable[List[str]]] @@ -97,7 +99,7 @@ class Guardrail(BaseModel): deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ), ] = UNSET - r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" + r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" enforce_zdr_anthropic: OptionalNullable[bool] = UNSET r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.""" @@ -109,7 +111,10 @@ class Guardrail(BaseModel): r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.""" enforce_zdr_other: OptionalNullable[bool] = UNSET - r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.""" + r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided.""" + + enforce_zdr_xai: OptionalNullable[bool] = UNSET + r"""Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.""" ignored_models: OptionalNullable[List[str]] = UNSET r"""Array of model canonical_slugs to exclude from routing""" @@ -140,6 +145,7 @@ class Guardrail(BaseModel): "enforce_zdr_google", "enforce_zdr_openai", "enforce_zdr_other", + "enforce_zdr_xai", "ignored_models", "ignored_providers", "limit_usd", @@ -159,6 +165,7 @@ class Guardrail(BaseModel): "enforce_zdr_google", "enforce_zdr_openai", "enforce_zdr_other", + "enforce_zdr_xai", "ignored_models", "ignored_providers", "limit_usd", diff --git a/src/openrouter/components/updateguardrailrequest.py b/src/openrouter/components/updateguardrailrequest.py index d80389a..22e9f13 100644 --- a/src/openrouter/components/updateguardrailrequest.py +++ b/src/openrouter/components/updateguardrailrequest.py @@ -34,7 +34,7 @@ class UpdateGuardrailRequestTypedDict(TypedDict): description: NotRequired[Nullable[str]] r"""New description for the guardrail""" enforce_zdr: NotRequired[Nullable[bool]] - r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" + r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" enforce_zdr_anthropic: NotRequired[Nullable[bool]] r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.""" enforce_zdr_google: NotRequired[Nullable[bool]] @@ -42,7 +42,9 @@ class UpdateGuardrailRequestTypedDict(TypedDict): enforce_zdr_openai: NotRequired[Nullable[bool]] r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.""" enforce_zdr_other: NotRequired[Nullable[bool]] - r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.""" + r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided.""" + enforce_zdr_xai: NotRequired[Nullable[bool]] + r"""Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.""" ignored_models: NotRequired[Nullable[List[str]]] r"""Array of model identifiers to exclude from routing (slug or canonical_slug accepted)""" ignored_providers: NotRequired[Nullable[List[str]]] @@ -79,7 +81,7 @@ class UpdateGuardrailRequest(BaseModel): deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ), ] = UNSET - r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" + r"""Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.""" enforce_zdr_anthropic: OptionalNullable[bool] = UNSET r"""Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.""" @@ -91,7 +93,10 @@ class UpdateGuardrailRequest(BaseModel): r"""Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.""" enforce_zdr_other: OptionalNullable[bool] = UNSET - r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.""" + r"""Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided.""" + + enforce_zdr_xai: OptionalNullable[bool] = UNSET + r"""Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.""" ignored_models: OptionalNullable[List[str]] = UNSET r"""Array of model identifiers to exclude from routing (slug or canonical_slug accepted)""" @@ -122,6 +127,7 @@ class UpdateGuardrailRequest(BaseModel): "enforce_zdr_google", "enforce_zdr_openai", "enforce_zdr_other", + "enforce_zdr_xai", "ignored_models", "ignored_providers", "limit_usd", @@ -141,6 +147,7 @@ class UpdateGuardrailRequest(BaseModel): "enforce_zdr_google", "enforce_zdr_openai", "enforce_zdr_other", + "enforce_zdr_xai", "ignored_models", "ignored_providers", "limit_usd", diff --git a/src/openrouter/guardrails.py b/src/openrouter/guardrails.py index 0e06ce7..b9fa125 100644 --- a/src/openrouter/guardrails.py +++ b/src/openrouter/guardrails.py @@ -367,6 +367,7 @@ class Guardrails(BaseSDK): enforce_zdr_google: OptionalNullable[bool] = UNSET, enforce_zdr_openai: OptionalNullable[bool] = UNSET, enforce_zdr_other: OptionalNullable[bool] = UNSET, + enforce_zdr_xai: OptionalNullable[bool] = UNSET, ignored_models: OptionalNullable[Iterable[str]] = UNSET, ignored_providers: OptionalNullable[Iterable[str]] = UNSET, limit_usd: OptionalNullable[float] = UNSET, @@ -394,11 +395,12 @@ class Guardrails(BaseSDK): :param content_filter_builtins: Builtin content filters to apply. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only. :param content_filters: Custom regex content filters to apply to request messages :param description: Description of the guardrail - :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. + :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. :param enforce_zdr_anthropic: Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. :param enforce_zdr_google: Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. :param enforce_zdr_openai: Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. - :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. + :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. + :param enforce_zdr_xai: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. :param ignored_models: Array of model identifiers to exclude from routing (slug or canonical_slug accepted) :param ignored_providers: List of provider IDs to exclude from routing :param limit_usd: Spending limit in USD @@ -444,6 +446,7 @@ class Guardrails(BaseSDK): enforce_zdr_google=enforce_zdr_google, enforce_zdr_openai=enforce_zdr_openai, enforce_zdr_other=enforce_zdr_other, + enforce_zdr_xai=enforce_zdr_xai, ignored_models=utils.unmarshal( ignored_models, OptionalNullable[List[str]] ), @@ -578,6 +581,7 @@ class Guardrails(BaseSDK): enforce_zdr_google: OptionalNullable[bool] = UNSET, enforce_zdr_openai: OptionalNullable[bool] = UNSET, enforce_zdr_other: OptionalNullable[bool] = UNSET, + enforce_zdr_xai: OptionalNullable[bool] = UNSET, ignored_models: OptionalNullable[Iterable[str]] = UNSET, ignored_providers: OptionalNullable[Iterable[str]] = UNSET, limit_usd: OptionalNullable[float] = UNSET, @@ -605,11 +609,12 @@ class Guardrails(BaseSDK): :param content_filter_builtins: Builtin content filters to apply. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only. :param content_filters: Custom regex content filters to apply to request messages :param description: Description of the guardrail - :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. + :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. :param enforce_zdr_anthropic: Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. :param enforce_zdr_google: Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. :param enforce_zdr_openai: Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. - :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. + :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. + :param enforce_zdr_xai: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. :param ignored_models: Array of model identifiers to exclude from routing (slug or canonical_slug accepted) :param ignored_providers: List of provider IDs to exclude from routing :param limit_usd: Spending limit in USD @@ -655,6 +660,7 @@ class Guardrails(BaseSDK): enforce_zdr_google=enforce_zdr_google, enforce_zdr_openai=enforce_zdr_openai, enforce_zdr_other=enforce_zdr_other, + enforce_zdr_xai=enforce_zdr_xai, ignored_models=utils.unmarshal( ignored_models, OptionalNullable[List[str]] ), @@ -1301,6 +1307,7 @@ class Guardrails(BaseSDK): enforce_zdr_google: OptionalNullable[bool] = UNSET, enforce_zdr_openai: OptionalNullable[bool] = UNSET, enforce_zdr_other: OptionalNullable[bool] = UNSET, + enforce_zdr_xai: OptionalNullable[bool] = UNSET, ignored_models: OptionalNullable[Iterable[str]] = UNSET, ignored_providers: OptionalNullable[Iterable[str]] = UNSET, limit_usd: OptionalNullable[float] = UNSET, @@ -1328,11 +1335,12 @@ class Guardrails(BaseSDK): :param content_filter_builtins: Builtin content filters to apply. Set to null to remove. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only. :param content_filters: Custom regex content filters to apply. Set to null to remove. :param description: New description for the guardrail - :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. + :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. :param enforce_zdr_anthropic: Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. :param enforce_zdr_google: Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. :param enforce_zdr_openai: Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. - :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. + :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. + :param enforce_zdr_xai: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. :param ignored_models: Array of model identifiers to exclude from routing (slug or canonical_slug accepted) :param ignored_providers: List of provider IDs to exclude from routing :param limit_usd: New spending limit in USD @@ -1379,6 +1387,7 @@ class Guardrails(BaseSDK): enforce_zdr_google=enforce_zdr_google, enforce_zdr_openai=enforce_zdr_openai, enforce_zdr_other=enforce_zdr_other, + enforce_zdr_xai=enforce_zdr_xai, ignored_models=utils.unmarshal( ignored_models, OptionalNullable[List[str]] ), @@ -1512,6 +1521,7 @@ class Guardrails(BaseSDK): enforce_zdr_google: OptionalNullable[bool] = UNSET, enforce_zdr_openai: OptionalNullable[bool] = UNSET, enforce_zdr_other: OptionalNullable[bool] = UNSET, + enforce_zdr_xai: OptionalNullable[bool] = UNSET, ignored_models: OptionalNullable[Iterable[str]] = UNSET, ignored_providers: OptionalNullable[Iterable[str]] = UNSET, limit_usd: OptionalNullable[float] = UNSET, @@ -1539,11 +1549,12 @@ class Guardrails(BaseSDK): :param content_filter_builtins: Builtin content filters to apply. Set to null to remove. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only. :param content_filters: Custom regex content filters to apply. Set to null to remove. :param description: New description for the guardrail - :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. + :param enforce_zdr: Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. :param enforce_zdr_anthropic: Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. :param enforce_zdr_google: Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. :param enforce_zdr_openai: Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. - :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. + :param enforce_zdr_other: Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. + :param enforce_zdr_xai: Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. :param ignored_models: Array of model identifiers to exclude from routing (slug or canonical_slug accepted) :param ignored_providers: List of provider IDs to exclude from routing :param limit_usd: New spending limit in USD @@ -1590,6 +1601,7 @@ class Guardrails(BaseSDK): enforce_zdr_google=enforce_zdr_google, enforce_zdr_openai=enforce_zdr_openai, enforce_zdr_other=enforce_zdr_other, + enforce_zdr_xai=enforce_zdr_xai, ignored_models=utils.unmarshal( ignored_models, OptionalNullable[List[str]] ), diff --git a/src/openrouter/workspaces.py b/src/openrouter/workspaces.py index d2088f5..0e31f05 100644 --- a/src/openrouter/workspaces.py +++ b/src/openrouter/workspaces.py @@ -3068,7 +3068,7 @@ class Workspaces(BaseSDK): ) -> components.BulkRemoveWorkspaceMembersResponse: r"""Bulk remove members from a workspace - Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. SCIM-managed members cannot be removed; changes must be made in your identity provider. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The workspace ID (UUID) or slug :param user_ids: List of user IDs to remove from the workspace @@ -3220,7 +3220,7 @@ class Workspaces(BaseSDK): ) -> components.BulkRemoveWorkspaceMembersResponse: r"""Bulk remove members from a workspace - Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. + Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. SCIM-managed members cannot be removed; changes must be made in your identity provider. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The workspace ID (UUID) or slug :param user_ids: List of user IDs to remove from the workspace diff --git a/uv.lock b/uv.lock index 7c5e31e..ab46723 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.30" +version = "0.11.31" source = { editable = "." } dependencies = [ { name = "httpcore" }, From f07b760c241043c26ea9462baf51c9388179ac50 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 21:25:00 +0000 Subject: [PATCH 59/62] chore: update OpenAPI spec from monorepo (#451) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 5e05f05..7963af7 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -665,7 +665,9 @@ components: AnthropicCacheControlDirective: description: >- Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints - to the last cacheable block in the request. Currently supported for Anthropic Claude models. + to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache + breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter + converts them to the provider's native format. example: type: ephemeral properties: @@ -4459,7 +4461,9 @@ components: - $ref: '#/components/schemas/AnthropicCacheControlDirective' - properties: {} type: object - description: Cache control for the content part + description: >- + Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style + `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. example: ttl: 5m type: ephemeral @@ -4555,6 +4559,8 @@ components: properties: cache_control: $ref: '#/components/schemas/ChatContentCacheControl' + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpoint' text: type: string type: @@ -5048,6 +5054,11 @@ components: format: double nullable: true type: number + prompt_cache_key: + nullable: true + type: string + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptions' provider: $ref: '#/components/schemas/ProviderPreferences' reasoning: @@ -18444,8 +18455,9 @@ components: type: object PromptCacheBreakpoint: description: >- - Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker - is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. + Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block + carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on + providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. example: mode: explicit nullable: true From a3d8d7084d99b543c60eb879911aadb0d1339052 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 21:31:07 +0000 Subject: [PATCH 60/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.32=20(#452)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 210 +++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 14 +- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- .../anthropiccachecontroldirective.mdx | 2 +- .../anthropicdocumentblockparam.mdx | 16 +- docs/components/anthropicimageblockparam.mdx | 10 +- .../anthropicsearchresultblockparam.mdx | 16 +- docs/components/anthropictextblockparam.mdx | 12 +- docs/components/caching.mdx | 2 +- docs/components/chatcontentcachecontrol.mdx | 2 +- docs/components/chatcontenttext.mdx | 11 +- docs/components/chatfunctiontoolfunction.mdx | 2 +- docs/components/chatrequest.mdx | 4 +- docs/components/contentcompaction.mdx | 10 +- docs/components/contentservertooluse.mdx | 14 +- docs/components/contenttoolresult.mdx | 14 +- docs/components/contenttooluse.mdx | 14 +- .../components/contentwebsearchtoolresult.mdx | 12 +- docs/components/fusionservertoolconfig.mdx | 20 +- docs/components/inputtext.mdx | 10 +- docs/components/messagesrequest.mdx | 2 +- docs/components/promptcachebreakpoint.mdx | 2 +- docs/components/responsesrequest.mdx | 2 +- docs/components/tooladvisor20260301.mdx | 20 +- docs/components/toolbash20250124.mdx | 10 +- docs/components/toolcustom.mdx | 14 +- docs/components/tooltexteditor20250124.mdx | 10 +- docs/components/toolwebsearch20250305.mdx | 18 +- docs/components/toolwebsearch20260209.mdx | 20 +- docs/sdks/chat/README.mdx | 4 +- docs/sdks/presets/README.mdx | 8 +- docs/sdks/responses/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/chat.py | 74 +++++- .../anthropiccachecontroldirective.py | 4 +- .../components/anthropicdocumentblockparam.py | 4 +- .../components/anthropicimageblockparam.py | 4 +- .../anthropicsearchresultblockparam.py | 4 +- .../components/anthropictextblockparam.py | 4 +- .../components/chatcontentcachecontrol.py | 4 +- src/openrouter/components/chatcontenttext.py | 31 ++- src/openrouter/components/chatfunctiontool.py | 4 +- src/openrouter/components/chatrequest.py | 17 +- .../components/fusionservertoolconfig.py | 4 +- src/openrouter/components/inputtext.py | 4 +- .../components/messagesmessageparam.py | 20 +- src/openrouter/components/messagesrequest.py | 32 +-- .../components/promptcachebreakpoint.py | 4 +- src/openrouter/components/responsesrequest.py | 4 +- src/openrouter/presets.py | 34 ++- src/openrouter/responses.py | 16 +- uv.lock | 2 +- 55 files changed, 473 insertions(+), 334 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 082440b..9a1bbad 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: 71daa6f89575defb9d76a73e5fb672ae + docChecksum: d4956b75e623f552544bf0eee219fb15 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.31 - configChecksum: 96b0d171f179dadfbe9d5efdfff0c4c2 + releaseVersion: 0.11.32 + configChecksum: 2def3221df426fb9e1ca1fb865534f8e repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 056b9ee4-a227-4cc6-b7e0-3c97d424d043 - pristine_commit_hash: 9daff37b2becb50eb2fe167e87e1149e4213b27e - pristine_tree_hash: 26d42d8bfd711f5fb23141b6ab241881fd7137a9 + generation_id: c6eafc4f-1723-4a50-b64a-768ca4b13a2f + pristine_commit_hash: 2be2ba16cd458078a20e8dff747aed3a7eeba223 + pristine_tree_hash: d075876a76e82a3c03a6789df86ec9dfede361bb features: python: acceptHeaders: 3.0.0 @@ -234,8 +234,8 @@ trackedFiles: pristine_git_object: 44deb61a813fde8473d34e0a14ccaef643467e0d docs/components/anthropiccachecontroldirective.mdx: id: 5671704f9917 - last_write_checksum: sha1:03d0b8bed7d5dd448141a09c4515594bcc7ef3f2 - pristine_git_object: 5f755985a972da22e96483e3807cb2029ba18989 + last_write_checksum: sha1:a31ffcd83295557f5a070d96873408214676a2ea + pristine_git_object: 12b753fe8b98723cd210a3dac91402a026b1dfac docs/components/anthropiccachecontroldirectivetype.mdx: id: f5d844d35b58 last_write_checksum: sha1:9e513498c44431258e61e8fb25537d8f6c5d4f7d @@ -298,8 +298,8 @@ trackedFiles: pristine_git_object: 2b04c2483fceacf8300bb872ea0eed600970d160 docs/components/anthropicdocumentblockparam.mdx: id: ece98dcf04f6 - last_write_checksum: sha1:5a05c624a5a134bedac12d687f51621448627daf - pristine_git_object: 5a24251490513dca5c64fa3f8b29c80eafdcd331 + last_write_checksum: sha1:42f908ffe281fd4272a24d7eb874f76fbee47da9 + pristine_git_object: 1ed7b7cd83e412bdc9945f00a875bc681e0c96ee docs/components/anthropicdocumentblockparamcitations.mdx: id: 474518ae0167 last_write_checksum: sha1:798372e77425fd7127a318c75247ce44e6f1dbfd @@ -326,8 +326,8 @@ trackedFiles: pristine_git_object: c86bc52963eca6a9de705f418c56d17a4bf8ebc6 docs/components/anthropicimageblockparam.mdx: id: a85ff43edd3a - last_write_checksum: sha1:b2324840f7be26004674f2a59f5d66122b75437a - pristine_git_object: 2d95dd47a3b3f4551cd4a148f4936057a40587f5 + last_write_checksum: sha1:32a650d11a80f74059407954fa86eba2247fdf03 + pristine_git_object: 9be25eff134f6283b95213ba56fa2ee21c493a39 docs/components/anthropicimageblockparamsource.mdx: id: 82f05c79d5cb last_write_checksum: sha1:0939a26da32a1d150a58d6988b9ef8bbd49bacf4 @@ -382,8 +382,8 @@ trackedFiles: pristine_git_object: a538343b4f3fca39a44d3f208e702c482978c4f8 docs/components/anthropicsearchresultblockparam.mdx: id: 5c62b24b2c58 - last_write_checksum: sha1:a8acf36f4eb32d7d01a906f889f9c76e36786f24 - pristine_git_object: 517785e7ab5c58a8e41292572d2d581a0a0e3df7 + last_write_checksum: sha1:b6f01f3da19d4a430e66f5c47e90f31aa3fb0e29 + pristine_git_object: 89ae1afd55149a2e641d5330189fd5213aa7f05b docs/components/anthropicsearchresultblockparamcitations.mdx: id: e6a0db284ce9 last_write_checksum: sha1:20a8315824e11129d12d4d5c441e9fde3691a1f5 @@ -398,8 +398,8 @@ trackedFiles: pristine_git_object: 6f1e9ce880a0c3173ce7af4d14c8508b686b8ebc docs/components/anthropictextblockparam.mdx: id: bded5d409e91 - last_write_checksum: sha1:5c8b4dafc14fafa615c888b9cd207bac55ebb585 - pristine_git_object: 6d00495d81a02e202e2ae1346439d734a75df8f0 + last_write_checksum: sha1:ab2ebb14dd5e54bbadf4db4aa919d1b380b844b5 + pristine_git_object: 502d15e612cfe8df8b28ba89855683eee5f0ce4b docs/components/anthropictextblockparamtype.mdx: id: 7f03a13234b7 last_write_checksum: sha1:12c7718c5c0da4561914ed95dd6853873568bd05 @@ -758,8 +758,8 @@ trackedFiles: pristine_git_object: a7472d01b6de43fedfa76a9e608d67202a7ec529 docs/components/caching.mdx: id: edc8a0f8f37f - last_write_checksum: sha1:b4e6619f389c1440555ec567fbdcddbc9976e63e - pristine_git_object: d9c719912c5e82aa2bf9b02c54fb03c8d448ef83 + last_write_checksum: sha1:cce3835ca76b640b591de1307422aa4e391cde69 + pristine_git_object: 0d7013f54bed0390239fa49074a48d5b21711a28 docs/components/capabilitydescriptor.mdx: id: 34ac0e581d79 last_write_checksum: sha1:62ee9ccab6cec4572383cef654997ab4106d4676 @@ -810,8 +810,8 @@ trackedFiles: pristine_git_object: fdb10076d12248abeacfae19a1bd647d4a838eaa docs/components/chatcontentcachecontrol.mdx: id: 215e2356f770 - last_write_checksum: sha1:cf9c5e64dcedcccbab8d79499bea7bf76e86b1b9 - pristine_git_object: 250fd47f76c936c2e979b55caa6d4fb17b4a26ef + last_write_checksum: sha1:96bb8d2d2c51fc1b5208120f84ca175ddcd0346a + pristine_git_object: 6f1d2f8e0e284e16eeff1f0dbd03166260f3ac94 docs/components/chatcontentcachecontroltype.mdx: id: 93c1e9a9146e last_write_checksum: sha1:febb0b8575ef8fc009f71312d8fed2b596cf6d28 @@ -846,8 +846,8 @@ trackedFiles: pristine_git_object: 92c9c5c2ce23807bac9756e55803057921c34f24 docs/components/chatcontenttext.mdx: id: a2436d6c5c1c - last_write_checksum: sha1:dfda97beb6d5cdb859b9207798e34ed7ed4691f8 - pristine_git_object: a59dafe92bfb650c89244eaa89f00690fd8282d3 + last_write_checksum: sha1:bf50de67c2c4b71ef14a92a53507b1c28fa1cc5b + pristine_git_object: b31006bd9cd42c1afa9f936eb085af94ae786f4d docs/components/chatcontenttexttype.mdx: id: eb29ddb48a88 last_write_checksum: sha1:154a7cb1f0dcdc0ff60b5fcfe1ce5e86e08bb72f @@ -930,8 +930,8 @@ trackedFiles: pristine_git_object: bc9f2fa0780e97e0d13a2c10af27a5f3e666c0f5 docs/components/chatfunctiontoolfunction.mdx: id: b9f813a5b0c9 - last_write_checksum: sha1:1daf25e4f31b7013fcbcd43f86678ce1548c8423 - pristine_git_object: 7619eec425176b875101f822b806ff98a5d991c9 + last_write_checksum: sha1:649b1fe5d94d5613d6e902d5d96762be33e648eb + pristine_git_object: a6cf73c17fd5cf6752d09f7eb25a13fb8d9d4a02 docs/components/chatfunctiontoolfunctionfunction.mdx: id: 59c7a37a65c9 last_write_checksum: sha1:671313b618e2e45e37f94494b8bd88822aa4220a @@ -966,8 +966,8 @@ trackedFiles: pristine_git_object: 220be03bd674a257c2064c0455104959b3974a35 docs/components/chatrequest.mdx: id: 055812be14d8 - last_write_checksum: sha1:77fcd137afe54399a3eba5f08cf6e0ffda8cc242 - pristine_git_object: 1cc4f0f490833b0defa14840b69ea02f90820770 + last_write_checksum: sha1:8803f814796b25653c13db7cd2e167720d615499 + pristine_git_object: e831058c3a681c3f9e8896137e06d82d3c416a5a docs/components/chatrequesteffort.mdx: id: 703c73252ebd last_write_checksum: sha1:243510f188071a3f317dc06a07fbcfcedd3cf821 @@ -1242,8 +1242,8 @@ trackedFiles: pristine_git_object: 9a8e9eaadebb36e2836d73c4ed1867c5f1e564e7 docs/components/contentcompaction.mdx: id: 1923f9db3cff - last_write_checksum: sha1:59526732df9d4b5a69f3a79d1210493dff8d8898 - pristine_git_object: 39acf3a7dc4de67d2eb07a4e21e33e6cfdd2091f + last_write_checksum: sha1:db0ae20faae38b060e586c80655b79849bb4e18b + pristine_git_object: 87f9c8d7936595373ebeae59a265705db8df2721 docs/components/contentencryptedcontent.mdx: id: 0dc55809c394 last_write_checksum: sha1:97675b67fb3cdb6c892bbe01d2cd9e6bab5e4dec @@ -1354,8 +1354,8 @@ trackedFiles: pristine_git_object: f9c4eeefa07fcc73839934dd6b3d403fe7539da3 docs/components/contentservertooluse.mdx: id: 7b676db3a465 - last_write_checksum: sha1:65f0643d0a7af0e2ef8b4f2dc9a336b5a34b135c - pristine_git_object: 527a1c1ae4e8df68528db2404024b67348ab4b6c + last_write_checksum: sha1:b49ee690460e4de02996066b31e91bb1f4eb8400 + pristine_git_object: 86c112ede3a14c30546d1fb00f6526a5f854ced0 docs/components/contentthinking.mdx: id: c23024acf25a last_write_checksum: sha1:f3a989b8eb7a38f2705324263796f49a7e1722b6 @@ -1366,16 +1366,16 @@ trackedFiles: pristine_git_object: f07b01d7d44cc717b67e5648283c659fc02c72fa docs/components/contenttoolresult.mdx: id: a9a083b8900f - last_write_checksum: sha1:1a0bb46e6c27779f1f88da7eb87d0ae04acd62af - pristine_git_object: 4abde669843735aeb36b10c6a5992f8d6509cd40 + last_write_checksum: sha1:72b603d3efa32360cf6e8b6c718dd46718b0e98b + pristine_git_object: f83588a9c24d3172b8f8fd131cdc5aea073d0088 docs/components/contenttooluse.mdx: id: ad7fb52d642b - last_write_checksum: sha1:47f463246904b67a444c6072b1d927c1c6c223de - pristine_git_object: e29dae101a0e629b6cfa1473fc22d732e646ef55 + last_write_checksum: sha1:96dda7c7f895597f5f60c57b69936f77e14fc8ff + pristine_git_object: 7149ea56376799b7d485254b63acdda00e9713a4 docs/components/contentwebsearchtoolresult.mdx: id: d2401cf2f6b9 - last_write_checksum: sha1:b24e06b9ba722674a7fc4116eba838657914f166 - pristine_git_object: a2664d14e56d9f5ada405cee06d7f745e1a5a47b + last_write_checksum: sha1:d7ecfe7df3b1e89151edb59cd1525aab997b28b6 + pristine_git_object: 9a9180dcba1e86c7a26c5396f39bc4dafe160e96 docs/components/contentwebsearchtoolresulterror.mdx: id: e53d83e87e2b last_write_checksum: sha1:22dd4ec3f699feb7d8f22abff79623b427292e35 @@ -2010,8 +2010,8 @@ trackedFiles: pristine_git_object: 3c29bc4bd3bdf7037b9c3aa894180b8e4cae6098 docs/components/fusionservertoolconfig.mdx: id: 87976811b0c3 - last_write_checksum: sha1:99198fd63b66a6f465c444856fcfb35110f269fb - pristine_git_object: ec3ad69133064ba5a6911474a16a974a26963255 + last_write_checksum: sha1:267106d40b0f8e9a7601945753f7934b34084183 + pristine_git_object: 1247ee7797392ca5e7778a47b42932a97cc16203 docs/components/fusionservertoolconfigeffort.mdx: id: f5ce0fbc94aa last_write_checksum: sha1:4ce09a069b4eeae41ac1531027cf97dc4139927f @@ -2498,8 +2498,8 @@ trackedFiles: pristine_git_object: 2e56403330ecae1d43fd2e4d23976dfe5330c38d docs/components/inputtext.mdx: id: c8a97322a50a - last_write_checksum: sha1:58653e40ea0a33629dda40d2a11c8d21a75b0467 - pristine_git_object: ece32d6edb601578cdb56fc8b4a60e40bc089f22 + last_write_checksum: sha1:6f92abbb193a5d21cc129df4c5804b3f9161322d + pristine_git_object: 5908413083a34d8bdd34ed916610dc5eee0d6564 docs/components/inputtexttype.mdx: id: 91f958925357 last_write_checksum: sha1:42a8d9a6d3506e02f6024592691292b7ac255075 @@ -2770,8 +2770,8 @@ trackedFiles: pristine_git_object: cff8f3938a8bd5699d1111a6b1a926518d868da5 docs/components/messagesrequest.mdx: id: 762dd6b894c8 - last_write_checksum: sha1:8e06b3369eb4dee0ab5fee504e444cb5be1f2f3c - pristine_git_object: 2b25d420887ade7549b1848592fb24ed622b54f1 + last_write_checksum: sha1:a2837f5f14f370453c77fd6962dea4fa9fa43999 + pristine_git_object: 89b9780ced7cfd41a0f2b0296232df38e71b84ee docs/components/messagesrequestmetadata.mdx: id: facdcaeb2576 last_write_checksum: sha1:42bf112bc4f6d259c589906fd5f67c5342ab4c2d @@ -3898,8 +3898,8 @@ trackedFiles: pristine_git_object: 5fb1b765b2b0e46d40042f341bbcc91aa0d92762 docs/components/promptcachebreakpoint.mdx: id: c135956dc623 - last_write_checksum: sha1:1b0c9884eb9b6fe1d4fdf822c75cb566ead67e07 - pristine_git_object: 1d1ff6162c98c1639ea8e2e4dfa7f6d5cd7d3fcd + last_write_checksum: sha1:6df345ea99da1fdcae22895faa2ee36339ba7332 + pristine_git_object: 313ab84d0db5d181f8dea91208a4b5127f43477b docs/components/promptcachebreakpointmode.mdx: id: 05abe4e54869 last_write_checksum: sha1:f7ca9f8ff280c1fa750609f4aa13b0706d1dd7cd @@ -4246,8 +4246,8 @@ trackedFiles: pristine_git_object: 996cffee821435729436d7f29bce4333f4900382 docs/components/responsesrequest.mdx: id: 0dbcef40a4b1 - last_write_checksum: sha1:462f684189fca9eefc0809564ab964d89025724d - pristine_git_object: 371d94f398a631b4146a2a76b46dbd257637caba + last_write_checksum: sha1:51003cb482d6de367ebe0c4e2691bf41be8d384c + pristine_git_object: 3090f61cfb772d83d2ac230fb571ef3e048e423e docs/components/responsesrequestplugin.mdx: id: 4d550c41c85f last_write_checksum: sha1:ab9d1e6c062cd51fc976da6ccf393e9974171f7b @@ -4690,12 +4690,12 @@ trackedFiles: pristine_git_object: 54a7627079b16a50865cf6f2224abe36870c95fa docs/components/tooladvisor20260301.mdx: id: df2858dddd07 - last_write_checksum: sha1:94a6e30c4bc7ff7771b99d3f09c87604423b2847 - pristine_git_object: ee1f63bc170b35e5fb8da3390818160a2b4b93c6 + last_write_checksum: sha1:2dd846c19c5dabfeba4fe838ca60bd495c31e689 + pristine_git_object: a00186b54ba47296aed2eb1098928f3b4a565ceb docs/components/toolbash20250124.mdx: id: acc36fba0c55 - last_write_checksum: sha1:b0e3ad180f48dba955ae20481ae6ef55ace6b18f - pristine_git_object: d9f17ef27ea42b2251c85ffdd230af45f7293c75 + last_write_checksum: sha1:b899d22b5559c09fcaa14c5cd3ff18f914ad34d2 + pristine_git_object: d3a3ea6cfbc5118b9adad9c1a8e543e02fd2870f docs/components/toolcallstatus.mdx: id: e79e5ffbe798 last_write_checksum: sha1:338789050d562f0ac596d6a94783307e27a634b2 @@ -4734,12 +4734,12 @@ trackedFiles: pristine_git_object: 6817216b64de42e834ab68a072287701e621daa8 docs/components/toolcustom.mdx: id: b3ea2dbc7af5 - last_write_checksum: sha1:dd0734eb86cbbba753632268613a2f2ebc8e8f78 - pristine_git_object: 57073f649edd84b26f2395c46aef55c86e31ed4c + last_write_checksum: sha1:f0fdef1bc45a22946f6026d202499b63ff241711 + pristine_git_object: ce9be3cd6fbb03e8d15866baefa9f38c1398a91c docs/components/tooltexteditor20250124.mdx: id: 58d2a6f35f9f - last_write_checksum: sha1:bbc36d5c8d48b8971fed82553489759ca2379c0d - pristine_git_object: 0fe06a930a6a67a5a007185f892422f232389d3a + last_write_checksum: sha1:c785aecfc38109c995d4d2f825de0f145d3f626a + pristine_git_object: a7f1a2731ba8ab1deea97b51e63372e70e3afa0e docs/components/tooltypecustom.mdx: id: ac3c7f5f5fa6 last_write_checksum: sha1:bfbecb3b4e70cb8a4aa0379246f4ffbaae71b341 @@ -4750,12 +4750,12 @@ trackedFiles: pristine_git_object: 48e6f8afc2a41ccac4be220dd5d5d475a4d36b71 docs/components/toolwebsearch20250305.mdx: id: e583eb0b3bd1 - last_write_checksum: sha1:59297ba6e78d528a5a6cc0bcbefd1301c21af308 - pristine_git_object: 33510135de4236e72077c4acb6c8a8c65fe5f647 + last_write_checksum: sha1:a750dd139f327bf53d4cde02e6b897afa274475b + pristine_git_object: 36a096412525a09d1903488c804648047782b8be docs/components/toolwebsearch20260209.mdx: id: dfc99c1c297c - last_write_checksum: sha1:e3adde8067e2e5e5504165e7b8ebf1ca743d8352 - pristine_git_object: a70393e56b803a455f0ea3e82d9270ee84fed5fe + last_write_checksum: sha1:8237527944c9d8670c8c323ce8bec709602d8322 + pristine_git_object: 062b3155e1ffd04dae559ccc126ff8b922616aee docs/components/toomanyrequestsresponseerrordata.mdx: id: 282b92f982c7 last_write_checksum: sha1:976995e37e897805df9f3f50c0aae39e41447822 @@ -6574,8 +6574,8 @@ trackedFiles: pristine_git_object: 513bb72efe9f74672b1b60d6b45dc0aca282ddf6 docs/sdks/chat/README.mdx: id: 1dd859c23fe1 - last_write_checksum: sha1:b6c104dc6b0c3461a2264a95d886f860e7277780 - pristine_git_object: 390ca7cf2ff70cf7a4273cd1c8c13cb58eb32971 + last_write_checksum: sha1:afeaa6d1195ec68d845aa76038b47498826d48a3 + pristine_git_object: 70aca7d4ce8dd7f8356abc4d836e8bdc236e090f docs/sdks/classifications/README.mdx: id: 4786130ef02a last_write_checksum: sha1:87ea3518b4147ae7833b01da7be92d41a4b49df7 @@ -6630,8 +6630,8 @@ trackedFiles: pristine_git_object: 32a291cb837977e7cdd475c664e5d475660b2ba3 docs/sdks/presets/README.mdx: id: eeb505928d52 - last_write_checksum: sha1:0c1569e8db293c65840433adda49310960a591d1 - pristine_git_object: ef18762b9c9c42a26bf61c24af1607d7ce19c01a + last_write_checksum: sha1:77d23418817e3a4e1d7135bdbd21a61812c960ee + pristine_git_object: 82e78fb13dc1c886ea37068b24ad1e5c786b6052 docs/sdks/providers/README.mdx: id: 5ea9af111324 last_write_checksum: sha1:570b55655ee7602d3807c3218e450741f634eed6 @@ -6642,8 +6642,8 @@ trackedFiles: pristine_git_object: cd1b341b1b7c0284b9ba9b102bd8020e0d7ce707 docs/sdks/responses/README.mdx: id: abab319e080e - last_write_checksum: sha1:69540ef8f6a556c86c4ba8a6ebd4ed03e36ee927 - pristine_git_object: bbd2952598bc9e67b6080bf8ee53d7f6ac838d9c + last_write_checksum: sha1:2dbf6b499e85a4605d79d756e043f7bfbc633087 + pristine_git_object: 708c8a1312812b7d552b5e970f0fb8c27f61b4df docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 last_write_checksum: sha1:a8e68ac2b0bb8640e01d962177b42ab47b24898b @@ -6666,8 +6666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:836c2f803d896f76e749fcfbae9070ea43880710 - pristine_git_object: cc31c2921b9b60ab306c0e306efc843bf847ff03 + last_write_checksum: sha1:bd90540d9cd6c97085fa5fd5f08dbbbfa2899391 + pristine_git_object: f72d3afab559e9db67b290ca5e6337adfcda58c9 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6694,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:94d5d591203cb4700f3decbcd7e864a271821999 - pristine_git_object: e72721452a9f36dce4f645bd1d995077867882a8 + last_write_checksum: sha1:cffbb1cf67568b37538f51f21b858e0242adb9cf + pristine_git_object: 44f59a476730ba6703b7d5e088bbd3a81e21b362 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6726,8 +6726,8 @@ trackedFiles: pristine_git_object: 08b177b0b39e7f3581f1a5da13e245c3daddf9d5 src/openrouter/chat.py: id: 723fdce15c1d - last_write_checksum: sha1:79e9c02b4a16cae3c202b5ae0bfd6cd1d0d6f89b - pristine_git_object: ab93b1be035fe591f6c8fac84b57ecad89ff5b1a + last_write_checksum: sha1:2afda128e7af2900cfeeaf79cc5a52122da8c3a2 + pristine_git_object: f14c3b5188d6dfdefcc28aa685daa24276ae2990 src/openrouter/classifications.py: id: 4f2efc24b95b last_write_checksum: sha1:3ab6fcd9ef679cd2149ec8dfbb4a86109cd152ad @@ -6794,8 +6794,8 @@ trackedFiles: pristine_git_object: 870c2e75705a43762b7aa2797e5b0cde4fe40d87 src/openrouter/components/anthropiccachecontroldirective.py: id: ffa72802cd82 - last_write_checksum: sha1:c73ec323b8d1e650f51d91f00b824804e4b9f6c3 - pristine_git_object: a9292b2d0dc104b016f7bc2600275d87fbd9ecac + last_write_checksum: sha1:2c92e5081aa549627b961c97cfe0ba8d672a567c + pristine_git_object: 05b36d10c1f772110394071a9c90b1d9c31bf2c2 src/openrouter/components/anthropiccachecontrolttl.py: id: 2ec3e3546afe last_write_checksum: sha1:338e193bd6929eb6ed69da9bdb4e608e5db6121b @@ -6830,16 +6830,16 @@ trackedFiles: pristine_git_object: 50ad24f32ec87623c006381c477c46f44d84c753 src/openrouter/components/anthropicdocumentblockparam.py: id: 2c3093530540 - last_write_checksum: sha1:904f1546a7a69df231395f33cb5b1b71ae0c2611 - pristine_git_object: 686764bb6991204328c5017ab636e3d38a4f2f09 + last_write_checksum: sha1:43f9b964f383ea77663e47c9a1e1cd76b7457d2c + pristine_git_object: be2d48fefcffa05ca80bfa647f77fafe60872a7d src/openrouter/components/anthropicfiledocumentsource.py: id: d824b52285d7 last_write_checksum: sha1:5d3c89e2d60df0116aed28d9a2274cf61536af41 pristine_git_object: 06ab054ee7227cb2186c19c108145d8e19646044 src/openrouter/components/anthropicimageblockparam.py: id: 71cab07562d1 - last_write_checksum: sha1:7077151d8ef411a85bc3cdafb17ae7969c8bf7cb - pristine_git_object: 979d0464c4ef00aba59e1431a2bbd3568c411246 + last_write_checksum: sha1:fbdb3a017bc51cb2848933aca87023159951a2aa + pristine_git_object: 7b5effbbab60e15e1daa06ad703f445d3dde96b6 src/openrouter/components/anthropicimagemimetype.py: id: 2434bf06fc4f last_write_checksum: sha1:2016e4ef5d678a2af645d50cb02e022c3918d494 @@ -6866,16 +6866,16 @@ trackedFiles: pristine_git_object: d16f6dc9a2449185ef45731cbcd0a78c266745ef src/openrouter/components/anthropicsearchresultblockparam.py: id: bccb7c6b3128 - last_write_checksum: sha1:aa8fcc04743f07cf8a72b3cbfaae212524101700 - pristine_git_object: 5925732967541b0d598ac249f372e5b18f975b0d + last_write_checksum: sha1:8d073fef507a39b53421384ff9a5914fd9438493 + pristine_git_object: 14967a292ebe05517a28c98b1e241bd2fd03a572 src/openrouter/components/anthropicspeed.py: id: 7e39c29f3d89 last_write_checksum: sha1:19e37bf7ec082d89258f44674405811cc8a010ad pristine_git_object: 4f9c2bc739541b12c381e3d6265184af879cc1ff src/openrouter/components/anthropictextblockparam.py: id: f387daeeb940 - last_write_checksum: sha1:266f0b2002e313484812c69d4b85a7d84aeb0c2b - pristine_git_object: a6a70aa6825c515fb5c9c1358d011314df010b2d + last_write_checksum: sha1:d07d4bef39b0f763604a58604da6aa4cb7979590 + pristine_git_object: 31a1df2ee27149c8862fb8709f4898ef0535360f src/openrouter/components/anthropicthinkingdisplay.py: id: 5d63f1a15f67 last_write_checksum: sha1:388d60bbe78d3b848744564f91b31142d7bfc7e3 @@ -7102,8 +7102,8 @@ trackedFiles: pristine_git_object: b937a2df121366183d40d9f124c9f1bf21b798db src/openrouter/components/chatcontentcachecontrol.py: id: fa34483583b7 - last_write_checksum: sha1:e34eec1c61fdbf41456cb25b3704f4f26c7590ac - pristine_git_object: e23d40503368f1c30d2bd3335b9196fea2094c51 + last_write_checksum: sha1:b8a998d3dc83c8edd1a35c25846f59d01ff2649c + pristine_git_object: d60c7b13de35893537d9c6867c1e51a888dcc72d src/openrouter/components/chatcontentfile.py: id: 2a747b8033b8 last_write_checksum: sha1:1203efad65c0e72e18fa600bd8ebbc72a82340fa @@ -7118,8 +7118,8 @@ trackedFiles: pristine_git_object: 61415b0c78602a7fabc4bf7f62ac869bacf38195 src/openrouter/components/chatcontenttext.py: id: 5301d8af31e7 - last_write_checksum: sha1:8c30921c5e1530becb0f646866787aa3d1deab13 - pristine_git_object: 86d0a046b85b9caba7f628344d55febb71936ca9 + last_write_checksum: sha1:f4abea5885878b3c6aaacac28829fae85a7c25ce + pristine_git_object: 45f9d3e9873702cbffb4cd7078fff4fffe2b81d2 src/openrouter/components/chatcontentvideo.py: id: 42859cb5a9f4 last_write_checksum: sha1:f60354c6602613f3f8628ca29330a6037fcf20e9 @@ -7162,8 +7162,8 @@ trackedFiles: pristine_git_object: 7a6140f2b8afb0cde9b031322a4284c9cbce7e33 src/openrouter/components/chatfunctiontool.py: id: 1fcf92f8a7da - last_write_checksum: sha1:a18e2ed4c62125b690f3baa254a8c1763f647726 - pristine_git_object: a225159f24b91219a9f3d7292feefabd81515cf6 + last_write_checksum: sha1:bd0f773ec2135cbfdffb56db092587410c7e5daf + pristine_git_object: 69f8f1c4be7afa41b812c012d3cf1b0906efcf1b src/openrouter/components/chatjsonschemaconfig.py: id: d2278e414fab last_write_checksum: sha1:73791c8aa5f3dec4a25903dcc9c61118fc88a4f3 @@ -7182,8 +7182,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:e6f5dca8d7972b45dbb40d94867331ad0d1e09e7 - pristine_git_object: 914012755c34634740a1c91aa3f3f7b3da3f095e + last_write_checksum: sha1:2b4baaf4c3bf6d32c3514edfaab04ded9b71b001 + pristine_git_object: 4c79a21cfcf76239f27b251c35a5600839703c3a src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:2ff1963c54e7e79500115c8549c8d395f4e336d1 @@ -7610,8 +7610,8 @@ trackedFiles: pristine_git_object: 0015e263bbb2d817af89780610cc8f25ff852e73 src/openrouter/components/fusionservertoolconfig.py: id: 0d1d229c531f - last_write_checksum: sha1:df3f862acbedb4f4b3ed8b3e35f04fdf804b943f - pristine_git_object: e89fc6db28423e964f76e352ec20aa78763a8649 + last_write_checksum: sha1:ee754be65e6d2a35ed3f1f3985a0c3600116a6d0 + pristine_git_object: f7377d2de6c4e6129e8c7f9916200a06ae862afa src/openrouter/components/fusionsource.py: id: ce20a4a9f32f last_write_checksum: sha1:2141dd1dd9396035bf8070878c9ec945331514c8 @@ -7802,8 +7802,8 @@ trackedFiles: pristine_git_object: 39681f4c16af7831a14dcccf7447e742c8a2b43b src/openrouter/components/inputtext.py: id: a995ae96be99 - last_write_checksum: sha1:f78a6a35792b704f18ee6e1312c24f78f38cca36 - pristine_git_object: ab1dcb92e9370c9252ac5623a447669cca01e0ee + last_write_checksum: sha1:2da9ff645acc96772701908830151c5a707ed021 + pristine_git_object: 81a4151b3b1cdb6eb262a9ede28217b6c0afd1df src/openrouter/components/inputvideo.py: id: d262affd6f7e last_write_checksum: sha1:60c1792ab1f440ae67b5b451fd4d195e02783161 @@ -7922,16 +7922,16 @@ trackedFiles: pristine_git_object: 05b041967edf0ab2d8458f9f0fc3577f0a55fcfc src/openrouter/components/messagesmessageparam.py: id: ed8bbab6720d - last_write_checksum: sha1:4e5fb461702f78194596d7de570c7da25f05249e - pristine_git_object: 8a9738b371fb0ed0cd30d0bb7cc237fc7168eb92 + last_write_checksum: sha1:479cfffaf1013b89e92bb78ee7d5c5ad6646a1ca + pristine_git_object: e556cb06f6cf993616dd14191c43d6eca82edd7d src/openrouter/components/messagesoutputconfig.py: id: 54d1e297f740 last_write_checksum: sha1:01e41c73a07af6167f6934394f6e1f419f7ab878 pristine_git_object: 9b033dd8570e1d71ddb61a63a4b320d3003bd3ef src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:a14c123f9362720670a6cf4eb4bd55478d5fa376 - pristine_git_object: d2e30398f665dc6b5e8dac7f53bffab6e490d14b + last_write_checksum: sha1:31b9b9af3f04cb27796a56329b3ad8629c8ae33a + pristine_git_object: b4d8f657ed28a53d7cdd1dd963694631070d1e40 src/openrouter/components/messagessearchmodelsservertool.py: id: 53d755edb120 last_write_checksum: sha1:389786fc22ba4bb47b0a086b7aa321f2f04fe943 @@ -8362,8 +8362,8 @@ trackedFiles: pristine_git_object: a7c4599ac6ab794f54968f12cd6b15c3137a5159 src/openrouter/components/promptcachebreakpoint.py: id: f1e589a13300 - last_write_checksum: sha1:458ef5170c7c9ea1367dcfb090b1b28333aff73d - pristine_git_object: a082e2d9b4d27d0cffb7794279ab5fb9d9e06789 + last_write_checksum: sha1:ea0f5d81093058c261edd1937b4c7148989a203a + pristine_git_object: 13fbce26b5254ca66ebecfbbc8701d2002483399 src/openrouter/components/promptcacheoptions.py: id: 5c39fe555e03 last_write_checksum: sha1:77647b94fd80f6cfcae368bff4c87cbaf903a98e @@ -8538,8 +8538,8 @@ trackedFiles: pristine_git_object: f38c8edcb616d9e7cbd0f724fbb9d9f5aae014f9 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:f9f52d25db9ee9e72fbdf8491c47a3fc3a9971c7 - pristine_git_object: 6f97e56c468a1df21fc11fd4c3310fa648968c5f + last_write_checksum: sha1:52b22af092ebe8d61503b02aaaa806737ecd295f + pristine_git_object: 92873ed0edafcd63a858b859da883c1431f15e56 src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -9474,8 +9474,8 @@ trackedFiles: pristine_git_object: 31c74edd544c4ab7d4c5153a6d2888623ca66aed src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:6de7b3adbfe270bf5b492b1da06230b9f6cc35d5 - pristine_git_object: 250c20d191dfd4a999ab461d6d5d1f066e1cfbeb + last_write_checksum: sha1:3b194964b25c57db796921e561898ae7073b6cbf + pristine_git_object: 832689477bac35ba16b604b330fdb3720e90a3a4 src/openrouter/providers.py: id: debc4c48f149 last_write_checksum: sha1:11dbc607825edee8dcc84b39ee8171e097c47acf @@ -9490,8 +9490,8 @@ trackedFiles: pristine_git_object: 76378ffba1806e0ca66fc873db1a568be0becebb src/openrouter/responses.py: id: f2108fb635e1 - last_write_checksum: sha1:b0e886f229ea3a440be77c9a037de5ffcf824100 - pristine_git_object: fbf686bae92410678880d1bbdb8da82c04b1869d + last_write_checksum: sha1:cea59e9d4f9ff5a5c61bc69ab696f6a82d77c137 + pristine_git_object: 74419ce01c4c30820bb1e6103d2542b59d062d7a src/openrouter/sdk.py: id: ee9846c4c9c5 last_write_checksum: sha1:2247537eca7f88a8f36e53fe011904b98569ad52 @@ -11149,4 +11149,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.guardrails.list()`: `response.data[].enforce_zdr_xai` **Added**\n* `open_router.guardrails.create()`: \n * `request.enforce_zdr_xai` **Added**\n * `response.data.enforce_zdr_xai` **Added**\n* `open_router.guardrails.get()`: `response.data.enforce_zdr_xai` **Added**\n* `open_router.guardrails.update()`: \n * `request.enforce_zdr_xai` **Added**\n * `response.data.enforce_zdr_xai` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request` **Changed**\n * `response.choices[].message.content.union(Array)[].union(text).prompt_cache_breakpoint` **Added**\n* `open_router.presets.create_presets_chat_completions()`: `request` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 2c82d29..c453c67 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.31 + version: 0.11.32 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index e787443..0926697 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -671,7 +671,7 @@ components: type: object AnthropicCacheControlDirective: description: >- - Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. example: type: ephemeral properties: @@ -4458,7 +4458,8 @@ components: - $ref: '#/components/schemas/AnthropicCacheControlDirective' - properties: {} type: object - description: Cache control for the content part + description: >- + Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. example: ttl: 5m type: ephemeral @@ -4553,6 +4554,8 @@ components: properties: cache_control: $ref: '#/components/schemas/ChatContentCacheControl' + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpoint' text: type: string type: @@ -5047,6 +5050,11 @@ components: format: double nullable: true type: number + prompt_cache_key: + nullable: true + type: string + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptions' provider: $ref: '#/components/schemas/ProviderPreferences' reasoning: @@ -18337,7 +18345,7 @@ components: type: object PromptCacheBreakpoint: description: >- - Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. + Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. example: mode: explicit nullable: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3caf57a..efe462f 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:e41d9374b62c6364b29b039f24a6fa33b6e1aecd74f3d592b4e5dc0e8915f539 - sourceBlobDigest: sha256:3395078b604c8be9e707ef5d4bfc1861adb8b27ec5b3e960694744eb75dce17c + sourceRevisionDigest: sha256:7ba0690911aa50c921dd9903da84f01fc6f17c079b207e23cdf58ea361564199 + sourceBlobDigest: sha256:d60cb272a488a05daf5bfe8efc1b69083f75852bff82d8deea1714b429b4d4fc tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:e41d9374b62c6364b29b039f24a6fa33b6e1aecd74f3d592b4e5dc0e8915f539 - sourceBlobDigest: sha256:3395078b604c8be9e707ef5d4bfc1861adb8b27ec5b3e960694744eb75dce17c + sourceRevisionDigest: sha256:7ba0690911aa50c921dd9903da84f01fc6f17c079b207e23cdf58ea361564199 + sourceBlobDigest: sha256:d60cb272a488a05daf5bfe8efc1b69083f75852bff82d8deea1714b429b4d4fc codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:4cb898e1201b335e38601e54fb5999ae9b324e5a45e518a0b443bd823affee26 + codeSamplesRevisionDigest: sha256:f52550d8391f3b538a0b03a1f483c981fcb926e95bec37ffa581344cfaf0d1e8 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 8ccf878..d17bed8 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -418,4 +418,14 @@ Based on: ### Generated - [python v0.11.31] . ### Releases -- [PyPI v0.11.31] https://pypi.org/project/openrouter/0.11.31 - . \ No newline at end of file +- [PyPI v0.11.31] https://pypi.org/project/openrouter/0.11.31 - . + +## 2026-07-14 21:26:36 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.32] . +### Releases +- [PyPI v0.11.32] https://pypi.org/project/openrouter/0.11.32 - . \ No newline at end of file diff --git a/docs/components/anthropiccachecontroldirective.mdx b/docs/components/anthropiccachecontroldirective.mdx index 5f75598..12b753f 100644 --- a/docs/components/anthropiccachecontroldirective.mdx +++ b/docs/components/anthropiccachecontroldirective.mdx @@ -2,7 +2,7 @@ title: "AnthropicCacheControlDirective" --- -Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. +Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. ## Fields diff --git a/docs/components/anthropicdocumentblockparam.mdx b/docs/components/anthropicdocumentblockparam.mdx index 5a24251..1ed7b7c 100644 --- a/docs/components/anthropicdocumentblockparam.mdx +++ b/docs/components/anthropicdocumentblockparam.mdx @@ -4,11 +4,11 @@ title: "AnthropicDocumentBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `citations` | [OptionalNullable[components.AnthropicDocumentBlockParamCitations]](../components/anthropicdocumentblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | -| `context` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `source` | [components.AnthropicDocumentBlockParamSourceUnion](../components/anthropicdocumentblockparamsourceunion.mdx) | :heavy_check_mark: | N/A | | -| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `type` | [components.TypeDocument](../components/typedocument.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `citations` | [OptionalNullable[components.AnthropicDocumentBlockParamCitations]](../components/anthropicdocumentblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | +| `context` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `source` | [components.AnthropicDocumentBlockParamSourceUnion](../components/anthropicdocumentblockparamsourceunion.mdx) | :heavy_check_mark: | N/A | | +| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `type` | [components.TypeDocument](../components/typedocument.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/anthropicimageblockparam.mdx b/docs/components/anthropicimageblockparam.mdx index 2d95dd4..9be25ef 100644 --- a/docs/components/anthropicimageblockparam.mdx +++ b/docs/components/anthropicimageblockparam.mdx @@ -4,8 +4,8 @@ title: "AnthropicImageBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `source` | [components.AnthropicImageBlockParamSource](../components/anthropicimageblockparamsource.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.AnthropicImageBlockParamType](../components/anthropicimageblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `source` | [components.AnthropicImageBlockParamSource](../components/anthropicimageblockparamsource.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.AnthropicImageBlockParamType](../components/anthropicimageblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/anthropicsearchresultblockparam.mdx b/docs/components/anthropicsearchresultblockparam.mdx index 517785e..89ae1af 100644 --- a/docs/components/anthropicsearchresultblockparam.mdx +++ b/docs/components/anthropicsearchresultblockparam.mdx @@ -4,11 +4,11 @@ title: "AnthropicSearchResultBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `citations` | [Optional[components.AnthropicSearchResultBlockParamCitations]](../components/anthropicsearchresultblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | -| `content` | List[[components.AnthropicTextBlockParam](../components/anthropictextblockparam.mdx)] | :heavy_check_mark: | N/A | | -| `source` | *str* | :heavy_check_mark: | N/A | | -| `title` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.AnthropicSearchResultBlockParamType](../components/anthropicsearchresultblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `citations` | [Optional[components.AnthropicSearchResultBlockParamCitations]](../components/anthropicsearchresultblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | +| `content` | List[[components.AnthropicTextBlockParam](../components/anthropictextblockparam.mdx)] | :heavy_check_mark: | N/A | | +| `source` | *str* | :heavy_check_mark: | N/A | | +| `title` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.AnthropicSearchResultBlockParamType](../components/anthropicsearchresultblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/anthropictextblockparam.mdx b/docs/components/anthropictextblockparam.mdx index 6d00495..502d15e 100644 --- a/docs/components/anthropictextblockparam.mdx +++ b/docs/components/anthropictextblockparam.mdx @@ -4,9 +4,9 @@ title: "AnthropicTextBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `citations` | List[[components.Citation](../components/citation.mdx)] | :heavy_minus_sign: | N/A | | -| `text` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.AnthropicTextBlockParamType](../components/anthropictextblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `citations` | List[[components.Citation](../components/citation.mdx)] | :heavy_minus_sign: | N/A | | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.AnthropicTextBlockParamType](../components/anthropictextblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/caching.mdx b/docs/components/caching.mdx index d9c7199..0d7013f 100644 --- a/docs/components/caching.mdx +++ b/docs/components/caching.mdx @@ -2,7 +2,7 @@ title: "Caching" --- -Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. +Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. ## Fields diff --git a/docs/components/chatcontentcachecontrol.mdx b/docs/components/chatcontentcachecontrol.mdx index 250fd47..6f1d2f8 100644 --- a/docs/components/chatcontentcachecontrol.mdx +++ b/docs/components/chatcontentcachecontrol.mdx @@ -2,7 +2,7 @@ title: "ChatContentCacheControl" --- -Cache control for the content part +Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. ## Fields diff --git a/docs/components/chatcontenttext.mdx b/docs/components/chatcontenttext.mdx index a59dafe..b31006b 100644 --- a/docs/components/chatcontenttext.mdx +++ b/docs/components/chatcontenttext.mdx @@ -7,8 +7,9 @@ Text content part ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Cache control for the content part | \{
"ttl": "5m",
"type": "ephemeral"
} | -| `text` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.ChatContentTextType](../components/chatcontenttexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. | \{
"ttl": "5m",
"type": "ephemeral"
} | +| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. | \{
"mode": "explicit"
} | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.ChatContentTextType](../components/chatcontenttexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/chatfunctiontoolfunction.mdx b/docs/components/chatfunctiontoolfunction.mdx index 7619eec..a6cf73c 100644 --- a/docs/components/chatfunctiontoolfunction.mdx +++ b/docs/components/chatfunctiontoolfunction.mdx @@ -6,6 +6,6 @@ title: "ChatFunctionToolFunction" | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Cache control for the content part | \{
"ttl": "5m",
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. | \{
"ttl": "5m",
"type": "ephemeral"
} | | `function` | [components.ChatFunctionToolFunctionFunction](../components/chatfunctiontoolfunctionfunction.mdx) | :heavy_check_mark: | Function definition for tool calling | \{
"description": "Get the current weather for a location",
"name": "get_weather",
"parameters": \{
"properties": \{
"location": \{
"description": "City name",
"type": "string"
}
},
"required": [
"location"
],
"type": "object"
}
} | | `type` | [components.ChatFunctionToolType](../components/chatfunctiontooltype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/chatrequest.mdx b/docs/components/chatrequest.mdx index 1cc4f0f..e831058 100644 --- a/docs/components/chatrequest.mdx +++ b/docs/components/chatrequest.mdx @@ -9,7 +9,7 @@ Chat completion request parameters | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | @@ -26,6 +26,8 @@ Chat completion request parameters | `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. | true | | `plugins` | List[[components.ChatRequestPlugin](../components/chatrequestplugin.mdx)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../components/chatrequestreasoning.mdx) | :heavy_minus_sign: | Configuration options for reasoning models | \{
"effort": "medium",
"summary": "concise"
} | | `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../components/chatrequestreasoningeffort.mdx) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | diff --git a/docs/components/contentcompaction.mdx b/docs/components/contentcompaction.mdx index 39acf3a..87f9c8d 100644 --- a/docs/components/contentcompaction.mdx +++ b/docs/components/contentcompaction.mdx @@ -4,8 +4,8 @@ title: "ContentCompaction" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `content` | *Nullable[str]* | :heavy_check_mark: | N/A | | -| `type` | [components.MessagesMessageParamTypeCompaction](../components/messagesmessageparamtypecompaction.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `content` | *Nullable[str]* | :heavy_check_mark: | N/A | | +| `type` | [components.MessagesMessageParamTypeCompaction](../components/messagesmessageparamtypecompaction.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contentservertooluse.mdx b/docs/components/contentservertooluse.mdx index 527a1c1..86c112e 100644 --- a/docs/components/contentservertooluse.mdx +++ b/docs/components/contentservertooluse.mdx @@ -4,10 +4,10 @@ title: "ContentServerToolUse" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `id` | *str* | :heavy_check_mark: | N/A | | -| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | -| `name` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeServerToolUse](../components/typeservertooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `id` | *str* | :heavy_check_mark: | N/A | | +| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | +| `name` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeServerToolUse](../components/typeservertooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contenttoolresult.mdx b/docs/components/contenttoolresult.mdx index 4abde66..f83588a 100644 --- a/docs/components/contenttoolresult.mdx +++ b/docs/components/contenttoolresult.mdx @@ -4,10 +4,10 @@ title: "ContentToolResult" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `content` | [Optional[components.MessagesMessageParamContentUnion2]](../components/messagesmessageparamcontentunion2.mdx) | :heavy_minus_sign: | N/A | | -| `is_error` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeToolResult](../components/typetoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `content` | [Optional[components.MessagesMessageParamContentUnion2]](../components/messagesmessageparamcontentunion2.mdx) | :heavy_minus_sign: | N/A | | +| `is_error` | *Optional[bool]* | :heavy_minus_sign: | N/A | | +| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeToolResult](../components/typetoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contenttooluse.mdx b/docs/components/contenttooluse.mdx index e29dae1..7149ea5 100644 --- a/docs/components/contenttooluse.mdx +++ b/docs/components/contenttooluse.mdx @@ -4,10 +4,10 @@ title: "ContentToolUse" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `id` | *str* | :heavy_check_mark: | N/A | | -| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | -| `name` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeToolUse](../components/typetooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `id` | *str* | :heavy_check_mark: | N/A | | +| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | +| `name` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeToolUse](../components/typetooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contentwebsearchtoolresult.mdx b/docs/components/contentwebsearchtoolresult.mdx index a2664d1..9a9180d 100644 --- a/docs/components/contentwebsearchtoolresult.mdx +++ b/docs/components/contentwebsearchtoolresult.mdx @@ -4,9 +4,9 @@ title: "ContentWebSearchToolResult" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `content` | [components.MessagesMessageParamContentUnion3](../components/messagesmessageparamcontentunion3.mdx) | :heavy_check_mark: | N/A | | -| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeWebSearchToolResult](../components/typewebsearchtoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `content` | [components.MessagesMessageParamContentUnion3](../components/messagesmessageparamcontentunion3.mdx) | :heavy_check_mark: | N/A | | +| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeWebSearchToolResult](../components/typewebsearchtoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/fusionservertoolconfig.mdx b/docs/components/fusionservertoolconfig.mdx index ec3ad69..1247ee7 100644 --- a/docs/components/fusionservertoolconfig.mdx +++ b/docs/components/fusionservertoolconfig.mdx @@ -7,13 +7,13 @@ Configuration for the openrouter:fusion server tool. ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `analysis_models` | List[*str*] | :heavy_minus_sign: | Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion. | [
"~anthropic/claude-opus-latest",
"~openai/gpt-latest",
"~google/gemini-pro-latest"
] | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000. | 16384 | -| `max_tool_calls` | *Optional[int]* | :heavy_minus_sign: | Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16. | 12 | -| `model` | *Optional[str]* | :heavy_minus_sign: | Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request. | ~anthropic/claude-opus-latest | -| `reasoning` | [Optional[components.FusionServerToolConfigReasoning]](../components/fusionservertoolconfigreasoning.mdx) | :heavy_minus_sign: | Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking. | | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies. | 0.7 | -| `tools` | List[[components.FusionServerToolConfigTool](../components/fusionservertoolconfigtool.mdx)] | :heavy_minus_sign: | Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only). | [
\{
"parameters": \{
"excluded_domains": [
"example.com"
]
},
"type": "openrouter:web_search"
},
\{
"type": "openrouter:web_fetch"
}
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `analysis_models` | List[*str*] | :heavy_minus_sign: | Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion. | [
"~anthropic/claude-opus-latest",
"~openai/gpt-latest",
"~google/gemini-pro-latest"
] | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000. | 16384 | +| `max_tool_calls` | *Optional[int]* | :heavy_minus_sign: | Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16. | 12 | +| `model` | *Optional[str]* | :heavy_minus_sign: | Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request. | ~anthropic/claude-opus-latest | +| `reasoning` | [Optional[components.FusionServerToolConfigReasoning]](../components/fusionservertoolconfigreasoning.mdx) | :heavy_minus_sign: | Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking. | | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies. | 0.7 | +| `tools` | List[[components.FusionServerToolConfigTool](../components/fusionservertoolconfigtool.mdx)] | :heavy_minus_sign: | Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only). | [
\{
"parameters": \{
"excluded_domains": [
"example.com"
]
},
"type": "openrouter:web_search"
},
\{
"type": "openrouter:web_fetch"
}
] | \ No newline at end of file diff --git a/docs/components/inputtext.mdx b/docs/components/inputtext.mdx index ece32d6..5908413 100644 --- a/docs/components/inputtext.mdx +++ b/docs/components/inputtext.mdx @@ -7,8 +7,8 @@ Text input content item ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit"
} | -| `text` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. | \{
"mode": "explicit"
} | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/messagesrequest.mdx b/docs/components/messagesrequest.mdx index 2b25d42..89b9780 100644 --- a/docs/components/messagesrequest.mdx +++ b/docs/components/messagesrequest.mdx @@ -9,7 +9,7 @@ Request schema for Anthropic Messages API endpoint | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `context_management` | [OptionalNullable[components.ContextManagement]](../components/contextmanagement.mdx) | :heavy_minus_sign: | N/A | | | `fallbacks` | List[[components.MessagesFallbackParam](../components/messagesfallbackparam.mdx)] | :heavy_minus_sign: | Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. | [
\{
"model": "claude-opus-4-8"
}
] | | `max_tokens` | *Optional[int]* | :heavy_minus_sign: | N/A | | diff --git a/docs/components/promptcachebreakpoint.mdx b/docs/components/promptcachebreakpoint.mdx index 1d1ff61..313ab84 100644 --- a/docs/components/promptcachebreakpoint.mdx +++ b/docs/components/promptcachebreakpoint.mdx @@ -2,7 +2,7 @@ title: "PromptCacheBreakpoint" --- -Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. +Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. ## Fields diff --git a/docs/components/responsesrequest.mdx b/docs/components/responsesrequest.mdx index 371d94f..3090f61 100644 --- a/docs/components/responsesrequest.mdx +++ b/docs/components/responsesrequest.mdx @@ -10,7 +10,7 @@ Request schema for Responses endpoint | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | diff --git a/docs/components/tooladvisor20260301.mdx b/docs/components/tooladvisor20260301.mdx index ee1f63b..a00186b 100644 --- a/docs/components/tooladvisor20260301.mdx +++ b/docs/components/tooladvisor20260301.mdx @@ -4,13 +4,13 @@ title: "ToolAdvisor20260301" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `caching` | [OptionalNullable[components.Caching]](../components/caching.mdx) | :heavy_minus_sign: | N/A | \{
"type": "ephemeral"
} | -| `defer_loading` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `max_uses` | *Optional[int]* | :heavy_minus_sign: | N/A | | -| `model` | *str* | :heavy_check_mark: | N/A | | -| `name` | [components.NameAdvisor](../components/nameadvisor.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeAdvisor20260301](../components/typeadvisor20260301.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `caching` | [OptionalNullable[components.Caching]](../components/caching.mdx) | :heavy_minus_sign: | N/A | \{
"type": "ephemeral"
} | +| `defer_loading` | *Optional[bool]* | :heavy_minus_sign: | N/A | | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | N/A | | +| `model` | *str* | :heavy_check_mark: | N/A | | +| `name` | [components.NameAdvisor](../components/nameadvisor.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeAdvisor20260301](../components/typeadvisor20260301.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/toolbash20250124.mdx b/docs/components/toolbash20250124.mdx index d9f17ef..d3a3ea6 100644 --- a/docs/components/toolbash20250124.mdx +++ b/docs/components/toolbash20250124.mdx @@ -4,8 +4,8 @@ title: "ToolBash20250124" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `name` | [components.NameBash](../components/namebash.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeBash20250124](../components/typebash20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `name` | [components.NameBash](../components/namebash.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeBash20250124](../components/typebash20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/toolcustom.mdx b/docs/components/toolcustom.mdx index 57073f6..ce9be3c 100644 --- a/docs/components/toolcustom.mdx +++ b/docs/components/toolcustom.mdx @@ -4,10 +4,10 @@ title: "ToolCustom" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | | -| `input_schema` | [components.InputSchema](../components/inputschema.mdx) | :heavy_check_mark: | N/A | | -| `name` | *str* | :heavy_check_mark: | N/A | | -| `type` | [Optional[components.ToolTypeCustom]](../components/tooltypecustom.mdx) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `input_schema` | [components.InputSchema](../components/inputschema.mdx) | :heavy_check_mark: | N/A | | +| `name` | *str* | :heavy_check_mark: | N/A | | +| `type` | [Optional[components.ToolTypeCustom]](../components/tooltypecustom.mdx) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/tooltexteditor20250124.mdx b/docs/components/tooltexteditor20250124.mdx index 0fe06a9..a7f1a27 100644 --- a/docs/components/tooltexteditor20250124.mdx +++ b/docs/components/tooltexteditor20250124.mdx @@ -4,8 +4,8 @@ title: "ToolTextEditor20250124" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `name` | [components.NameStrReplaceEditor](../components/namestrreplaceeditor.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeTextEditor20250124](../components/typetexteditor20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `name` | [components.NameStrReplaceEditor](../components/namestrreplaceeditor.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeTextEditor20250124](../components/typetexteditor20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/toolwebsearch20250305.mdx b/docs/components/toolwebsearch20250305.mdx index 3351013..36a0964 100644 --- a/docs/components/toolwebsearch20250305.mdx +++ b/docs/components/toolwebsearch20250305.mdx @@ -4,12 +4,12 @@ title: "ToolWebSearch20250305" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `name` | [components.NameWebSearch1](../components/namewebsearch1.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeWebSearch20250305](../components/typewebsearch20250305.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | +| `name` | [components.NameWebSearch1](../components/namewebsearch1.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeWebSearch20250305](../components/typewebsearch20250305.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/components/toolwebsearch20260209.mdx b/docs/components/toolwebsearch20260209.mdx index a70393e..062b315 100644 --- a/docs/components/toolwebsearch20260209.mdx +++ b/docs/components/toolwebsearch20260209.mdx @@ -4,13 +4,13 @@ title: "ToolWebSearch20260209" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | -| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `name` | [components.NameWebSearch2](../components/namewebsearch2.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeWebSearch20260209](../components/typewebsearch20260209.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | +| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | +| `name` | [components.NameWebSearch2](../components/namewebsearch2.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeWebSearch20260209](../components/typewebsearch20260209.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/sdks/chat/README.mdx b/docs/sdks/chat/README.mdx index 390ca7c..70aca7d 100644 --- a/docs/sdks/chat/README.mdx +++ b/docs/sdks/chat/README.mdx @@ -84,7 +84,7 @@ with OpenRouter( | `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.
| | | `x_open_router_metadata` | [Optional[components.MetadataLevel]](../../components/metadatalevel.mdx) | :heavy_minus_sign: | Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. | enabled | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | @@ -100,6 +100,8 @@ with OpenRouter( | `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. | true | | `plugins` | List[[components.ChatRequestPlugin](../../components/chatrequestplugin.mdx)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.mdx) | :heavy_minus_sign: | Configuration options for reasoning models | \{
"effort": "medium",
"summary": "concise"
} | | `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../../components/chatrequestreasoningeffort.mdx) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | diff --git a/docs/sdks/presets/README.mdx b/docs/sdks/presets/README.mdx index ef18762..82e78fb 100644 --- a/docs/sdks/presets/README.mdx +++ b/docs/sdks/presets/README.mdx @@ -160,7 +160,7 @@ with OpenRouter( | `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.
| | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | @@ -176,6 +176,8 @@ with OpenRouter( | `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. | true | | `plugins` | List[[components.ChatRequestPlugin](../../components/chatrequestplugin.mdx)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.mdx) | :heavy_minus_sign: | Configuration options for reasoning models | \{
"effort": "medium",
"summary": "concise"
} | | `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../../components/chatrequestreasoningeffort.mdx) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | @@ -255,7 +257,7 @@ with OpenRouter( | `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.
| | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `context_management` | [OptionalNullable[components.ContextManagement]](../../components/contextmanagement.mdx) | :heavy_minus_sign: | N/A | | | `fallbacks` | List[[components.MessagesFallbackParam](../../components/messagesfallbackparam.mdx)] | :heavy_minus_sign: | Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. | [
\{
"model": "claude-opus-4-8"
}
] | | `max_tokens` | *Optional[int]* | :heavy_minus_sign: | N/A | | @@ -331,7 +333,7 @@ with OpenRouter( | `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.
| | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | diff --git a/docs/sdks/responses/README.mdx b/docs/sdks/responses/README.mdx index bbd2952..708c8a1 100644 --- a/docs/sdks/responses/README.mdx +++ b/docs/sdks/responses/README.mdx @@ -69,7 +69,7 @@ with OpenRouter( | `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.
| | | `x_open_router_metadata` | [Optional[components.MetadataLevel]](../../components/metadatalevel.mdx) | :heavy_minus_sign: | Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. | enabled | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | diff --git a/pyproject.toml b/pyproject.toml index cc31c29..f72d3af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.31" +version = "0.11.32" 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 e727214..44f59a4 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.31" +__version__: str = "0.11.32" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.31 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.32 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index ab93b1b..f14c3b5 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -65,6 +65,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -135,7 +139,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -151,6 +155,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -223,6 +229,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -293,7 +303,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -309,6 +319,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -381,6 +393,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -453,7 +469,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -469,6 +485,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -540,6 +558,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -612,7 +634,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -628,6 +650,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -701,6 +725,11 @@ class Chat(BaseSDK): plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -977,6 +1006,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1047,7 +1080,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1063,6 +1096,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1135,6 +1170,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1205,7 +1244,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1221,6 +1260,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1293,6 +1334,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1366,7 +1411,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1382,6 +1427,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1453,6 +1500,10 @@ class Chat(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1526,7 +1577,7 @@ class Chat(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1542,6 +1593,8 @@ class Chat(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1615,6 +1668,11 @@ class Chat(BaseSDK): plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), diff --git a/src/openrouter/components/anthropiccachecontroldirective.py b/src/openrouter/components/anthropiccachecontroldirective.py index a9292b2..05b36d1 100644 --- a/src/openrouter/components/anthropiccachecontroldirective.py +++ b/src/openrouter/components/anthropiccachecontroldirective.py @@ -12,14 +12,14 @@ AnthropicCacheControlDirectiveType = Literal["ephemeral",] class AnthropicCacheControlDirectiveTypedDict(TypedDict): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: AnthropicCacheControlDirectiveType ttl: NotRequired[AnthropicCacheControlTTL] class AnthropicCacheControlDirective(BaseModel): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: AnthropicCacheControlDirectiveType diff --git a/src/openrouter/components/anthropicdocumentblockparam.py b/src/openrouter/components/anthropicdocumentblockparam.py index 686764b..be2d48f 100644 --- a/src/openrouter/components/anthropicdocumentblockparam.py +++ b/src/openrouter/components/anthropicdocumentblockparam.py @@ -135,7 +135,7 @@ class AnthropicDocumentBlockParamTypedDict(TypedDict): source: AnthropicDocumentBlockParamSourceUnionTypedDict type: TypeDocument cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: NotRequired[Nullable[AnthropicDocumentBlockParamCitationsTypedDict]] context: NotRequired[Nullable[str]] title: NotRequired[Nullable[str]] @@ -147,7 +147,7 @@ class AnthropicDocumentBlockParam(BaseModel): type: TypeDocument cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: OptionalNullable[AnthropicDocumentBlockParamCitations] = UNSET diff --git a/src/openrouter/components/anthropicimageblockparam.py b/src/openrouter/components/anthropicimageblockparam.py index 979d046..7b5effb 100644 --- a/src/openrouter/components/anthropicimageblockparam.py +++ b/src/openrouter/components/anthropicimageblockparam.py @@ -42,7 +42,7 @@ class AnthropicImageBlockParamTypedDict(TypedDict): source: AnthropicImageBlockParamSourceTypedDict type: AnthropicImageBlockParamType cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class AnthropicImageBlockParam(BaseModel): @@ -51,7 +51,7 @@ class AnthropicImageBlockParam(BaseModel): type: AnthropicImageBlockParamType cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/anthropicsearchresultblockparam.py b/src/openrouter/components/anthropicsearchresultblockparam.py index 5925732..14967a2 100644 --- a/src/openrouter/components/anthropicsearchresultblockparam.py +++ b/src/openrouter/components/anthropicsearchresultblockparam.py @@ -48,7 +48,7 @@ class AnthropicSearchResultBlockParamTypedDict(TypedDict): title: str type: AnthropicSearchResultBlockParamType cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: NotRequired[AnthropicSearchResultBlockParamCitationsTypedDict] @@ -62,7 +62,7 @@ class AnthropicSearchResultBlockParam(BaseModel): type: AnthropicSearchResultBlockParamType cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: Optional[AnthropicSearchResultBlockParamCitations] = None diff --git a/src/openrouter/components/anthropictextblockparam.py b/src/openrouter/components/anthropictextblockparam.py index a6a70aa..31a1df2 100644 --- a/src/openrouter/components/anthropictextblockparam.py +++ b/src/openrouter/components/anthropictextblockparam.py @@ -76,7 +76,7 @@ class AnthropicTextBlockParamTypedDict(TypedDict): text: str type: AnthropicTextBlockParamType cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: NotRequired[Nullable[List[CitationTypedDict]]] @@ -86,7 +86,7 @@ class AnthropicTextBlockParam(BaseModel): type: AnthropicTextBlockParamType cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: OptionalNullable[List[Citation]] = UNSET diff --git a/src/openrouter/components/chatcontentcachecontrol.py b/src/openrouter/components/chatcontentcachecontrol.py index e23d405..d60c7b1 100644 --- a/src/openrouter/components/chatcontentcachecontrol.py +++ b/src/openrouter/components/chatcontentcachecontrol.py @@ -12,14 +12,14 @@ ChatContentCacheControlType = Literal["ephemeral",] class ChatContentCacheControlTypedDict(TypedDict): - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" type: ChatContentCacheControlType ttl: NotRequired[AnthropicCacheControlTTL] class ChatContentCacheControl(BaseModel): - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" type: ChatContentCacheControlType diff --git a/src/openrouter/components/chatcontenttext.py b/src/openrouter/components/chatcontenttext.py index 86d0a04..45f9d3e 100644 --- a/src/openrouter/components/chatcontenttext.py +++ b/src/openrouter/components/chatcontenttext.py @@ -5,7 +5,14 @@ from .chatcontentcachecontrol import ( ChatContentCacheControl, ChatContentCacheControlTypedDict, ) -from openrouter.types import BaseModel, UNSET_SENTINEL +from .promptcachebreakpoint import PromptCacheBreakpoint, PromptCacheBreakpointTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from pydantic import model_serializer from typing import Literal, Optional from typing_extensions import NotRequired, TypedDict @@ -20,7 +27,9 @@ class ChatContentTextTypedDict(TypedDict): text: str type: ChatContentTextType cache_control: NotRequired[ChatContentCacheControlTypedDict] - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" + prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]] + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" class ChatContentText(BaseModel): @@ -31,20 +40,32 @@ class ChatContentText(BaseModel): type: ChatContentTextType cache_control: Optional[ChatContentCacheControl] = None - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" + + prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["cache_control"]) + optional_fields = set(["cache_control", "prompt_cache_breakpoint"]) + nullable_fields = set(["prompt_cache_breakpoint"]) 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: + 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/components/chatfunctiontool.py b/src/openrouter/components/chatfunctiontool.py index a225159..69f8f1c 100644 --- a/src/openrouter/components/chatfunctiontool.py +++ b/src/openrouter/components/chatfunctiontool.py @@ -111,7 +111,7 @@ class ChatFunctionToolFunctionTypedDict(TypedDict): r"""Function definition for tool calling""" type: ChatFunctionToolType cache_control: NotRequired[ChatContentCacheControlTypedDict] - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" class ChatFunctionToolFunction(BaseModel): @@ -121,7 +121,7 @@ class ChatFunctionToolFunction(BaseModel): type: ChatFunctionToolType cache_control: Optional[ChatContentCacheControl] = None - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index 9140127..4c79a21 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -38,6 +38,7 @@ from .fusionplugin import FusionPlugin, FusionPluginTypedDict from .imageconfig import ImageConfig, ImageConfigTypedDict from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict from .paretorouterplugin import ParetoRouterPlugin, ParetoRouterPluginTypedDict +from .promptcacheoptions import PromptCacheOptions, PromptCacheOptionsTypedDict from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDict from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict from .stopservertoolswhencondition import ( @@ -228,7 +229,7 @@ class ChatRequestTypedDict(TypedDict): messages: List[ChatMessagesTypedDict] r"""List of messages for the conversation""" cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: NotRequired[ChatDebugOptionsTypedDict] r"""Debug options for inspecting request transformations (streaming only)""" frequency_penalty: NotRequired[Nullable[float]] @@ -259,6 +260,9 @@ class ChatRequestTypedDict(TypedDict): r"""Plugins you want to enable for this request, including their settings.""" presence_penalty: NotRequired[Nullable[float]] r"""Presence penalty (-2.0 to 2.0)""" + prompt_cache_key: NotRequired[Nullable[str]] + prompt_cache_options: NotRequired[Nullable[PromptCacheOptionsTypedDict]] + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" provider: NotRequired[Nullable[ProviderPreferencesTypedDict]] r"""When multiple model providers are available, optionally indicate your routing preference.""" reasoning: NotRequired[ChatRequestReasoningTypedDict] @@ -310,7 +314,7 @@ class ChatRequest(BaseModel): r"""List of messages for the conversation""" cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: Optional[ChatDebugOptions] = None r"""Debug options for inspecting request transformations (streaming only)""" @@ -357,6 +361,11 @@ class ChatRequest(BaseModel): presence_penalty: OptionalNullable[float] = UNSET r"""Presence penalty (-2.0 to 2.0)""" + prompt_cache_key: OptionalNullable[str] = UNSET + + prompt_cache_options: OptionalNullable[PromptCacheOptions] = UNSET + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" + provider: OptionalNullable[ProviderPreferences] = UNSET r"""When multiple model providers are available, optionally indicate your routing preference.""" @@ -440,6 +449,8 @@ class ChatRequest(BaseModel): "parallel_tool_calls", "plugins", "presence_penalty", + "prompt_cache_key", + "prompt_cache_options", "provider", "reasoning", "reasoning_effort", @@ -473,6 +484,8 @@ class ChatRequest(BaseModel): "min_p", "parallel_tool_calls", "presence_penalty", + "prompt_cache_key", + "prompt_cache_options", "provider", "reasoning_effort", "repetition_penalty", diff --git a/src/openrouter/components/fusionservertoolconfig.py b/src/openrouter/components/fusionservertoolconfig.py index e89fc6d..f7377d2 100644 --- a/src/openrouter/components/fusionservertoolconfig.py +++ b/src/openrouter/components/fusionservertoolconfig.py @@ -98,7 +98,7 @@ class FusionServerToolConfigTypedDict(TypedDict): analysis_models: NotRequired[List[str]] r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion.""" cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_completion_tokens: NotRequired[int] r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000.""" max_tool_calls: NotRequired[int] @@ -120,7 +120,7 @@ class FusionServerToolConfig(BaseModel): r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion.""" cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_completion_tokens: Optional[int] = None r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000.""" diff --git a/src/openrouter/components/inputtext.py b/src/openrouter/components/inputtext.py index ab1dcb9..81a4151 100644 --- a/src/openrouter/components/inputtext.py +++ b/src/openrouter/components/inputtext.py @@ -23,7 +23,7 @@ class InputTextTypedDict(TypedDict): text: str type: InputTextType prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]] - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" class InputText(BaseModel): @@ -34,7 +34,7 @@ class InputText(BaseModel): type: InputTextType prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/messagesmessageparam.py b/src/openrouter/components/messagesmessageparam.py index 8a9738b..e556cb0 100644 --- a/src/openrouter/components/messagesmessageparam.py +++ b/src/openrouter/components/messagesmessageparam.py @@ -50,7 +50,7 @@ class ContentCompactionTypedDict(TypedDict): content: Nullable[str] type: MessagesMessageParamTypeCompaction cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ContentCompaction(BaseModel): @@ -59,7 +59,7 @@ class ContentCompaction(BaseModel): type: MessagesMessageParamTypeCompaction cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -136,7 +136,7 @@ class ContentWebSearchToolResultTypedDict(TypedDict): tool_use_id: str type: TypeWebSearchToolResult cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ContentWebSearchToolResult(BaseModel): @@ -147,7 +147,7 @@ class ContentWebSearchToolResult(BaseModel): type: TypeWebSearchToolResult cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -174,7 +174,7 @@ class ContentServerToolUseTypedDict(TypedDict): name: str type: TypeServerToolUse cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: NotRequired[Nullable[Any]] @@ -186,7 +186,7 @@ class ContentServerToolUse(BaseModel): type: TypeServerToolUse cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: OptionalNullable[Any] = UNSET @@ -304,7 +304,7 @@ class ContentToolResultTypedDict(TypedDict): tool_use_id: str type: TypeToolResult cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" content: NotRequired[MessagesMessageParamContentUnion2TypedDict] is_error: NotRequired[bool] @@ -315,7 +315,7 @@ class ContentToolResult(BaseModel): type: TypeToolResult cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" content: Optional[MessagesMessageParamContentUnion2] = None @@ -346,7 +346,7 @@ class ContentToolUseTypedDict(TypedDict): name: str type: TypeToolUse cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: NotRequired[Nullable[Any]] @@ -358,7 +358,7 @@ class ContentToolUse(BaseModel): type: TypeToolUse cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: OptionalNullable[Any] = UNSET diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index d2e3039..b4d8f65 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -659,14 +659,14 @@ ToolTypeEphemeral = Literal["ephemeral",] class CachingTypedDict(TypedDict): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: ToolTypeEphemeral ttl: NotRequired[AnthropicCacheControlTTL] class Caching(BaseModel): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: ToolTypeEphemeral @@ -701,7 +701,7 @@ class ToolAdvisor20260301TypedDict(TypedDict): type: TypeAdvisor20260301 allowed_callers: NotRequired[List[AnthropicAllowedCallers]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" caching: NotRequired[Nullable[CachingTypedDict]] defer_loading: NotRequired[bool] max_uses: NotRequired[int] @@ -717,7 +717,7 @@ class ToolAdvisor20260301(BaseModel): allowed_callers: Optional[List[AnthropicAllowedCallers]] = None cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" caching: OptionalNullable[Caching] = UNSET @@ -766,7 +766,7 @@ class ToolWebSearch20260209TypedDict(TypedDict): allowed_domains: NotRequired[Nullable[List[str]]] blocked_domains: NotRequired[Nullable[List[str]]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: NotRequired[Nullable[int]] user_location: NotRequired[Nullable[AnthropicWebSearchToolUserLocationTypedDict]] @@ -783,7 +783,7 @@ class ToolWebSearch20260209(BaseModel): blocked_domains: OptionalNullable[List[str]] = UNSET cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: OptionalNullable[int] = UNSET @@ -838,7 +838,7 @@ class ToolWebSearch20250305TypedDict(TypedDict): allowed_domains: NotRequired[Nullable[List[str]]] blocked_domains: NotRequired[Nullable[List[str]]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: NotRequired[Nullable[int]] user_location: NotRequired[Nullable[AnthropicWebSearchToolUserLocationTypedDict]] @@ -853,7 +853,7 @@ class ToolWebSearch20250305(BaseModel): blocked_domains: OptionalNullable[List[str]] = UNSET cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: OptionalNullable[int] = UNSET @@ -905,7 +905,7 @@ class ToolTextEditor20250124TypedDict(TypedDict): name: NameStrReplaceEditor type: TypeTextEditor20250124 cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ToolTextEditor20250124(BaseModel): @@ -914,7 +914,7 @@ class ToolTextEditor20250124(BaseModel): type: TypeTextEditor20250124 cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -943,7 +943,7 @@ class ToolBash20250124TypedDict(TypedDict): name: NameBash type: TypeBash20250124 cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ToolBash20250124(BaseModel): @@ -952,7 +952,7 @@ class ToolBash20250124(BaseModel): type: TypeBash20250124 cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -1033,7 +1033,7 @@ class ToolCustomTypedDict(TypedDict): input_schema: InputSchemaTypedDict name: str cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" description: NotRequired[str] type: NotRequired[ToolTypeCustom] @@ -1044,7 +1044,7 @@ class ToolCustom(BaseModel): name: str cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" description: Optional[str] = None @@ -1113,7 +1113,7 @@ class MessagesRequestTypedDict(TypedDict): messages: Nullable[List[MessagesMessageParamTypedDict]] model: str cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" context_management: NotRequired[Nullable[ContextManagementTypedDict]] fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]] r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" @@ -1155,7 +1155,7 @@ class MessagesRequest(BaseModel): model: str cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" context_management: OptionalNullable[ContextManagement] = UNSET diff --git a/src/openrouter/components/promptcachebreakpoint.py b/src/openrouter/components/promptcachebreakpoint.py index a082e2d..13fbce2 100644 --- a/src/openrouter/components/promptcachebreakpoint.py +++ b/src/openrouter/components/promptcachebreakpoint.py @@ -10,12 +10,12 @@ PromptCacheBreakpointMode = Literal["explicit",] class PromptCacheBreakpointTypedDict(TypedDict): - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" mode: PromptCacheBreakpointMode class PromptCacheBreakpoint(BaseModel): - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" mode: PromptCacheBreakpointMode diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 6f97e56..92873ed 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -291,7 +291,7 @@ class ResponsesRequestTypedDict(TypedDict): background: NotRequired[Nullable[bool]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: NotRequired[ChatDebugOptionsTypedDict] r"""Debug options for inspecting request transformations (streaming only)""" frequency_penalty: NotRequired[Nullable[float]] @@ -351,7 +351,7 @@ class ResponsesRequest(BaseModel): background: OptionalNullable[bool] = UNSET cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: Optional[ChatDebugOptions] = None r"""Debug options for inspecting request transformations (streaming only)""" diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index 250c20d..8326894 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -664,6 +664,10 @@ class Presets(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -736,7 +740,7 @@ class Presets(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -752,6 +756,8 @@ class Presets(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -825,6 +831,11 @@ class Presets(BaseSDK): plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -1011,6 +1022,10 @@ class Presets(BaseSDK): ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1083,7 +1098,7 @@ class Presets(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1099,6 +1114,8 @@ class Presets(BaseSDK): :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1172,6 +1189,11 @@ class Presets(BaseSDK): plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -1420,7 +1442,7 @@ class Presets(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param context_management: :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: @@ -1732,7 +1754,7 @@ class Presets(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param context_management: :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: @@ -2054,7 +2076,7 @@ class Presets(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -2406,7 +2428,7 @@ class Presets(BaseSDK): :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index fbf686b..74419ce 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -137,7 +137,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -295,7 +295,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -456,7 +456,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -616,7 +616,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1056,7 +1056,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1214,7 +1214,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1375,7 +1375,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1535,7 +1535,7 @@ class Responses(BaseSDK): :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. diff --git a/uv.lock b/uv.lock index ab46723..4c9698f 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.31" +version = "0.11.32" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 9408179f89fe4a84c4dc8c8fc202892664b1bc24 Mon Sep 17 00:00:00 2001 From: "openrouter-docs-sync[bot]" <273401080+openrouter-docs-sync[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:06:27 +0000 Subject: [PATCH 61/62] chore: update OpenAPI spec from monorepo (#453) Co-authored-by: OpenRouter SDK Bot --- .speakeasy/in.openapi.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index 7963af7..de6797b 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -4281,6 +4281,7 @@ components: - recraft - reka - relace + - sail-research - sakana - sambanova - seed @@ -12999,6 +13000,7 @@ components: - Recraft - Reka - Relace + - Sail Research - Sakana AI - SambaNova - Seed @@ -18572,6 +18574,7 @@ components: - Recraft - Reka - Relace + - Sail Research - Sakana AI - SambaNova - Seed @@ -18994,6 +18997,10 @@ components: additionalProperties: nullable: true type: object + sail-research: + additionalProperties: + nullable: true + type: object sakana: additionalProperties: nullable: true @@ -19396,6 +19403,7 @@ components: - Recraft - Reka - Relace + - Sail Research - Sakana AI - SambaNova - Seed @@ -25550,6 +25558,7 @@ paths: - recraft - reka - relace + - sail-research - sakana - sambanova - seed From 8b505afe3d80ebc61a47b559b46c89babbcab794 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:11:55 +0000 Subject: [PATCH 62/62] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-?= =?UTF-8?q?=20Generate=20(spec=20change=20merged)=200.11.33=20(#454)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: speakeasybot Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com> --- .speakeasy/gen.lock | 78 +++++++++---------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 9 +++ .speakeasy/workflow.lock | 10 +-- RELEASES.md | 12 ++- docs/components/byokproviderslug.mdx | 1 + ...gegenerationproviderpreferencesoptions.mdx | 1 + docs/components/providername.mdx | 1 + docs/components/provideroptions.mdx | 1 + .../providerresponseprovidername.mdx | 1 + .../videogenerationrequestoptions.mdx | 1 + docs/operations/provider.mdx | 1 + pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/components/byokproviderslug.py | 1 + .../imagegenerationproviderpreferences.py | 6 ++ src/openrouter/components/providername.py | 1 + src/openrouter/components/provideroptions.py | 6 ++ src/openrouter/components/providerresponse.py | 1 + .../components/videogenerationrequest.py | 6 ++ src/openrouter/operations/listbyokkeys.py | 1 + uv.lock | 2 +- 22 files changed, 98 insertions(+), 50 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 9a1bbad..ee17f57 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: d4956b75e623f552544bf0eee219fb15 + docChecksum: d92ce8758dacb7f04efe84b124109740 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.32 - configChecksum: 2def3221df426fb9e1ca1fb865534f8e + releaseVersion: 0.11.33 + configChecksum: a00384aafb8d1896bec819892b242863 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: c6eafc4f-1723-4a50-b64a-768ca4b13a2f - pristine_commit_hash: 2be2ba16cd458078a20e8dff747aed3a7eeba223 - pristine_tree_hash: d075876a76e82a3c03a6789df86ec9dfede361bb + generation_id: a281389d-a736-44f4-8c73-9e55b23e68ec + pristine_commit_hash: 101d9557403c55e49b699ce862a5954379816549 + pristine_tree_hash: d069b8a3a0b13c8fa7b2e3ed9aef8c3f70884916 features: python: acceptHeaders: 3.0.0 @@ -754,8 +754,8 @@ trackedFiles: pristine_git_object: 151dd8398dc818ff4d26d6859d25efd202d03917 docs/components/byokproviderslug.mdx: id: 6ea70819f6d8 - last_write_checksum: sha1:dd9de0bc49b47e4c49878f4e4b1684b6bbd43e0e - pristine_git_object: a7472d01b6de43fedfa76a9e608d67202a7ec529 + last_write_checksum: sha1:e98e972e8efd96c2f0f9f3a71f6146021b11dd6e + pristine_git_object: 7f17d7c4d338ac9aed696e2cb2449882be52dac4 docs/components/caching.mdx: id: edc8a0f8f37f last_write_checksum: sha1:cce3835ca76b640b591de1307422aa4e391cde69 @@ -2150,8 +2150,8 @@ trackedFiles: pristine_git_object: 11f1471c8b6c04f52af89d74d6dec2e9d12c2d82 docs/components/imagegenerationproviderpreferencesoptions.mdx: id: 32d5c4b3e06b - last_write_checksum: sha1:2e7bf9676997ff8ee9a42928a7f236a7870023bb - pristine_git_object: 15d1f0fccbd55826da587a1224021132c9731d6e + last_write_checksum: sha1:7a1718d0eb96dd90a668c528534a68e2e0e4d58c + pristine_git_object: 9f867b4a7ee4c98de70e50a64801bd2e4803e810 docs/components/imagegenerationproviderpreferencesorder.mdx: id: 0547877073f3 last_write_checksum: sha1:3e890c691097373cc9a2d7e47c3594f56b57809c @@ -3918,12 +3918,12 @@ trackedFiles: pristine_git_object: 1d91d32cd0bf4b64699bbbf05a7e95ab835b10cf docs/components/providername.mdx: id: aa3a4904b228 - last_write_checksum: sha1:be6fb41ed23d0e54e63d5f10678182ec5eae6027 - pristine_git_object: 95533adfa2f939083c8df84451ca31650d3f34f4 + last_write_checksum: sha1:a877ebb29f41cef89404095a42cf667aed632f38 + pristine_git_object: c92f453d6c77a3f5b35a7bd1923fb29fc7d53f1c docs/components/provideroptions.mdx: id: 2697807524fe - last_write_checksum: sha1:a5900d110161c668aae14628bf109eadce276995 - pristine_git_object: 692215d0dfe4a5b0c8054e36c5de3935717ad2ce + last_write_checksum: sha1:6bdc68db4bd0da411e6f1a0a96415cbdde5bf545 + pristine_git_object: 5ea7d4f6f82b00d4ef8b895ca7109fa523aa185f docs/components/provideroverloadedresponseerrordata.mdx: id: dc500cd14889 last_write_checksum: sha1:6c1d551db4083f1d0bc429baa1ce472d2c085331 @@ -3954,8 +3954,8 @@ trackedFiles: pristine_git_object: dd376f0952fa0517dd83b06ed7afc2c856123dbc docs/components/providerresponseprovidername.mdx: id: 2fc17b61e546 - last_write_checksum: sha1:64454d1cd35449c9f73f9eca55ff084d0678dea5 - pristine_git_object: e7fb2111e14cd066c973885287724022677f3ab0 + last_write_checksum: sha1:15f7576d4384757dd568dd7bc29b8e7814286a0a + pristine_git_object: aa00e25e5e9ba7697e00a6cdecbb905b109a8518 docs/components/providersort.mdx: id: d73fa13eeb95 last_write_checksum: sha1:b7e9e6842741e3433d705bd576f2ac5383f00134 @@ -5074,8 +5074,8 @@ trackedFiles: pristine_git_object: 67f56887bb4758559189e3e9e6123dff9a38df81 docs/components/videogenerationrequestoptions.mdx: id: 1d67160e7e7a - last_write_checksum: sha1:4c19959913429416ca1b6982963e0825fa15ed38 - pristine_git_object: 003eb8e132056a3d7bd592b3ce7916d210cbc7ce + last_write_checksum: sha1:a4b9f3a57e8de8bec0a4aca1ebc6ec8063936a02 + pristine_git_object: 3f914db0284663a0d01c68c3156090cfada7e8ca docs/components/videogenerationrequestprovider.mdx: id: d6424dd5de9d last_write_checksum: sha1:72aa46a3335220b579db56574ea179d150dbe2b6 @@ -6350,8 +6350,8 @@ trackedFiles: pristine_git_object: 0f0b54e43577a8a835cd971f82e48c3921e3d88e docs/operations/provider.mdx: id: c75b3bbeeaa0 - last_write_checksum: sha1:f3f959b689f60e1bc8dc84e16cae8f603076da39 - pristine_git_object: 87d0a5181c68a8520c2f33472cde1f70ae47517a + last_write_checksum: sha1:3bab335278373e2867fe23084f7b67225ca7efa9 + pristine_git_object: 8ea30eb555013ee1bdd172bd4f086166acab4e79 docs/operations/queryanalyticsdata1.mdx: id: 0e41beea77d0 last_write_checksum: sha1:f9a349b4fee07f786180e94b45f92002bfae0e56 @@ -6666,8 +6666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:bd90540d9cd6c97085fa5fd5f08dbbbfa2899391 - pristine_git_object: f72d3afab559e9db67b290ca5e6337adfcda58c9 + last_write_checksum: sha1:f0f7e932c7bd4c925e46f46b6bf97f892541ee99 + pristine_git_object: 9fb79642304d03a5d47fdbc05c84a5c3da09836a scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6694,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:cffbb1cf67568b37538f51f21b858e0242adb9cf - pristine_git_object: 44f59a476730ba6703b7d5e088bbd3a81e21b362 + last_write_checksum: sha1:cac07fa2f6da0149e7c082a302589905dd9fcf73 + pristine_git_object: 22f63c25f6137a2f8e6b2e6b583305780919a837 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -7074,8 +7074,8 @@ trackedFiles: pristine_git_object: 47ef267b5e0f7b615b0cd66018728e3f47440a66 src/openrouter/components/byokproviderslug.py: id: 6738a8516caf - last_write_checksum: sha1:1cf43faf3a5fcfdac985e26b6cc3e29a9a958ae6 - pristine_git_object: 81fee367601cd550521fce7ea60a8324c9825f8b + last_write_checksum: sha1:1d5f63d7206873cd787c0f8783edb1668c110a6b + pristine_git_object: 3eeec994403b5be04396cb2a9130051b96b7ff69 src/openrouter/components/capabilitydescriptor.py: id: 368790a86f10 last_write_checksum: sha1:a167551924ee82b4b5876a0ab698a45fe8c87a95 @@ -7690,8 +7690,8 @@ trackedFiles: pristine_git_object: 6b9a8990973466285f9b49b366bbc5fc1ae42e41 src/openrouter/components/imagegenerationproviderpreferences.py: id: 100a82a54e2d - last_write_checksum: sha1:63973ed1d6c151ffdb2977626461d911ca8869b4 - pristine_git_object: 692420fd5cf21e77ff5caad6dc34995710cb734c + last_write_checksum: sha1:b62a5853eb29e4ade80bceb5a1d8d160b8791bcf + pristine_git_object: f31f0c06f6bdf464baa6bf50047be8901521bbdb src/openrouter/components/imagegenerationrequest.py: id: f8291a7be9a0 last_write_checksum: sha1:48a9640c0b9f48833d5514c7671bfa4b76aac776 @@ -8374,12 +8374,12 @@ trackedFiles: pristine_git_object: 170ae25c582bb8decd74e1c69bfa8353bd44e86d src/openrouter/components/providername.py: id: fcc722fa2fce - last_write_checksum: sha1:5aaf14cf939df3daffca2ca3185ae8028c403bf2 - pristine_git_object: f77081e7c30b015b7ea03ad64da044263883bad6 + last_write_checksum: sha1:7bb29aa3b55fa6df3b056320b0556206f738e78d + pristine_git_object: 86245cd85f2de0a7344ffd555024b62d61a81db4 src/openrouter/components/provideroptions.py: id: 73dde6c8f359 - last_write_checksum: sha1:16c9861c644b04fc742114a47a4966e7eda87e94 - pristine_git_object: d6e1dfcdcaf3d49f138a34bfcfd011083002bd79 + last_write_checksum: sha1:ca9d736d42f2c82fa375b0018b986c2376a32281 + pristine_git_object: f465173ff34bc40ef17fa475db7bde136124e8d8 src/openrouter/components/provideroverloadedresponseerrordata.py: id: 5b693682570e last_write_checksum: sha1:1ebc4527736f1e174ab37c84bea8a169fda9f8b8 @@ -8390,8 +8390,8 @@ trackedFiles: pristine_git_object: 2d44eabbe3200d884a5e01589732570d3a3ab7e1 src/openrouter/components/providerresponse.py: id: ad3887be54c5 - last_write_checksum: sha1:b8868ce7950808be5b37e964607abab8348e2ab6 - pristine_git_object: 9382e92c4777f3a0c46afb007fda317d41baec2c + last_write_checksum: sha1:dbf09bc4d653c93702c3d25fc08df40027f1a296 + pristine_git_object: 9ef2d5d15f59ee0a3086a59e86aedcd978a731ad src/openrouter/components/providersort.py: id: 348e382bf494 last_write_checksum: sha1:57551507f95cd2e16ef995e1c13f859fd0726152 @@ -8862,8 +8862,8 @@ trackedFiles: pristine_git_object: 09f7248804ba12bfbef924b934f57c34974d965b src/openrouter/components/videogenerationrequest.py: id: 70e3c9ff288c - last_write_checksum: sha1:5dfb79ba40785ce3a31b00f66b5fba956dca1f0d - pristine_git_object: 1c1bcd48aacbdbb0a343c723eb525393caba109a + last_write_checksum: sha1:7c3519d6e8a9d46821215c6a6e0bf060dbfb526c + pristine_git_object: d6ea46838880939edb6b3764a95b5c9ca58291a3 src/openrouter/components/videogenerationresponse.py: id: 541f1321b072 last_write_checksum: sha1:18c3aa7845f63a9614286b1a27b6098eae1c4951 @@ -9330,8 +9330,8 @@ trackedFiles: pristine_git_object: cc90375e9aac23107e57e18e6adecc38f544e185 src/openrouter/operations/listbyokkeys.py: id: b6dd42b3e05f - last_write_checksum: sha1:20949993bdcdb4e6827a1a17bf1aa1230690f630 - pristine_git_object: 46c012e74b47beaa8f0b6828cc5bb319fe315e77 + last_write_checksum: sha1:9cce3860543e50cf242e3fdcabb6017b13198523 + pristine_git_object: c7d75c7caaaf9db51a4d1d63ae59e848e14cf4bc src/openrouter/operations/listembeddingsmodels.py: id: bf749a1f23d6 last_write_checksum: sha1:0af7e243f6b7ea8dcb9c3e506c0e9382372e8397 @@ -11149,4 +11149,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request` **Changed**\n * `response.choices[].message.content.union(Array)[].union(text).prompt_cache_breakpoint` **Added**\n* `open_router.presets.create_presets_chat_completions()`: `request` **Changed**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(sail_research)` **Added**\n* `open_router.tts.create_speech()`: \n * `request.provider.options.sail_research` **Added**\n* `open_router.stt.create_transcription()`: \n * `request.provider.options.sail_research` **Added**\n* `open_router.byok.list()`: \n * `request.provider` **Changed**\n * `response.data[].provider.enum(sail_research)` **Added**\n* `open_router.byok.create()`: \n * `request.provider.enum(sail_research)` **Added**\n * `response.data.provider.enum(sail_research)` **Added**\n* `open_router.byok.get()`: `response.data.provider.enum(sail_research)` **Added**\n* `open_router.byok.update()`: `response.data.provider.enum(sail_research)` **Added**\n* `open_router.chat.send()`: \n * `request.provider.ignore[].union(ProviderName).enum(sail_research)` **Added**\n* `open_router.embeddings.generate()`: \n * `request.provider.ignore[].union(ProviderName).enum(sail_research)` **Added**\n* `open_router.endpoints.list_zdr_endpoints()`: `response.data[].provider_name.enum(sail_research)` **Added**\n* `open_router.endpoints.list()`: `response.data.endpoints[].provider_name.enum(sail_research)` **Added**\n* `open_router.generations.get_generation()`: `response.data.provider_responses[].provider_name.enum(sail_research)` **Added**\n* `open_router.images.generate()`: `request.provider` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.provider.ignore[].union(ProviderName).enum(sail_research)` **Added**\n* `open_router.presets.create_presets_messages()`: \n * `request.provider.ignore[].union(ProviderName).enum(sail_research)` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.provider.ignore[].union(ProviderName).enum(sail_research)` **Added**\n* `open_router.rerank.rerank()`: \n * `request.provider.ignore[].union(ProviderName).enum(sail_research)` **Added**\n* `open_router.video_generation.generate()`: \n * `request.provider.options.sail_research` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c453c67..f416d0b 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.32 + version: 0.11.33 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 0926697..8681e52 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -4277,6 +4277,7 @@ components: - recraft - reka - relace + - sail-research - sakana - sambanova - seed @@ -12933,6 +12934,7 @@ components: - Recraft - Reka - Relace + - Sail Research - Sakana AI - SambaNova - Seed @@ -18459,6 +18461,7 @@ components: - Recraft - Reka - Relace + - Sail Research - Sakana AI - SambaNova - Seed @@ -18881,6 +18884,10 @@ components: additionalProperties: nullable: true type: object + sail-research: + additionalProperties: + nullable: true + type: object sakana: additionalProperties: nullable: true @@ -19274,6 +19281,7 @@ components: - Recraft - Reka - Relace + - Sail Research - Sakana AI - SambaNova - Seed @@ -25340,6 +25348,7 @@ paths: - recraft - reka - relace + - sail-research - sakana - sambanova - seed diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index efe462f..23755dd 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:7ba0690911aa50c921dd9903da84f01fc6f17c079b207e23cdf58ea361564199 - sourceBlobDigest: sha256:d60cb272a488a05daf5bfe8efc1b69083f75852bff82d8deea1714b429b4d4fc + sourceRevisionDigest: sha256:1b18bfafe3a31635470908ce53c1bb12af21a82d371f6f979bb5e8463f52afb3 + sourceBlobDigest: sha256:506597a9fce25fe757037a95da952e36f33dd702afa16c13d43c2df2d5da1ece tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:7ba0690911aa50c921dd9903da84f01fc6f17c079b207e23cdf58ea361564199 - sourceBlobDigest: sha256:d60cb272a488a05daf5bfe8efc1b69083f75852bff82d8deea1714b429b4d4fc + sourceRevisionDigest: sha256:1b18bfafe3a31635470908ce53c1bb12af21a82d371f6f979bb5e8463f52afb3 + sourceBlobDigest: sha256:506597a9fce25fe757037a95da952e36f33dd702afa16c13d43c2df2d5da1ece codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:f52550d8391f3b538a0b03a1f483c981fcb926e95bec37ffa581344cfaf0d1e8 + codeSamplesRevisionDigest: sha256:7ae639df01271894474a52b709810943afd11f8d9acde069336e9a1f8588ec56 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index d17bed8..d0b72cb 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -428,4 +428,14 @@ Based on: ### Generated - [python v0.11.32] . ### Releases -- [PyPI v0.11.32] https://pypi.org/project/openrouter/0.11.32 - . \ No newline at end of file +- [PyPI v0.11.32] https://pypi.org/project/openrouter/0.11.32 - . + +## 2026-07-14 22:07:41 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.33] . +### Releases +- [PyPI v0.11.33] https://pypi.org/project/openrouter/0.11.33 - . \ No newline at end of file diff --git a/docs/components/byokproviderslug.mdx b/docs/components/byokproviderslug.mdx index a7472d0..7f17d7c 100644 --- a/docs/components/byokproviderslug.mdx +++ b/docs/components/byokproviderslug.mdx @@ -91,6 +91,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"recraft"` - `"reka"` - `"relace"` +- `"sail-research"` - `"sakana"` - `"sambanova"` - `"seed"` diff --git a/docs/components/imagegenerationproviderpreferencesoptions.mdx b/docs/components/imagegenerationproviderpreferencesoptions.mdx index 15d1f0f..9f867b4 100644 --- a/docs/components/imagegenerationproviderpreferencesoptions.mdx +++ b/docs/components/imagegenerationproviderpreferencesoptions.mdx @@ -107,6 +107,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `sail_research` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/providername.mdx b/docs/components/providername.mdx index 95533ad..c92f453 100644 --- a/docs/components/providername.mdx +++ b/docs/components/providername.mdx @@ -89,6 +89,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Recraft"` - `"Reka"` - `"Relace"` +- `"Sail Research"` - `"Sakana AI"` - `"SambaNova"` - `"Seed"` diff --git a/docs/components/provideroptions.mdx b/docs/components/provideroptions.mdx index 692215d..5ea7d4f 100644 --- a/docs/components/provideroptions.mdx +++ b/docs/components/provideroptions.mdx @@ -107,6 +107,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `sail_research` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/components/providerresponseprovidername.mdx b/docs/components/providerresponseprovidername.mdx index e7fb211..aa00e25 100644 --- a/docs/components/providerresponseprovidername.mdx +++ b/docs/components/providerresponseprovidername.mdx @@ -119,6 +119,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"Recraft"` - `"Reka"` - `"Relace"` +- `"Sail Research"` - `"Sakana AI"` - `"SambaNova"` - `"Seed"` diff --git a/docs/components/videogenerationrequestoptions.mdx b/docs/components/videogenerationrequestoptions.mdx index 003eb8e..3f914db 100644 --- a/docs/components/videogenerationrequestoptions.mdx +++ b/docs/components/videogenerationrequestoptions.mdx @@ -107,6 +107,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p | `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | +| `sail_research` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | | `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | diff --git a/docs/operations/provider.mdx b/docs/operations/provider.mdx index 87d0a51..8ea30eb 100644 --- a/docs/operations/provider.mdx +++ b/docs/operations/provider.mdx @@ -91,6 +91,7 @@ This is an open enum. Unrecognized values will not fail type checks. - `"recraft"` - `"reka"` - `"relace"` +- `"sail-research"` - `"sakana"` - `"sambanova"` - `"seed"` diff --git a/pyproject.toml b/pyproject.toml index f72d3af..9fb7964 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.32" +version = "0.11.33" 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 44f59a4..22f63c2 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.32" +__version__: str = "0.11.33" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.32 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.33 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/byokproviderslug.py b/src/openrouter/components/byokproviderslug.py index 81fee36..3eeec99 100644 --- a/src/openrouter/components/byokproviderslug.py +++ b/src/openrouter/components/byokproviderslug.py @@ -80,6 +80,7 @@ BYOKProviderSlug = Union[ "recraft", "reka", "relace", + "sail-research", "sakana", "sambanova", "seed", diff --git a/src/openrouter/components/imagegenerationproviderpreferences.py b/src/openrouter/components/imagegenerationproviderpreferences.py index 692420f..f31f0c0 100644 --- a/src/openrouter/components/imagegenerationproviderpreferences.py +++ b/src/openrouter/components/imagegenerationproviderpreferences.py @@ -138,6 +138,7 @@ class ImageGenerationProviderPreferencesOptionsTypedDict(TypedDict): reka: NotRequired[Dict[str, Nullable[Any]]] relace: NotRequired[Dict[str, Nullable[Any]]] replicate: NotRequired[Dict[str, Nullable[Any]]] + sail_research: NotRequired[Dict[str, Nullable[Any]]] sakana: NotRequired[Dict[str, Nullable[Any]]] sambanova: NotRequired[Dict[str, Nullable[Any]]] sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] @@ -400,6 +401,10 @@ class ImageGenerationProviderPreferencesOptions(BaseModel): replicate: Optional[Dict[str, Nullable[Any]]] = None + sail_research: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sail-research") + ] = None + sakana: Optional[Dict[str, Nullable[Any]]] = None sambanova: Optional[Dict[str, Nullable[Any]]] = None @@ -556,6 +561,7 @@ class ImageGenerationProviderPreferencesOptions(BaseModel): "reka", "relace", "replicate", + "sail-research", "sakana", "sambanova", "sambanova-cloaked", diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index f77081e..86245cd 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -80,6 +80,7 @@ ProviderName = Union[ "Recraft", "Reka", "Relace", + "Sail Research", "Sakana AI", "SambaNova", "Seed", diff --git a/src/openrouter/components/provideroptions.py b/src/openrouter/components/provideroptions.py index d6e1dfc..f465173 100644 --- a/src/openrouter/components/provideroptions.py +++ b/src/openrouter/components/provideroptions.py @@ -109,6 +109,7 @@ class ProviderOptionsTypedDict(TypedDict): reka: NotRequired[Dict[str, Nullable[Any]]] relace: NotRequired[Dict[str, Nullable[Any]]] replicate: NotRequired[Dict[str, Nullable[Any]]] + sail_research: NotRequired[Dict[str, Nullable[Any]]] sakana: NotRequired[Dict[str, Nullable[Any]]] sambanova: NotRequired[Dict[str, Nullable[Any]]] sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] @@ -371,6 +372,10 @@ class ProviderOptions(BaseModel): replicate: Optional[Dict[str, Nullable[Any]]] = None + sail_research: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sail-research") + ] = None + sakana: Optional[Dict[str, Nullable[Any]]] = None sambanova: Optional[Dict[str, Nullable[Any]]] = None @@ -527,6 +532,7 @@ class ProviderOptions(BaseModel): "reka", "relace", "replicate", + "sail-research", "sakana", "sambanova", "sambanova-cloaked", diff --git a/src/openrouter/components/providerresponse.py b/src/openrouter/components/providerresponse.py index 9382e92..9ef2d5d 100644 --- a/src/openrouter/components/providerresponse.py +++ b/src/openrouter/components/providerresponse.py @@ -110,6 +110,7 @@ ProviderResponseProviderName = Union[ "Recraft", "Reka", "Relace", + "Sail Research", "Sakana AI", "SambaNova", "Seed", diff --git a/src/openrouter/components/videogenerationrequest.py b/src/openrouter/components/videogenerationrequest.py index 1c1bcd4..d6ea468 100644 --- a/src/openrouter/components/videogenerationrequest.py +++ b/src/openrouter/components/videogenerationrequest.py @@ -128,6 +128,7 @@ class VideoGenerationRequestOptionsTypedDict(TypedDict): reka: NotRequired[Dict[str, Nullable[Any]]] relace: NotRequired[Dict[str, Nullable[Any]]] replicate: NotRequired[Dict[str, Nullable[Any]]] + sail_research: NotRequired[Dict[str, Nullable[Any]]] sakana: NotRequired[Dict[str, Nullable[Any]]] sambanova: NotRequired[Dict[str, Nullable[Any]]] sambanova_cloaked: NotRequired[Dict[str, Nullable[Any]]] @@ -390,6 +391,10 @@ class VideoGenerationRequestOptions(BaseModel): replicate: Optional[Dict[str, Nullable[Any]]] = None + sail_research: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="sail-research") + ] = None + sakana: Optional[Dict[str, Nullable[Any]]] = None sambanova: Optional[Dict[str, Nullable[Any]]] = None @@ -546,6 +551,7 @@ class VideoGenerationRequestOptions(BaseModel): "reka", "relace", "replicate", + "sail-research", "sakana", "sambanova", "sambanova-cloaked", diff --git a/src/openrouter/operations/listbyokkeys.py b/src/openrouter/operations/listbyokkeys.py index 46c012e..c7d75c7 100644 --- a/src/openrouter/operations/listbyokkeys.py +++ b/src/openrouter/operations/listbyokkeys.py @@ -151,6 +151,7 @@ Provider = Union[ "recraft", "reka", "relace", + "sail-research", "sakana", "sambanova", "seed", diff --git a/uv.lock b/uv.lock index 4c9698f..93ea12c 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.32" +version = "0.11.33" source = { editable = "." } dependencies = [ { name = "httpcore" },