From c887b3e19d5b28bc1ffc1e930af27749a16a830a Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Sun, 8 Nov 2026 02:25:12 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.batch.create_batches()`: `response.results[].response.body.union(OpenResponsesResult).output[].union(openrouter:tool_search).catalog_changes` **Added** * `open_router.batch.get_batches()`: `response.results[].response.body.union(OpenResponsesResult).output[].union(openrouter:tool_search).catalog_changes` **Added** * `open_router.presets.create_presets_chat_completions()`: `request.deferred_tools` **Changed** * `open_router.presets.create_presets_messages()`: `request.deferred_tools` **Changed** * `open_router.presets.create_presets_responses()`: `request` **Changed** --- .speakeasy/gen.lock | 104 +++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 12 +- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- docs/components/chatrequest.mdx | 2 +- docs/components/deferredbm25search.mdx | 11 +- docs/components/deferredtoolscontrol.mdx | 23 ++-- docs/components/messagesrequest.mdx | 2 +- .../outputtoolsearchservertoolitem.mdx | 31 +++--- docs/components/responsesrequest.mdx | 2 +- docs/sdks/betaresponses/README.mdx | 2 +- docs/sdks/chat/README.mdx | 2 +- docs/sdks/presets/README.mdx | 6 +- docs/sdks/responses/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/beta_responses.py | 16 +-- src/openrouter/chat.py | 16 +-- src/openrouter/components/chatrequest.py | 4 +- .../components/deferredbm25search.py | 7 +- .../components/deferredtoolscontrol.py | 13 ++- src/openrouter/components/messagesrequest.py | 4 +- .../outputtoolsearchservertoolitem.py | 6 + src/openrouter/components/responsesrequest.py | 4 +- src/openrouter/presets.py | 12 +- src/openrouter/responses.py | 16 +-- uv.lock | 2 +- 28 files changed, 185 insertions(+), 144 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index e6aac2d97..e1f02e1c3 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: 1b1f9cc5495f868369dd84584b66a331 + docChecksum: f8dc91b3c81bf3d705cc827ec9e7a539 docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.139 - configChecksum: 9c9450a578517447d539f313154059b5 + releaseVersion: 1.3.140 + configChecksum: b0f67e896d3d65b70c35fa0825854655 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: feede6d2-82b6-4fd2-8f6c-122e26ca84ee - pristine_commit_hash: c7fe652bd0c7da52e532eb126bc4e1bd1ec76415 - pristine_tree_hash: b545496ced13bf94a4abb55d0d51b6ec7de8e408 + generation_id: be94a227-9141-446d-b19d-de1422a044e0 + pristine_commit_hash: ae558382b3860a6debb78b1c5edde81051fd2bae + pristine_tree_hash: f6896a0ef56bff0ee3e1998d8adfa81a83450425 features: python: acceptHeaders: 3.0.0 @@ -2096,8 +2096,8 @@ trackedFiles: pristine_git_object: 220be03bd674a257c2064c0455104959b3974a35 docs/components/chatrequest.mdx: id: 055812be14d8 - last_write_checksum: sha1:01b6b3afd1e905b6b69926989eddc2c9ed58138a - pristine_git_object: 2f1b2412487514bfed964fc454435b81be39c92e + last_write_checksum: sha1:950b445a326189380581d56f4bba7299d192a18d + pristine_git_object: bd3f30cfbe57aef548d3f3738ffe1c09986b7033 docs/components/chatrequesteffort.mdx: id: 703c73252ebd last_write_checksum: sha1:243510f188071a3f317dc06a07fbcfcedd3cf821 @@ -3132,8 +3132,8 @@ trackedFiles: pristine_git_object: 78c74a24e624245cbbfe2f989c4301442bbb5fee docs/components/deferredbm25search.mdx: id: 28b5539be31d - last_write_checksum: sha1:d6bcb91024febe3a5b810798068faa6c4a4b97cc - pristine_git_object: abed2b5ad521676845a4f3cb6450a369667d4886 + last_write_checksum: sha1:446e5ba3ff5fd0dce149be2f9ec5f33d0cad2231 + pristine_git_object: 88953c20c366fc3c0afc37193fb9dbaecaa1db9d docs/components/deferredbm25searchtype.mdx: id: 7c08005a05ac last_write_checksum: sha1:4c12129e0ab52db31056314a17628cbfedb600b8 @@ -3156,8 +3156,8 @@ trackedFiles: pristine_git_object: a226240fb3b94358d33acc91761a8bba03309b63 docs/components/deferredtoolscontrol.mdx: id: 13db9fb1f102 - last_write_checksum: sha1:9c5955892248ef08dc9801c6677bdfe3b0fb9fff - pristine_git_object: 06a67d94e470dae5da499da820a53cb5aee28d25 + last_write_checksum: sha1:d6924c2b7eaf02cb8eaef07d30556cf43cc711e0 + pristine_git_object: b2034e5bdc974166dd428e27eaf9e1764b3bc7d4 docs/components/deferredtoolscontrolscope.mdx: id: 61fade4412af last_write_checksum: sha1:ff698d00ab177a0e0ac4ffe495004205f89ab63b @@ -5308,8 +5308,8 @@ trackedFiles: pristine_git_object: cff8f3938a8bd5699d1111a6b1a926518d868da5 docs/components/messagesrequest.mdx: id: 762dd6b894c8 - last_write_checksum: sha1:e6f15060781651dc3dc8f3b0945ec0a9cec456fd - pristine_git_object: 1c3e18f58fefee4b66b27f9379f6de913a7db596 + last_write_checksum: sha1:88f1f9ae4b2478312564c52475c65edfead55278 + pristine_git_object: f5f01405b7bcd41678556b0048f19b93d0869d51 docs/components/messagesrequestinputschema.mdx: id: 2632c649261a last_write_checksum: sha1:034fdaba58afe6eca4eaf76722562181c63204a2 @@ -6940,8 +6940,8 @@ trackedFiles: pristine_git_object: d68bd61421859df1e00c0ec15f5a6946ed52dfd1 docs/components/outputtoolsearchservertoolitem.mdx: id: 7106fbb89729 - last_write_checksum: sha1:014db8181b4d1da4e46bc283a0b55a24b53fa312 - pristine_git_object: 6b1e2f064260e0f05bdfbd2ea1658a5615a2b1ca + last_write_checksum: sha1:17fe788112ef3866b9c4d6ee32d0b6a6d076fb11 + pristine_git_object: 433141ae099de822c9cec8eda2c718b356503de4 docs/components/outputtoolsearchservertoolitemformat.mdx: id: 717072e9e3e8 last_write_checksum: sha1:04cf65dbe63614cfee6df054640472e679b4faac @@ -7668,8 +7668,8 @@ trackedFiles: pristine_git_object: aa7c89233d761c71c471d4f9ee808e648e683fcf docs/components/responsesrequest.mdx: id: 0dbcef40a4b1 - last_write_checksum: sha1:a02164702854c71a53627f65a5c46d5f7f664b47 - pristine_git_object: aed35107c8ec8cccf4c7e2076480be9e7cdbc579 + last_write_checksum: sha1:5e2b69aa6866361fc1f9d1269bc85565af5fd3c2 + pristine_git_object: fba888a27d05a32874bedb6aaecbee22c19b9719 docs/components/responsesrequestaccessprograms.mdx: id: 5601238f0623 last_write_checksum: sha1:50c603ddf87595ee886e479ca39ee53aa4e6cf2b @@ -11428,16 +11428,16 @@ trackedFiles: pristine_git_object: 46fe09f0c09e01c11b8b88fc5265802ac48ee05d docs/sdks/betaresponses/README.mdx: id: 8a1e987c9840 - last_write_checksum: sha1:88f9f1f25424bfe9b303ae964593d4235fa05ad3 - pristine_git_object: 602c654ec2a93444f60d5f514a0b67cae81eaccf + last_write_checksum: sha1:0d8d0c1f105a2e63d9c36708dce2bb947f400986 + pristine_git_object: d8a2042d4ec07f41bb5bf9d08f9cf8e9dc637ca9 docs/sdks/byok/README.mdx: id: 17792f3b180d last_write_checksum: sha1:fed0d8f340b51772ad7577aab8a0f0703565743e pristine_git_object: e60f82f9537df9da34039e97e5dbbe7019893ba1 docs/sdks/chat/README.mdx: id: 1dd859c23fe1 - last_write_checksum: sha1:6b2b1a086d2d4d43d26cb72a0b78d6684be377ac - pristine_git_object: 25f5f771869c49ec913d671a4013d63d50836aef + last_write_checksum: sha1:bc2edd54fa566184caacfa6f238bfe70ac435cbb + pristine_git_object: e4f71ca626e81e7fa20ca3bbbd3819482c706aad docs/sdks/classifications/README.mdx: id: 4786130ef02a last_write_checksum: sha1:0ad874e3b59605580ef4d4647b4e0feece64ccc9 @@ -11512,8 +11512,8 @@ trackedFiles: pristine_git_object: 4762825df814e75d1f9c2c4067444270f4ec7b60 docs/sdks/presets/README.mdx: id: eeb505928d52 - last_write_checksum: sha1:9c6be322c49f2303b38e40abc1d4fc8be1072b40 - pristine_git_object: f5e755b96f1f4f749ecd8c02a6ce1f67d5803df3 + last_write_checksum: sha1:b212acff61c8199c686876c5bb40f4f63e4c3461 + pristine_git_object: f6e29f23187c26fd808d118faa15a3b246b094b9 docs/sdks/privateendpoints/README.mdx: id: 54dee70b8cc7 last_write_checksum: sha1:df30945c0fcc9fa7e507ea2dbbfc275946151ebd @@ -11532,8 +11532,8 @@ trackedFiles: pristine_git_object: 4e10c25ed694e617695e7fc6192b7b25302977d6 docs/sdks/responses/README.mdx: id: abab319e080e - last_write_checksum: sha1:ec32ab6c2dcb69ca872b020401396de6ed74293e - pristine_git_object: 4d2e846c13e798a58d0bc37ae6b7f1e5ab07ef1f + last_write_checksum: sha1:d722c7f399ec4c0e637e5f73805d576d438c4710 + pristine_git_object: c9dd55e7c38c9d1e1ad4ef7ce4e3d1d7e46d57a2 docs/sdks/scim/README.mdx: id: fd6d8a91a053 last_write_checksum: sha1:28c02b55a629845b4912e9eac168cfc0cb7eb785 @@ -11572,8 +11572,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:e28f7bb317d0079eba0f37a7a2e7cabc321602e8 - pristine_git_object: c467f2034850c4a2372520ddf74fa3b8cebb10a3 + last_write_checksum: sha1:9f0dca296be25de0a997509a6f5e337f4f7962df + pristine_git_object: e92db736d76e6e2927d74cacba0553e74f8e64b9 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -11600,8 +11600,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:3cea337387abf552d701b1ece5b3b97f00dde6c0 - pristine_git_object: c7a3b0845924c4f6bfe20338a3360003e3185e9b + last_write_checksum: sha1:39d91473d7e7c29a245937ae51baece1dc05e2d3 + pristine_git_object: 949b502ab5d9ce1a5f75345dfcff095fec57dd04 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -11632,16 +11632,16 @@ trackedFiles: pristine_git_object: aa95a65cf560fd7edb0c3c6f5fed707ca5015da3 src/openrouter/beta_responses.py: id: 001eaf848bf1 - last_write_checksum: sha1:9fc9beb75facbed656d7757b34bf63724c78815a - pristine_git_object: c3407b839ccc12fbe61aee7e522386e3e28df043 + last_write_checksum: sha1:303e4e92f493cb7156eeddc41827549626445451 + pristine_git_object: 7f694159275ebd1a7badbce458671d0f79456fe9 src/openrouter/byok.py: id: bec352462ae1 last_write_checksum: sha1:2c6adc3f1205dbfc0c73be9db646118855b8fb0f pristine_git_object: 2b4c969b6babcec0674cba96ffc380dbcdfa2322 src/openrouter/chat.py: id: 723fdce15c1d - last_write_checksum: sha1:33ac449ca72c5c907ec419f04ec9d6a7e82b955e - pristine_git_object: 43dbe7dff7ebfc3a17ea4ee9241441c8fb64a20f + last_write_checksum: sha1:bf5eb38e11216ea7cbdf7cada0a28015878df867 + pristine_git_object: 185441a6f45afc729ec60515598a34e8c9182365 src/openrouter/classifications.py: id: 4f2efc24b95b last_write_checksum: sha1:3ab6fcd9ef679cd2149ec8dfbb4a86109cd152ad @@ -12540,8 +12540,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:34203bf0d944f6c4baa608b3600089b7b82d7210 - pristine_git_object: 5fc9915bea11993b3149d3d06dc367b75219f0be + last_write_checksum: sha1:d087f398d2b3641d52f2225132a1ab1003664633 + pristine_git_object: dc645769129a449efe0390796569f2f5b0140985 src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:832ad4df3f9f92818e36e9d26a73da3bcff3eb7a @@ -12980,8 +12980,8 @@ trackedFiles: pristine_git_object: dccefb2123d06d6d9920e7035f21a8ab5e7b86a8 src/openrouter/components/deferredbm25search.py: id: b988bf147d9f - last_write_checksum: sha1:d5415833d3abe21b9f6afd0af43c476bf8073181 - pristine_git_object: add59e787cc3b1cde02c026c2d30c38301949934 + last_write_checksum: sha1:c18b3d46bd22aa8225a0e8bd437a2216d5e2b1f1 + pristine_git_object: 88170eac0664366f3623bddd70c333150e803192 src/openrouter/components/deferredcustomsearch.py: id: 71d9d33ba373 last_write_checksum: sha1:1b308d057e8b27d8a7da76b1edf47734ab11dd0c @@ -12992,8 +12992,8 @@ trackedFiles: pristine_git_object: 21eb6b48f7b5a7eb922a55c395c18b87393913ee src/openrouter/components/deferredtoolscontrol.py: id: b8b6ceef6f86 - last_write_checksum: sha1:a34cd0144997c8f54067331cb03e492d63cc6604 - pristine_git_object: 1fd04fedb8959253991a926d32f68be2aaecc7cb + last_write_checksum: sha1:371b8a26ed641aee9c4061cd973a014197b3aa5e + pristine_git_object: dfd1e0ce16b72379fe36f077b5f1c92a700d58cd src/openrouter/components/deferredtoolsdetails.py: id: 044f0e33803d last_write_checksum: sha1:2f8fcc43fc779a0cb9621149875a5e7bbfa5e6dc @@ -13816,8 +13816,8 @@ trackedFiles: pristine_git_object: 7e69d1f775baece5f94b03d35bcd884d5e6f519d src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:4667937c65f33d988682d35e97c4c8449701f08c - pristine_git_object: 021ead331d7ed280f6499ca05b14d8700990ed70 + last_write_checksum: sha1:545003d77b5db115985e8d39e6fdacf99ae2bc84 + pristine_git_object: e1cb9dc4a88f46e0c6c79523c6031507a28e2857 src/openrouter/components/messagessearchmodelsservertool.py: id: 53d755edb120 last_write_checksum: sha1:389786fc22ba4bb47b0a086b7aa321f2f04fe943 @@ -14372,8 +14372,8 @@ trackedFiles: pristine_git_object: d5a5c820aff0971a68a725af296d68d8d3891992 src/openrouter/components/outputtoolsearchservertoolitem.py: id: fb4ec737039d - last_write_checksum: sha1:eda6d37533b1e7f37a102bfc98ca9a93c26c797e - pristine_git_object: 4829ddb5e43ef9468d66e8fb5b336024e46f4874 + last_write_checksum: sha1:ee1d3c15f23c0577932609ac3b9f5d0c486318fc + pristine_git_object: 90fe6d70aab60697f5fe69d3b0dc6044c69fb999 src/openrouter/components/outputwebfetchservertoolitem.py: id: 2b12eb287cdf last_write_checksum: sha1:60ec6ef59d691699c092120ea7dffed824197872 @@ -14744,8 +14744,8 @@ trackedFiles: pristine_git_object: 900bf08ec940565a8cbf55712a437775db00ca46 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:f228055a425937773b78b4b443f7d49670153b2f - pristine_git_object: 1b82a39295323fed14c12d89f39040578ea06de5 + last_write_checksum: sha1:9d83b013b38cb11f441fd47c479290762910d303 + pristine_git_object: 1a99218bcd70834945b1857c2a0fe6a04da8d076 src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -16320,8 +16320,8 @@ trackedFiles: pristine_git_object: 228602282f43dd94fb7703bb47b45a570c1aa8d2 src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:083e5bc8695b6eaee33576a647f97bf347907e89 - pristine_git_object: c817b96c018977b20069d5d3a6eb63237bbdd379 + last_write_checksum: sha1:1fe2f2960f506c3e41acfd13982a474a5498a9de + pristine_git_object: 49957cba51faee0bf1a587e9c12a06cd5f1bdd28 src/openrouter/private_endpoints.py: id: fdbce8846ed0 last_write_checksum: sha1:3d7385776334bff0c853f956633941c4fe1bc42e @@ -16344,8 +16344,8 @@ trackedFiles: pristine_git_object: 9db3cc719bd343ee7be0183d0c87b50c29e5eb31 src/openrouter/responses.py: id: f2108fb635e1 - last_write_checksum: sha1:476a8c3fced50876b320581685a93d81577404cf - pristine_git_object: ebebd8b60406ca8420d4d5abb3b24b01799f36f1 + last_write_checksum: sha1:e7412503a1fb94bd89d44158140aafa41ac0ad53 + pristine_git_object: 369de7f774ceca3150bd97de77efd91f5bf08142 src/openrouter/scim.py: id: 351afd6b616e last_write_checksum: sha1:4c9a81e177e1dbc246e0955e90365d653d2ba876 @@ -21507,8 +21507,8 @@ examples: examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.batch.create_batches()`: `response.results[].response.body.union(OpenResponsesResult).output[].union(openrouter:tool_search).sources` **Added** - * `open_router.batch.get_batches()`: `response.results[].response.body.union(OpenResponsesResult).output[].union(openrouter:tool_search).sources` **Added** + * `open_router.batch.create_batches()`: `response.results[].response.body.union(OpenResponsesResult).output[].union(openrouter:tool_search).catalog_changes` **Added** + * `open_router.batch.get_batches()`: `response.results[].response.body.union(OpenResponsesResult).output[].union(openrouter:tool_search).catalog_changes` **Added** * `open_router.presets.create_presets_chat_completions()`: `request.deferred_tools` **Changed** * `open_router.presets.create_presets_messages()`: `request.deferred_tools` **Changed** * `open_router.presets.create_presets_responses()`: `request` **Changed** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 674389101..4f53d4c8c 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.139 + version: 1.3.140 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 749a42d15..c00e4d505 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -12112,6 +12112,9 @@ components: siblings: description: 'Universal profile only, for searches the router answers through the `tool_search` wrapper; code-mode `search()` and a client-owned tool search list the matched tools alone. When true, each result also names up to 16 other deferred tools of every source a match came from, so a model that found one tool of an MCP server learns its neighbours without another search. Absent or false: results list the matched tools alone.' type: 'boolean' + spread: + description: 'Universal profile only, for keyword searches the router answers through the `tool_search` wrapper. When true, a result spreads across sources: of the 3 x limit best-scoring candidates, those scoring at least 60% of the best match take at most 2 slots per source (MCP server, namespace or shared `_` prefix; a tool with no source is never capped), and the remaining slots fill in score order, so a catalog with several systems for one job (web search, page extraction) shows one of each instead of the top system''s siblings. Absent or false: results are the best matches in score order.' + type: 'boolean' type: enum: - 'bm25' @@ -12163,7 +12166,7 @@ components: - 'type' type: 'object' DeferredToolsControl: - description: 'Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.' + description: 'Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.' example: profile: 'portable' protocol: 'v1' @@ -12172,6 +12175,9 @@ components: type: 'bm25' validation: 'runtime' properties: + announce_catalog_changes: + description: 'Universal profile only. When true, a catalog whose deferred tools changed between two of the model''s own turns (a client that connects MCP servers while the model works) is re-announced before the next model turn, with the sources added, changed and removed since the previous index, or that no deferred tools remain. Applies when the router lists the catalog itself; a client whose own tool search was adopted lists its deferred tools itself and is not re-announced. The announcement shares the result budget of the turn and is skipped when it does not fit. Absent or false: the catalog index is announced on a user turn only.' + type: 'boolean' cascade_mode: description: 'How a universal `tool_search` query reaches the client''s own tool search. Absent or `keywords`: a `select:` query becomes the words of the selected names and the limit is always filled. `native`: a `select:` query passes through verbatim when the client search documents `select:`, and the limit field is sent only when the model gave one, unless the client search requires it, in which case its documented default is sent. Experimental.' enum: @@ -28611,6 +28617,10 @@ components: description: 'The ID of the model call that ran the search. Replaying the item reuses it.' example: 'call_search_1' type: 'string' + catalog_changes: + description: 'What the announced index added and removed since the previous one, when the request opted into `announce_catalog_changes` and the catalog changed between model turns. Replaying the item shows the same lines.' + example: 'Added since the previous index: mcp__okta (113).' + type: 'string' catalog_index: description: 'The deferred-tool index the router showed the model with a pre-search, listing tool sources and names. Replaying the item shows the same index.' example: "Deferred tools, found with tool_search and called with tool_exec:\nSources: mcp__sentry (12)." diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 6c1aea095..1bb07cae5 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:baa5345d553e8c08c25ae5eebfd9e6ad8bc1d5c89412972464dcd0c7bb50f9b0 - sourceBlobDigest: sha256:dfc0969ec07dc0510a783f65038a0e3f0cc8eb18a69ffa0615c9980af9db8236 + sourceRevisionDigest: sha256:37aa1e6df993cf6f4b6dc7546a7cd770f8ba5da6894821053e47f6d921c66d14 + sourceBlobDigest: sha256:78be206324d2799a542bffa4b6224b31b5284ad94e7b914eac21523272ac7afd tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:baa5345d553e8c08c25ae5eebfd9e6ad8bc1d5c89412972464dcd0c7bb50f9b0 - sourceBlobDigest: sha256:dfc0969ec07dc0510a783f65038a0e3f0cc8eb18a69ffa0615c9980af9db8236 + sourceRevisionDigest: sha256:37aa1e6df993cf6f4b6dc7546a7cd770f8ba5da6894821053e47f6d921c66d14 + sourceBlobDigest: sha256:78be206324d2799a542bffa4b6224b31b5284ad94e7b914eac21523272ac7afd codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:9baf4b11c2a0203b1649672707f4d5ce5fdcf06f8eb40ab2264b74ef3e267866 + codeSamplesRevisionDigest: sha256:b23c29a29f211d8968416eeea6a6304ceb1c7ae9cd3e44cdf085101a01063237 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index 0920ab14e..fb243237c 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4159,4 +4159,14 @@ Based on: ### Generated - [python v1.3.139] . ### Releases -- [PyPI v1.3.139] https://pypi.org/project/openrouter/1.3.139 - . \ No newline at end of file +- [PyPI v1.3.139] https://pypi.org/project/openrouter/1.3.139 - . + +## 2026-11-08 02:22:14 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.140] . +### Releases +- [PyPI v1.3.140] https://pypi.org/project/openrouter/1.3.140 - . \ No newline at end of file diff --git a/docs/components/chatrequest.mdx b/docs/components/chatrequest.mdx index 2f1b24124..bd3f30cfb 100644 --- a/docs/components/chatrequest.mdx +++ b/docs/components/chatrequest.mdx @@ -11,7 +11,7 @@ Chat completion request parameters | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `frequency_penalty` | *OptionalNullable[float]* | ➖ | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../components/imageconfig.mdx)] | ➖ | 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"
} | | `logit_bias` | Dict[str, *float*] | ➖ | Token logit bias adjustments | \{
"50256": -100
} | diff --git a/docs/components/deferredbm25search.mdx b/docs/components/deferredbm25search.mdx index abed2b5ad..88953c20c 100644 --- a/docs/components/deferredbm25search.mdx +++ b/docs/components/deferredbm25search.mdx @@ -7,8 +7,9 @@ Deterministic BM25 retrieval over supplied tool definitions. ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `max_results` | *Optional[int]* | ➖ | N/A | -| `siblings` | *Optional[bool]* | ➖ | Universal profile only, for searches the router answers through the `tool_search` wrapper; code-mode `search()` and a client-owned tool search list the matched tools alone. When true, each result also names up to 16 other deferred tools of every source a match came from, so a model that found one tool of an MCP server learns its neighbours without another search. Absent or false: results list the matched tools alone. | -| `type` | [components.DeferredBm25SearchType](../components/deferredbm25searchtype.mdx) | ✔️ | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `max_results` | *Optional[int]* | ➖ | N/A | +| `siblings` | *Optional[bool]* | ➖ | Universal profile only, for searches the router answers through the `tool_search` wrapper; code-mode `search()` and a client-owned tool search list the matched tools alone. When true, each result also names up to 16 other deferred tools of every source a match came from, so a model that found one tool of an MCP server learns its neighbours without another search. Absent or false: results list the matched tools alone. | +| `spread` | *Optional[bool]* | ➖ | Universal profile only, for keyword searches the router answers through the `tool_search` wrapper. When true, a result spreads across sources: of the 3 x limit best-scoring candidates, those scoring at least 60% of the best match take at most 2 slots per source (MCP server, namespace or shared `_` prefix; a tool with no source is never capped), and the remaining slots fill in score order, so a catalog with several systems for one job (web search, page extraction) shows one of each instead of the top system's siblings. Absent or false: results are the best matches in score order. | +| `type` | [components.DeferredBm25SearchType](../components/deferredbm25searchtype.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/deferredtoolscontrol.mdx b/docs/components/deferredtoolscontrol.mdx index 06a67d94e..b2034e5bd 100644 --- a/docs/components/deferredtoolscontrol.mdx +++ b/docs/components/deferredtoolscontrol.mdx @@ -2,18 +2,19 @@ title: "DeferredToolsControl" --- -Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. +Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cascade_mode` | [Optional[components.CascadeMode]](../components/cascademode.mdx) | ➖ | How a universal `tool_search` query reaches the client's own tool search. Absent or `keywords`: a `select:` query becomes the words of the selected names and the limit is always filled. `native`: a `select:` query passes through verbatim when the client search documents `select:`, and the limit field is sent only when the model gave one, unless the client search requires it, in which case its documented default is sent. Experimental. | | -| `hint` | *Optional[str]* | ➖ | Universal profile only. Caller text announced to the model with the deferred catalog before its first turn, for example which sources the task needs. Repeated only when it changes. Trimmed before the length bounds apply. Recorded in the `catalog_index` discovery record of the response, so it is replayed with the conversation. | | -| `interface` | [Optional[components.Interface]](../components/interface.mdx) | ➖ | How the universal profile exposes the hidden catalog to the provider. Absent or `wrappers`: the `tool_search` and `tool_exec` tools. `code_mode`: one `tool_code` tool that runs a short JavaScript program in which `search()` and `call()` reach the catalog, so several searches and calls complete in one tool result. Experimental. | | -| `profile` | [components.Profile](../components/profile.mdx) | ✔️ | Loading profile. `portable` serves the `defer_loading` tools with router-built search and call wrappers on any model and keeps the catalog fixed. `universal` defers every wrappable tool behind the same wrappers so the provider-facing tool list never changes, and rebuilds the catalog from each request so tools can be added or removed mid-conversation. | | -| `protocol` | [components.Protocol](../components/protocol.mdx) | ✔️ | N/A | | -| `scope` | [Optional[components.DeferredToolsControlScope]](../components/deferredtoolscontrolscope.mdx) | ➖ | Which tools the universal profile defers. Absent or `all`: every wrappable tool outside the coding-harness core set. `mcp`: only MCP server tools (`mcp__*` names and Responses namespaces outside `functions`); the harness keeps its own built-in tools direct. `client`: only the tools the client itself marked `defer_loading`, so a harness with its own tool search keeps its other direct tools direct; an adopted client tool search is still replaced by the router wrappers, and a client-deferred tool the router cannot wrap stays direct. Experimental. | | -| `search` | [components.DeferredToolsSearchStrategy](../components/deferredtoolssearchstrategy.mdx) | ✔️ | Router-local regex/BM25 or caller-owned custom search. | \{
"max_results": 5,
"type": "bm25"
} | -| `validation` | [components.Validation](../components/validation.mdx) | ✔️ | Where tool-call arguments are checked against the original schema. Only `runtime` (in OpenRouter) is available in this release. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `announce_catalog_changes` | *Optional[bool]* | ➖ | Universal profile only. When true, a catalog whose deferred tools changed between two of the model's own turns (a client that connects MCP servers while the model works) is re-announced before the next model turn, with the sources added, changed and removed since the previous index, or that no deferred tools remain. Applies when the router lists the catalog itself; a client whose own tool search was adopted lists its deferred tools itself and is not re-announced. The announcement shares the result budget of the turn and is skipped when it does not fit. Absent or false: the catalog index is announced on a user turn only. | | +| `cascade_mode` | [Optional[components.CascadeMode]](../components/cascademode.mdx) | ➖ | How a universal `tool_search` query reaches the client's own tool search. Absent or `keywords`: a `select:` query becomes the words of the selected names and the limit is always filled. `native`: a `select:` query passes through verbatim when the client search documents `select:`, and the limit field is sent only when the model gave one, unless the client search requires it, in which case its documented default is sent. Experimental. | | +| `hint` | *Optional[str]* | ➖ | Universal profile only. Caller text announced to the model with the deferred catalog before its first turn, for example which sources the task needs. Repeated only when it changes. Trimmed before the length bounds apply. Recorded in the `catalog_index` discovery record of the response, so it is replayed with the conversation. | | +| `interface` | [Optional[components.Interface]](../components/interface.mdx) | ➖ | How the universal profile exposes the hidden catalog to the provider. Absent or `wrappers`: the `tool_search` and `tool_exec` tools. `code_mode`: one `tool_code` tool that runs a short JavaScript program in which `search()` and `call()` reach the catalog, so several searches and calls complete in one tool result. Experimental. | | +| `profile` | [components.Profile](../components/profile.mdx) | ✔️ | Loading profile. `portable` serves the `defer_loading` tools with router-built search and call wrappers on any model and keeps the catalog fixed. `universal` defers every wrappable tool behind the same wrappers so the provider-facing tool list never changes, and rebuilds the catalog from each request so tools can be added or removed mid-conversation. | | +| `protocol` | [components.Protocol](../components/protocol.mdx) | ✔️ | N/A | | +| `scope` | [Optional[components.DeferredToolsControlScope]](../components/deferredtoolscontrolscope.mdx) | ➖ | Which tools the universal profile defers. Absent or `all`: every wrappable tool outside the coding-harness core set. `mcp`: only MCP server tools (`mcp__*` names and Responses namespaces outside `functions`); the harness keeps its own built-in tools direct. `client`: only the tools the client itself marked `defer_loading`, so a harness with its own tool search keeps its other direct tools direct; an adopted client tool search is still replaced by the router wrappers, and a client-deferred tool the router cannot wrap stays direct. Experimental. | | +| `search` | [components.DeferredToolsSearchStrategy](../components/deferredtoolssearchstrategy.mdx) | ✔️ | Router-local regex/BM25 or caller-owned custom search. | \{
"max_results": 5,
"type": "bm25"
} | +| `validation` | [components.Validation](../components/validation.mdx) | ✔️ | Where tool-call arguments are checked against the original schema. Only `runtime` (in OpenRouter) is available in this release. | | \ No newline at end of file diff --git a/docs/components/messagesrequest.mdx b/docs/components/messagesrequest.mdx index 1c3e18f58..f5f01405b 100644 --- a/docs/components/messagesrequest.mdx +++ b/docs/components/messagesrequest.mdx @@ -11,7 +11,7 @@ Request schema for Anthropic Messages API endpoint | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | N/A | | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `fallbacks` | List[[components.MessagesFallbackParam](../components/messagesfallbackparam.mdx)] | ➖ | 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]* | ➖ | N/A | | | `messages` | List[[components.MessagesMessageParam](../components/messagesmessageparam.mdx)] | ✔️ | N/A | | diff --git a/docs/components/outputtoolsearchservertoolitem.mdx b/docs/components/outputtoolsearchservertoolitem.mdx index 6b1e2f064..433141ae0 100644 --- a/docs/components/outputtoolsearchservertoolitem.mdx +++ b/docs/components/outputtoolsearchservertoolitem.mdx @@ -7,18 +7,19 @@ An openrouter:tool_search server tool output item ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `arguments` | *Optional[str]* | ➖ | The JSON arguments of the model call, verbatim. Replaying the item reuses them. | \{"query":"weather tools"} | -| `call_id` | *Optional[str]* | ➖ | The ID of the model call that ran the search. Replaying the item reuses it. | call_search_1 | -| `catalog_index` | *Optional[str]* | ➖ | The deferred-tool index the router showed the model with a pre-search, listing tool sources and names. Replaying the item shows the same index. | Deferred tools, found with tool_search and called with tool_exec:
Sources: mcp__sentry (12). | -| `error` | *Optional[str]* | ➖ | The error message when the tool call failed before producing a result. Set together with `status: 'failed'`; absent on a successful call. | Tool execution failed | -| `format_` | [Optional[components.OutputToolSearchServerToolItemFormat]](../components/outputtoolsearchservertoolitemformat.mdx) | ➖ | How the model saw the matches. `compact` means each tool by name, description, and input shape, plus a call example. Replaying the item renders the same result. | compact | -| `hint` | *Optional[str]* | ➖ | The guidance the model got when the search matched no tools. | No tools matched. Search again with other keywords, or load tools by exact name with "select:Name1,Name2". | -| `id` | *Optional[str]* | ➖ | N/A | | -| `matches` | List[[components.Match](../components/match.mdx)] | ➖ | N/A | | -| `query` | *Optional[str]* | ➖ | N/A | | -| `sources` | Dict[str, List[*str*]] | ➖ | The other deferred tools of each source a match came from, by name, when the search listed siblings. Replaying the item shows the same names. | \{
"mcp__tavily": [
"mcp__tavily__tavily_extract",
"mcp__tavily__tavily_crawl"
]
} | -| `status` | [components.FailableToolCallStatus](../components/failabletoolcallstatus.mdx) | ✔️ | N/A | completed | -| `turn_call_ids` | List[*str*] | ➖ | The IDs of every tool call in the model response that ran the search, in order. Replaying the item keeps those calls in one turn. | [
"call_search_1",
"call_exec_1"
] | -| `type` | [components.OutputToolSearchServerToolItemType](../components/outputtoolsearchservertoolitemtype.mdx) | ✔️ | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `arguments` | *Optional[str]* | ➖ | The JSON arguments of the model call, verbatim. Replaying the item reuses them. | \{"query":"weather tools"} | +| `call_id` | *Optional[str]* | ➖ | The ID of the model call that ran the search. Replaying the item reuses it. | call_search_1 | +| `catalog_changes` | *Optional[str]* | ➖ | What the announced index added and removed since the previous one, when the request opted into `announce_catalog_changes` and the catalog changed between model turns. Replaying the item shows the same lines. | Added since the previous index: mcp__okta (113). | +| `catalog_index` | *Optional[str]* | ➖ | The deferred-tool index the router showed the model with a pre-search, listing tool sources and names. Replaying the item shows the same index. | Deferred tools, found with tool_search and called with tool_exec:
Sources: mcp__sentry (12). | +| `error` | *Optional[str]* | ➖ | The error message when the tool call failed before producing a result. Set together with `status: 'failed'`; absent on a successful call. | Tool execution failed | +| `format_` | [Optional[components.OutputToolSearchServerToolItemFormat]](../components/outputtoolsearchservertoolitemformat.mdx) | ➖ | How the model saw the matches. `compact` means each tool by name, description, and input shape, plus a call example. Replaying the item renders the same result. | compact | +| `hint` | *Optional[str]* | ➖ | The guidance the model got when the search matched no tools. | No tools matched. Search again with other keywords, or load tools by exact name with "select:Name1,Name2". | +| `id` | *Optional[str]* | ➖ | N/A | | +| `matches` | List[[components.Match](../components/match.mdx)] | ➖ | N/A | | +| `query` | *Optional[str]* | ➖ | N/A | | +| `sources` | Dict[str, List[*str*]] | ➖ | The other deferred tools of each source a match came from, by name, when the search listed siblings. Replaying the item shows the same names. | \{
"mcp__tavily": [
"mcp__tavily__tavily_extract",
"mcp__tavily__tavily_crawl"
]
} | +| `status` | [components.FailableToolCallStatus](../components/failabletoolcallstatus.mdx) | ✔️ | N/A | completed | +| `turn_call_ids` | List[*str*] | ➖ | The IDs of every tool call in the model response that ran the search, in order. Replaying the item keeps those calls in one turn. | [
"call_search_1",
"call_exec_1"
] | +| `type` | [components.OutputToolSearchServerToolItemType](../components/outputtoolsearchservertoolitemtype.mdx) | ✔️ | N/A | | \ No newline at end of file diff --git a/docs/components/responsesrequest.mdx b/docs/components/responsesrequest.mdx index aed35107c..fba888a27 100644 --- a/docs/components/responsesrequest.mdx +++ b/docs/components/responsesrequest.mdx @@ -13,7 +13,7 @@ Request schema for Responses endpoint | `background` | *OptionalNullable[bool]* | ➖ | N/A | | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `frequency_penalty` | *OptionalNullable[float]* | ➖ | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../components/imageconfig.mdx)] | ➖ | 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"
} | | `include` | List[[components.ResponseIncludesEnum](../components/responseincludesenum.mdx)] | ➖ | N/A | | diff --git a/docs/sdks/betaresponses/README.mdx b/docs/sdks/betaresponses/README.mdx index 602c654ec..d8a2042d4 100644 --- a/docs/sdks/betaresponses/README.mdx +++ b/docs/sdks/betaresponses/README.mdx @@ -72,7 +72,7 @@ with OpenRouter( | `background` | *OptionalNullable[bool]* | ➖ | N/A | | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `frequency_penalty` | *OptionalNullable[float]* | ➖ | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | ➖ | 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"
} | | `include` | List[[components.ResponseIncludesEnum](../../components/responseincludesenum.mdx)] | ➖ | N/A | | diff --git a/docs/sdks/chat/README.mdx b/docs/sdks/chat/README.mdx index 25f5f7718..e4f71ca62 100644 --- a/docs/sdks/chat/README.mdx +++ b/docs/sdks/chat/README.mdx @@ -86,7 +86,7 @@ with OpenRouter( | `x_open_router_metadata` | [Optional[components.MetadataLevel]](../../components/metadatalevel.mdx) | ➖ | 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) | ➖ | 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) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `frequency_penalty` | *OptionalNullable[float]* | ➖ | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | ➖ | 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"
} | | `logit_bias` | Dict[str, *float*] | ➖ | Token logit bias adjustments | \{
"50256": -100
} | diff --git a/docs/sdks/presets/README.mdx b/docs/sdks/presets/README.mdx index f5e755b96..f6e29f231 100644 --- a/docs/sdks/presets/README.mdx +++ b/docs/sdks/presets/README.mdx @@ -167,7 +167,7 @@ with OpenRouter( | `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `frequency_penalty` | *OptionalNullable[float]* | ➖ | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | ➖ | 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"
} | | `logit_bias` | Dict[str, *float*] | ➖ | Token logit bias adjustments | \{
"50256": -100
} | @@ -267,7 +267,7 @@ with OpenRouter( | `workspace_id` | *Optional[str]* | ➖ | Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. | 750e8400-e29b-41d4-a716-446655440002 | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | N/A | | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `fallbacks` | List[[components.MessagesFallbackParam](../../components/messagesfallbackparam.mdx)] | ➖ | 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]* | ➖ | N/A | | | `metadata` | [Optional[components.MessagesRequestMetadata]](../../components/messagesrequestmetadata.mdx) | ➖ | N/A | | @@ -347,7 +347,7 @@ with OpenRouter( | `background` | *OptionalNullable[bool]* | ➖ | N/A | | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `frequency_penalty` | *OptionalNullable[float]* | ➖ | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | ➖ | 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"
} | | `include` | List[[components.ResponseIncludesEnum](../../components/responseincludesenum.mdx)] | ➖ | N/A | | diff --git a/docs/sdks/responses/README.mdx b/docs/sdks/responses/README.mdx index 4d2e846c1..c9dd55e7c 100644 --- a/docs/sdks/responses/README.mdx +++ b/docs/sdks/responses/README.mdx @@ -72,7 +72,7 @@ with OpenRouter( | `background` | *OptionalNullable[bool]* | ➖ | N/A | | | `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | ➖ | 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) | ➖ | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | -| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | +| `deferred_tools` | [Optional[components.DeferredToolsControl]](../../components/deferredtoolscontrol.mdx) | ➖ | Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. | \{
"profile": "portable",
"protocol": "v1",
"search": \{
"max_results": 5,
"type": "bm25"
},
"validation": "runtime"
} | | `frequency_penalty` | *OptionalNullable[float]* | ➖ | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | ➖ | 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"
} | | `include` | List[[components.ResponseIncludesEnum](../../components/responseincludesenum.mdx)] | ➖ | N/A | | diff --git a/pyproject.toml b/pyproject.toml index c467f2034..e92db736d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.139" +version = "1.3.140" 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 c7a3b0845..949b502ab 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.139" +__version__: str = "1.3.140" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.139 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.140 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/beta_responses.py b/src/openrouter/beta_responses.py index c3407b839..7f6941592 100644 --- a/src/openrouter/beta_responses.py +++ b/src/openrouter/beta_responses.py @@ -158,7 +158,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -337,7 +337,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -519,7 +519,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -700,7 +700,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1170,7 +1170,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1349,7 +1349,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1531,7 +1531,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1712,7 +1712,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index 43dbe7dff..185441a6f 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -150,7 +150,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -325,7 +325,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -502,7 +502,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -678,7 +678,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -1143,7 +1143,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -1318,7 +1318,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -1496,7 +1496,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -1673,7 +1673,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index 5fc9915be..dc6457691 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -262,7 +262,7 @@ class ChatRequestTypedDict(TypedDict): debug: NotRequired[ChatDebugOptionsTypedDict] r"""Debug options for inspecting request transformations (streaming only)""" deferred_tools: NotRequired[DeferredToolsControlTypedDict] - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" frequency_penalty: NotRequired[Nullable[float]] r"""Frequency penalty (-2.0 to 2.0)""" image_config: NotRequired[Dict[str, ImageConfigTypedDict]] @@ -353,7 +353,7 @@ class ChatRequest(BaseModel): r"""Debug options for inspecting request transformations (streaming only)""" deferred_tools: Optional[DeferredToolsControl] = None - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" frequency_penalty: OptionalNullable[float] = UNSET r"""Frequency penalty (-2.0 to 2.0)""" diff --git a/src/openrouter/components/deferredbm25search.py b/src/openrouter/components/deferredbm25search.py index add59e787..88170eac0 100644 --- a/src/openrouter/components/deferredbm25search.py +++ b/src/openrouter/components/deferredbm25search.py @@ -17,6 +17,8 @@ class DeferredBm25SearchTypedDict(TypedDict): max_results: NotRequired[int] siblings: NotRequired[bool] r"""Universal profile only, for searches the router answers through the `tool_search` wrapper; code-mode `search()` and a client-owned tool search list the matched tools alone. When true, each result also names up to 16 other deferred tools of every source a match came from, so a model that found one tool of an MCP server learns its neighbours without another search. Absent or false: results list the matched tools alone.""" + spread: NotRequired[bool] + r"""Universal profile only, for keyword searches the router answers through the `tool_search` wrapper. When true, a result spreads across sources: of the 3 x limit best-scoring candidates, those scoring at least 60% of the best match take at most 2 slots per source (MCP server, namespace or shared `_` prefix; a tool with no source is never capped), and the remaining slots fill in score order, so a catalog with several systems for one job (web search, page extraction) shows one of each instead of the top system's siblings. Absent or false: results are the best matches in score order.""" class DeferredBm25Search(BaseModel): @@ -29,9 +31,12 @@ class DeferredBm25Search(BaseModel): siblings: Optional[bool] = None r"""Universal profile only, for searches the router answers through the `tool_search` wrapper; code-mode `search()` and a client-owned tool search list the matched tools alone. When true, each result also names up to 16 other deferred tools of every source a match came from, so a model that found one tool of an MCP server learns its neighbours without another search. Absent or false: results list the matched tools alone.""" + spread: Optional[bool] = None + r"""Universal profile only, for keyword searches the router answers through the `tool_search` wrapper. When true, a result spreads across sources: of the 3 x limit best-scoring candidates, those scoring at least 60% of the best match take at most 2 slots per source (MCP server, namespace or shared `_` prefix; a tool with no source is never capped), and the remaining slots fill in score order, so a catalog with several systems for one job (web search, page extraction) shows one of each instead of the top system's siblings. Absent or false: results are the best matches in score order.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["max_results", "siblings"]) + optional_fields = set(["max_results", "siblings", "spread"]) serialized = handler(self) m = {} diff --git a/src/openrouter/components/deferredtoolscontrol.py b/src/openrouter/components/deferredtoolscontrol.py index 1fd04fedb..dfd1e0ce1 100644 --- a/src/openrouter/components/deferredtoolscontrol.py +++ b/src/openrouter/components/deferredtoolscontrol.py @@ -60,7 +60,7 @@ class DeferredToolsControlTypedDict(TypedDict): - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" profile: Profile r"""Loading profile. `portable` serves the `defer_loading` tools with router-built search and call wrappers on any model and keeps the catalog fixed. `universal` defers every wrappable tool behind the same wrappers so the provider-facing tool list never changes, and rebuilds the catalog from each request so tools can be added or removed mid-conversation.""" @@ -69,6 +69,8 @@ class DeferredToolsControlTypedDict(TypedDict): r"""Router-local regex/BM25 or caller-owned custom search.""" validation: Validation r"""Where tool-call arguments are checked against the original schema. Only `runtime` (in OpenRouter) is available in this release.""" + announce_catalog_changes: NotRequired[bool] + r"""Universal profile only. When true, a catalog whose deferred tools changed between two of the model's own turns (a client that connects MCP servers while the model works) is re-announced before the next model turn, with the sources added, changed and removed since the previous index, or that no deferred tools remain. Applies when the router lists the catalog itself; a client whose own tool search was adopted lists its deferred tools itself and is not re-announced. The announcement shares the result budget of the turn and is skipped when it does not fit. Absent or false: the catalog index is announced on a user turn only.""" cascade_mode: NotRequired[CascadeMode] r"""How a universal `tool_search` query reaches the client's own tool search. Absent or `keywords`: a `select:` query becomes the words of the selected names and the limit is always filled. `native`: a `select:` query passes through verbatim when the client search documents `select:`, and the limit field is sent only when the model gave one, unless the client search requires it, in which case its documented default is sent. Experimental.""" hint: NotRequired[str] @@ -80,7 +82,7 @@ class DeferredToolsControlTypedDict(TypedDict): class DeferredToolsControl(BaseModel): - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" profile: Profile r"""Loading profile. `portable` serves the `defer_loading` tools with router-built search and call wrappers on any model and keeps the catalog fixed. `universal` defers every wrappable tool behind the same wrappers so the provider-facing tool list never changes, and rebuilds the catalog from each request so tools can be added or removed mid-conversation.""" @@ -93,6 +95,9 @@ class DeferredToolsControl(BaseModel): validation: Validation r"""Where tool-call arguments are checked against the original schema. Only `runtime` (in OpenRouter) is available in this release.""" + announce_catalog_changes: Optional[bool] = None + r"""Universal profile only. When true, a catalog whose deferred tools changed between two of the model's own turns (a client that connects MCP servers while the model works) is re-announced before the next model turn, with the sources added, changed and removed since the previous index, or that no deferred tools remain. Applies when the router lists the catalog itself; a client whose own tool search was adopted lists its deferred tools itself and is not re-announced. The announcement shares the result budget of the turn and is skipped when it does not fit. Absent or false: the catalog index is announced on a user turn only.""" + cascade_mode: Optional[CascadeMode] = None r"""How a universal `tool_search` query reaches the client's own tool search. Absent or `keywords`: a `select:` query becomes the words of the selected names and the limit is always filled. `native`: a `select:` query passes through verbatim when the client search documents `select:`, and the limit field is sent only when the model gave one, unless the client search requires it, in which case its documented default is sent. Experimental.""" @@ -107,7 +112,9 @@ class DeferredToolsControl(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["cascade_mode", "hint", "interface", "scope"]) + optional_fields = set( + ["announce_catalog_changes", "cascade_mode", "hint", "interface", "scope"] + ) serialized = handler(self) m = {} diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index 021ead331..e1cb9dc4a 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -1155,7 +1155,7 @@ class MessagesRequestTypedDict(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. 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]] deferred_tools: NotRequired[DeferredToolsControlTypedDict] - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]] r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" max_tokens: NotRequired[int] @@ -1202,7 +1202,7 @@ class MessagesRequest(BaseModel): context_management: OptionalNullable[ContextManagement] = UNSET deferred_tools: Optional[DeferredToolsControl] = None - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" fallbacks: OptionalNullable[List[MessagesFallbackParam]] = UNSET r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" diff --git a/src/openrouter/components/outputtoolsearchservertoolitem.py b/src/openrouter/components/outputtoolsearchservertoolitem.py index 4829ddb5e..90fe6d70a 100644 --- a/src/openrouter/components/outputtoolsearchservertoolitem.py +++ b/src/openrouter/components/outputtoolsearchservertoolitem.py @@ -39,6 +39,8 @@ class OutputToolSearchServerToolItemTypedDict(TypedDict): r"""The JSON arguments of the model call, verbatim. Replaying the item reuses them.""" call_id: NotRequired[str] r"""The ID of the model call that ran the search. Replaying the item reuses it.""" + catalog_changes: NotRequired[str] + r"""What the announced index added and removed since the previous one, when the request opted into `announce_catalog_changes` and the catalog changed between model turns. Replaying the item shows the same lines.""" catalog_index: NotRequired[str] r"""The deferred-tool index the router showed the model with a pre-search, listing tool sources and names. Replaying the item shows the same index.""" error: NotRequired[str] @@ -69,6 +71,9 @@ class OutputToolSearchServerToolItem(BaseModel): call_id: Optional[str] = None r"""The ID of the model call that ran the search. Replaying the item reuses it.""" + catalog_changes: Optional[str] = None + r"""What the announced index added and removed since the previous one, when the request opted into `announce_catalog_changes` and the catalog changed between model turns. Replaying the item shows the same lines.""" + catalog_index: Optional[str] = None r"""The deferred-tool index the router showed the model with a pre-search, listing tool sources and names. Replaying the item shows the same index.""" @@ -101,6 +106,7 @@ def serialize_model(self, handler): [ "arguments", "call_id", + "catalog_changes", "catalog_index", "error", "format", diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 1b82a3929..1a99218bc 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -474,7 +474,7 @@ class ResponsesRequestTypedDict(TypedDict): debug: NotRequired[ChatDebugOptionsTypedDict] r"""Debug options for inspecting request transformations (streaming only)""" deferred_tools: NotRequired[DeferredToolsControlTypedDict] - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" frequency_penalty: NotRequired[Nullable[float]] image_config: NotRequired[Dict[str, ImageConfigTypedDict]] r"""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.""" @@ -547,7 +547,7 @@ class ResponsesRequest(BaseModel): r"""Debug options for inspecting request transformations (streaming only)""" deferred_tools: Optional[DeferredToolsControl] = None - r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged.""" + r"""Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it.""" frequency_penalty: OptionalNullable[float] = UNSET diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index c817b96c0..49957cba5 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -793,7 +793,7 @@ def create_presets_chat_completions( :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -1173,7 +1173,7 @@ async def create_presets_chat_completions_async( :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param logit_bias: Token logit bias adjustments @@ -1542,7 +1542,7 @@ def create_presets_messages( :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: :param metadata: @@ -1877,7 +1877,7 @@ async def create_presets_messages_async( :param workspace_id: Workspace to create the preset in. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace. :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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: :param metadata: @@ -2229,7 +2229,7 @@ def create_presets_responses( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -2614,7 +2614,7 @@ async def create_presets_responses_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index ebebd8b60..369de7f77 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -158,7 +158,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -337,7 +337,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -519,7 +519,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -700,7 +700,7 @@ def send( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1170,7 +1170,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1349,7 +1349,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1531,7 +1531,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: @@ -1712,7 +1712,7 @@ async def send_async( :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. 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 deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation; keep the catalog unchanged. + :param deferred_tools: Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with `announce_catalog_changes`, tells the model about it. :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. :param include: diff --git a/uv.lock b/uv.lock index 1eb6bf16e..49d09b378 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.139" +version = "1.3.140" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 1479e6a76096f9d19a2021502f43cb4c60549c30 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:25:20 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow