From ee4e790b2df2e65b17aa4b37af637b7374d48522 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 14 Jul 2026 21:28:36 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `open_router.chat.send()`: * `request` **Changed** * `response.choices[].message.content.union(Array)[].union(text).prompt_cache_breakpoint` **Added** * `open_router.presets.create_presets_chat_completions()`: `request` **Changed** --- .speakeasy/gen.lock | 210 +++++++++--------- .speakeasy/gen.yaml | 2 +- .speakeasy/out.openapi.yaml | 14 +- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- .../anthropiccachecontroldirective.mdx | 2 +- .../anthropicdocumentblockparam.mdx | 16 +- docs/components/anthropicimageblockparam.mdx | 10 +- .../anthropicsearchresultblockparam.mdx | 16 +- docs/components/anthropictextblockparam.mdx | 12 +- docs/components/caching.mdx | 2 +- docs/components/chatcontentcachecontrol.mdx | 2 +- docs/components/chatcontenttext.mdx | 11 +- docs/components/chatfunctiontoolfunction.mdx | 2 +- docs/components/chatrequest.mdx | 4 +- docs/components/contentcompaction.mdx | 10 +- docs/components/contentservertooluse.mdx | 14 +- docs/components/contenttoolresult.mdx | 14 +- docs/components/contenttooluse.mdx | 14 +- .../components/contentwebsearchtoolresult.mdx | 12 +- docs/components/fusionservertoolconfig.mdx | 20 +- docs/components/inputtext.mdx | 10 +- docs/components/messagesrequest.mdx | 2 +- docs/components/promptcachebreakpoint.mdx | 2 +- docs/components/responsesrequest.mdx | 2 +- docs/components/tooladvisor20260301.mdx | 20 +- docs/components/toolbash20250124.mdx | 10 +- docs/components/toolcustom.mdx | 14 +- docs/components/tooltexteditor20250124.mdx | 10 +- docs/components/toolwebsearch20250305.mdx | 18 +- docs/components/toolwebsearch20260209.mdx | 20 +- docs/sdks/chat/README.mdx | 4 +- docs/sdks/presets/README.mdx | 8 +- docs/sdks/responses/README.mdx | 2 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/chat.py | 74 +++++- .../anthropiccachecontroldirective.py | 4 +- .../components/anthropicdocumentblockparam.py | 4 +- .../components/anthropicimageblockparam.py | 4 +- .../anthropicsearchresultblockparam.py | 4 +- .../components/anthropictextblockparam.py | 4 +- .../components/chatcontentcachecontrol.py | 4 +- src/openrouter/components/chatcontenttext.py | 31 ++- src/openrouter/components/chatfunctiontool.py | 4 +- src/openrouter/components/chatrequest.py | 17 +- .../components/fusionservertoolconfig.py | 4 +- src/openrouter/components/inputtext.py | 4 +- .../components/messagesmessageparam.py | 20 +- src/openrouter/components/messagesrequest.py | 32 +-- .../components/promptcachebreakpoint.py | 4 +- src/openrouter/components/responsesrequest.py | 4 +- src/openrouter/presets.py | 34 ++- src/openrouter/responses.py | 16 +- uv.lock | 2 +- 55 files changed, 473 insertions(+), 334 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 082440b1..9a1bbadf 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 71daa6f89575defb9d76a73e5fb672ae + docChecksum: d4956b75e623f552544bf0eee219fb15 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 0.11.31 - configChecksum: 96b0d171f179dadfbe9d5efdfff0c4c2 + releaseVersion: 0.11.32 + configChecksum: 2def3221df426fb9e1ca1fb865534f8e repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 056b9ee4-a227-4cc6-b7e0-3c97d424d043 - pristine_commit_hash: 9daff37b2becb50eb2fe167e87e1149e4213b27e - pristine_tree_hash: 26d42d8bfd711f5fb23141b6ab241881fd7137a9 + generation_id: c6eafc4f-1723-4a50-b64a-768ca4b13a2f + pristine_commit_hash: 2be2ba16cd458078a20e8dff747aed3a7eeba223 + pristine_tree_hash: d075876a76e82a3c03a6789df86ec9dfede361bb features: python: acceptHeaders: 3.0.0 @@ -234,8 +234,8 @@ trackedFiles: pristine_git_object: 44deb61a813fde8473d34e0a14ccaef643467e0d docs/components/anthropiccachecontroldirective.mdx: id: 5671704f9917 - last_write_checksum: sha1:03d0b8bed7d5dd448141a09c4515594bcc7ef3f2 - pristine_git_object: 5f755985a972da22e96483e3807cb2029ba18989 + last_write_checksum: sha1:a31ffcd83295557f5a070d96873408214676a2ea + pristine_git_object: 12b753fe8b98723cd210a3dac91402a026b1dfac docs/components/anthropiccachecontroldirectivetype.mdx: id: f5d844d35b58 last_write_checksum: sha1:9e513498c44431258e61e8fb25537d8f6c5d4f7d @@ -298,8 +298,8 @@ trackedFiles: pristine_git_object: 2b04c2483fceacf8300bb872ea0eed600970d160 docs/components/anthropicdocumentblockparam.mdx: id: ece98dcf04f6 - last_write_checksum: sha1:5a05c624a5a134bedac12d687f51621448627daf - pristine_git_object: 5a24251490513dca5c64fa3f8b29c80eafdcd331 + last_write_checksum: sha1:42f908ffe281fd4272a24d7eb874f76fbee47da9 + pristine_git_object: 1ed7b7cd83e412bdc9945f00a875bc681e0c96ee docs/components/anthropicdocumentblockparamcitations.mdx: id: 474518ae0167 last_write_checksum: sha1:798372e77425fd7127a318c75247ce44e6f1dbfd @@ -326,8 +326,8 @@ trackedFiles: pristine_git_object: c86bc52963eca6a9de705f418c56d17a4bf8ebc6 docs/components/anthropicimageblockparam.mdx: id: a85ff43edd3a - last_write_checksum: sha1:b2324840f7be26004674f2a59f5d66122b75437a - pristine_git_object: 2d95dd47a3b3f4551cd4a148f4936057a40587f5 + last_write_checksum: sha1:32a650d11a80f74059407954fa86eba2247fdf03 + pristine_git_object: 9be25eff134f6283b95213ba56fa2ee21c493a39 docs/components/anthropicimageblockparamsource.mdx: id: 82f05c79d5cb last_write_checksum: sha1:0939a26da32a1d150a58d6988b9ef8bbd49bacf4 @@ -382,8 +382,8 @@ trackedFiles: pristine_git_object: a538343b4f3fca39a44d3f208e702c482978c4f8 docs/components/anthropicsearchresultblockparam.mdx: id: 5c62b24b2c58 - last_write_checksum: sha1:a8acf36f4eb32d7d01a906f889f9c76e36786f24 - pristine_git_object: 517785e7ab5c58a8e41292572d2d581a0a0e3df7 + last_write_checksum: sha1:b6f01f3da19d4a430e66f5c47e90f31aa3fb0e29 + pristine_git_object: 89ae1afd55149a2e641d5330189fd5213aa7f05b docs/components/anthropicsearchresultblockparamcitations.mdx: id: e6a0db284ce9 last_write_checksum: sha1:20a8315824e11129d12d4d5c441e9fde3691a1f5 @@ -398,8 +398,8 @@ trackedFiles: pristine_git_object: 6f1e9ce880a0c3173ce7af4d14c8508b686b8ebc docs/components/anthropictextblockparam.mdx: id: bded5d409e91 - last_write_checksum: sha1:5c8b4dafc14fafa615c888b9cd207bac55ebb585 - pristine_git_object: 6d00495d81a02e202e2ae1346439d734a75df8f0 + last_write_checksum: sha1:ab2ebb14dd5e54bbadf4db4aa919d1b380b844b5 + pristine_git_object: 502d15e612cfe8df8b28ba89855683eee5f0ce4b docs/components/anthropictextblockparamtype.mdx: id: 7f03a13234b7 last_write_checksum: sha1:12c7718c5c0da4561914ed95dd6853873568bd05 @@ -758,8 +758,8 @@ trackedFiles: pristine_git_object: a7472d01b6de43fedfa76a9e608d67202a7ec529 docs/components/caching.mdx: id: edc8a0f8f37f - last_write_checksum: sha1:b4e6619f389c1440555ec567fbdcddbc9976e63e - pristine_git_object: d9c719912c5e82aa2bf9b02c54fb03c8d448ef83 + last_write_checksum: sha1:cce3835ca76b640b591de1307422aa4e391cde69 + pristine_git_object: 0d7013f54bed0390239fa49074a48d5b21711a28 docs/components/capabilitydescriptor.mdx: id: 34ac0e581d79 last_write_checksum: sha1:62ee9ccab6cec4572383cef654997ab4106d4676 @@ -810,8 +810,8 @@ trackedFiles: pristine_git_object: fdb10076d12248abeacfae19a1bd647d4a838eaa docs/components/chatcontentcachecontrol.mdx: id: 215e2356f770 - last_write_checksum: sha1:cf9c5e64dcedcccbab8d79499bea7bf76e86b1b9 - pristine_git_object: 250fd47f76c936c2e979b55caa6d4fb17b4a26ef + last_write_checksum: sha1:96bb8d2d2c51fc1b5208120f84ca175ddcd0346a + pristine_git_object: 6f1d2f8e0e284e16eeff1f0dbd03166260f3ac94 docs/components/chatcontentcachecontroltype.mdx: id: 93c1e9a9146e last_write_checksum: sha1:febb0b8575ef8fc009f71312d8fed2b596cf6d28 @@ -846,8 +846,8 @@ trackedFiles: pristine_git_object: 92c9c5c2ce23807bac9756e55803057921c34f24 docs/components/chatcontenttext.mdx: id: a2436d6c5c1c - last_write_checksum: sha1:dfda97beb6d5cdb859b9207798e34ed7ed4691f8 - pristine_git_object: a59dafe92bfb650c89244eaa89f00690fd8282d3 + last_write_checksum: sha1:bf50de67c2c4b71ef14a92a53507b1c28fa1cc5b + pristine_git_object: b31006bd9cd42c1afa9f936eb085af94ae786f4d docs/components/chatcontenttexttype.mdx: id: eb29ddb48a88 last_write_checksum: sha1:154a7cb1f0dcdc0ff60b5fcfe1ce5e86e08bb72f @@ -930,8 +930,8 @@ trackedFiles: pristine_git_object: bc9f2fa0780e97e0d13a2c10af27a5f3e666c0f5 docs/components/chatfunctiontoolfunction.mdx: id: b9f813a5b0c9 - last_write_checksum: sha1:1daf25e4f31b7013fcbcd43f86678ce1548c8423 - pristine_git_object: 7619eec425176b875101f822b806ff98a5d991c9 + last_write_checksum: sha1:649b1fe5d94d5613d6e902d5d96762be33e648eb + pristine_git_object: a6cf73c17fd5cf6752d09f7eb25a13fb8d9d4a02 docs/components/chatfunctiontoolfunctionfunction.mdx: id: 59c7a37a65c9 last_write_checksum: sha1:671313b618e2e45e37f94494b8bd88822aa4220a @@ -966,8 +966,8 @@ trackedFiles: pristine_git_object: 220be03bd674a257c2064c0455104959b3974a35 docs/components/chatrequest.mdx: id: 055812be14d8 - last_write_checksum: sha1:77fcd137afe54399a3eba5f08cf6e0ffda8cc242 - pristine_git_object: 1cc4f0f490833b0defa14840b69ea02f90820770 + last_write_checksum: sha1:8803f814796b25653c13db7cd2e167720d615499 + pristine_git_object: e831058c3a681c3f9e8896137e06d82d3c416a5a docs/components/chatrequesteffort.mdx: id: 703c73252ebd last_write_checksum: sha1:243510f188071a3f317dc06a07fbcfcedd3cf821 @@ -1242,8 +1242,8 @@ trackedFiles: pristine_git_object: 9a8e9eaadebb36e2836d73c4ed1867c5f1e564e7 docs/components/contentcompaction.mdx: id: 1923f9db3cff - last_write_checksum: sha1:59526732df9d4b5a69f3a79d1210493dff8d8898 - pristine_git_object: 39acf3a7dc4de67d2eb07a4e21e33e6cfdd2091f + last_write_checksum: sha1:db0ae20faae38b060e586c80655b79849bb4e18b + pristine_git_object: 87f9c8d7936595373ebeae59a265705db8df2721 docs/components/contentencryptedcontent.mdx: id: 0dc55809c394 last_write_checksum: sha1:97675b67fb3cdb6c892bbe01d2cd9e6bab5e4dec @@ -1354,8 +1354,8 @@ trackedFiles: pristine_git_object: f9c4eeefa07fcc73839934dd6b3d403fe7539da3 docs/components/contentservertooluse.mdx: id: 7b676db3a465 - last_write_checksum: sha1:65f0643d0a7af0e2ef8b4f2dc9a336b5a34b135c - pristine_git_object: 527a1c1ae4e8df68528db2404024b67348ab4b6c + last_write_checksum: sha1:b49ee690460e4de02996066b31e91bb1f4eb8400 + pristine_git_object: 86c112ede3a14c30546d1fb00f6526a5f854ced0 docs/components/contentthinking.mdx: id: c23024acf25a last_write_checksum: sha1:f3a989b8eb7a38f2705324263796f49a7e1722b6 @@ -1366,16 +1366,16 @@ trackedFiles: pristine_git_object: f07b01d7d44cc717b67e5648283c659fc02c72fa docs/components/contenttoolresult.mdx: id: a9a083b8900f - last_write_checksum: sha1:1a0bb46e6c27779f1f88da7eb87d0ae04acd62af - pristine_git_object: 4abde669843735aeb36b10c6a5992f8d6509cd40 + last_write_checksum: sha1:72b603d3efa32360cf6e8b6c718dd46718b0e98b + pristine_git_object: f83588a9c24d3172b8f8fd131cdc5aea073d0088 docs/components/contenttooluse.mdx: id: ad7fb52d642b - last_write_checksum: sha1:47f463246904b67a444c6072b1d927c1c6c223de - pristine_git_object: e29dae101a0e629b6cfa1473fc22d732e646ef55 + last_write_checksum: sha1:96dda7c7f895597f5f60c57b69936f77e14fc8ff + pristine_git_object: 7149ea56376799b7d485254b63acdda00e9713a4 docs/components/contentwebsearchtoolresult.mdx: id: d2401cf2f6b9 - last_write_checksum: sha1:b24e06b9ba722674a7fc4116eba838657914f166 - pristine_git_object: a2664d14e56d9f5ada405cee06d7f745e1a5a47b + last_write_checksum: sha1:d7ecfe7df3b1e89151edb59cd1525aab997b28b6 + pristine_git_object: 9a9180dcba1e86c7a26c5396f39bc4dafe160e96 docs/components/contentwebsearchtoolresulterror.mdx: id: e53d83e87e2b last_write_checksum: sha1:22dd4ec3f699feb7d8f22abff79623b427292e35 @@ -2010,8 +2010,8 @@ trackedFiles: pristine_git_object: 3c29bc4bd3bdf7037b9c3aa894180b8e4cae6098 docs/components/fusionservertoolconfig.mdx: id: 87976811b0c3 - last_write_checksum: sha1:99198fd63b66a6f465c444856fcfb35110f269fb - pristine_git_object: ec3ad69133064ba5a6911474a16a974a26963255 + last_write_checksum: sha1:267106d40b0f8e9a7601945753f7934b34084183 + pristine_git_object: 1247ee7797392ca5e7778a47b42932a97cc16203 docs/components/fusionservertoolconfigeffort.mdx: id: f5ce0fbc94aa last_write_checksum: sha1:4ce09a069b4eeae41ac1531027cf97dc4139927f @@ -2498,8 +2498,8 @@ trackedFiles: pristine_git_object: 2e56403330ecae1d43fd2e4d23976dfe5330c38d docs/components/inputtext.mdx: id: c8a97322a50a - last_write_checksum: sha1:58653e40ea0a33629dda40d2a11c8d21a75b0467 - pristine_git_object: ece32d6edb601578cdb56fc8b4a60e40bc089f22 + last_write_checksum: sha1:6f92abbb193a5d21cc129df4c5804b3f9161322d + pristine_git_object: 5908413083a34d8bdd34ed916610dc5eee0d6564 docs/components/inputtexttype.mdx: id: 91f958925357 last_write_checksum: sha1:42a8d9a6d3506e02f6024592691292b7ac255075 @@ -2770,8 +2770,8 @@ trackedFiles: pristine_git_object: cff8f3938a8bd5699d1111a6b1a926518d868da5 docs/components/messagesrequest.mdx: id: 762dd6b894c8 - last_write_checksum: sha1:8e06b3369eb4dee0ab5fee504e444cb5be1f2f3c - pristine_git_object: 2b25d420887ade7549b1848592fb24ed622b54f1 + last_write_checksum: sha1:a2837f5f14f370453c77fd6962dea4fa9fa43999 + pristine_git_object: 89b9780ced7cfd41a0f2b0296232df38e71b84ee docs/components/messagesrequestmetadata.mdx: id: facdcaeb2576 last_write_checksum: sha1:42bf112bc4f6d259c589906fd5f67c5342ab4c2d @@ -3898,8 +3898,8 @@ trackedFiles: pristine_git_object: 5fb1b765b2b0e46d40042f341bbcc91aa0d92762 docs/components/promptcachebreakpoint.mdx: id: c135956dc623 - last_write_checksum: sha1:1b0c9884eb9b6fe1d4fdf822c75cb566ead67e07 - pristine_git_object: 1d1ff6162c98c1639ea8e2e4dfa7f6d5cd7d3fcd + last_write_checksum: sha1:6df345ea99da1fdcae22895faa2ee36339ba7332 + pristine_git_object: 313ab84d0db5d181f8dea91208a4b5127f43477b docs/components/promptcachebreakpointmode.mdx: id: 05abe4e54869 last_write_checksum: sha1:f7ca9f8ff280c1fa750609f4aa13b0706d1dd7cd @@ -4246,8 +4246,8 @@ trackedFiles: pristine_git_object: 996cffee821435729436d7f29bce4333f4900382 docs/components/responsesrequest.mdx: id: 0dbcef40a4b1 - last_write_checksum: sha1:462f684189fca9eefc0809564ab964d89025724d - pristine_git_object: 371d94f398a631b4146a2a76b46dbd257637caba + last_write_checksum: sha1:51003cb482d6de367ebe0c4e2691bf41be8d384c + pristine_git_object: 3090f61cfb772d83d2ac230fb571ef3e048e423e docs/components/responsesrequestplugin.mdx: id: 4d550c41c85f last_write_checksum: sha1:ab9d1e6c062cd51fc976da6ccf393e9974171f7b @@ -4690,12 +4690,12 @@ trackedFiles: pristine_git_object: 54a7627079b16a50865cf6f2224abe36870c95fa docs/components/tooladvisor20260301.mdx: id: df2858dddd07 - last_write_checksum: sha1:94a6e30c4bc7ff7771b99d3f09c87604423b2847 - pristine_git_object: ee1f63bc170b35e5fb8da3390818160a2b4b93c6 + last_write_checksum: sha1:2dd846c19c5dabfeba4fe838ca60bd495c31e689 + pristine_git_object: a00186b54ba47296aed2eb1098928f3b4a565ceb docs/components/toolbash20250124.mdx: id: acc36fba0c55 - last_write_checksum: sha1:b0e3ad180f48dba955ae20481ae6ef55ace6b18f - pristine_git_object: d9f17ef27ea42b2251c85ffdd230af45f7293c75 + last_write_checksum: sha1:b899d22b5559c09fcaa14c5cd3ff18f914ad34d2 + pristine_git_object: d3a3ea6cfbc5118b9adad9c1a8e543e02fd2870f docs/components/toolcallstatus.mdx: id: e79e5ffbe798 last_write_checksum: sha1:338789050d562f0ac596d6a94783307e27a634b2 @@ -4734,12 +4734,12 @@ trackedFiles: pristine_git_object: 6817216b64de42e834ab68a072287701e621daa8 docs/components/toolcustom.mdx: id: b3ea2dbc7af5 - last_write_checksum: sha1:dd0734eb86cbbba753632268613a2f2ebc8e8f78 - pristine_git_object: 57073f649edd84b26f2395c46aef55c86e31ed4c + last_write_checksum: sha1:f0fdef1bc45a22946f6026d202499b63ff241711 + pristine_git_object: ce9be3cd6fbb03e8d15866baefa9f38c1398a91c docs/components/tooltexteditor20250124.mdx: id: 58d2a6f35f9f - last_write_checksum: sha1:bbc36d5c8d48b8971fed82553489759ca2379c0d - pristine_git_object: 0fe06a930a6a67a5a007185f892422f232389d3a + last_write_checksum: sha1:c785aecfc38109c995d4d2f825de0f145d3f626a + pristine_git_object: a7f1a2731ba8ab1deea97b51e63372e70e3afa0e docs/components/tooltypecustom.mdx: id: ac3c7f5f5fa6 last_write_checksum: sha1:bfbecb3b4e70cb8a4aa0379246f4ffbaae71b341 @@ -4750,12 +4750,12 @@ trackedFiles: pristine_git_object: 48e6f8afc2a41ccac4be220dd5d5d475a4d36b71 docs/components/toolwebsearch20250305.mdx: id: e583eb0b3bd1 - last_write_checksum: sha1:59297ba6e78d528a5a6cc0bcbefd1301c21af308 - pristine_git_object: 33510135de4236e72077c4acb6c8a8c65fe5f647 + last_write_checksum: sha1:a750dd139f327bf53d4cde02e6b897afa274475b + pristine_git_object: 36a096412525a09d1903488c804648047782b8be docs/components/toolwebsearch20260209.mdx: id: dfc99c1c297c - last_write_checksum: sha1:e3adde8067e2e5e5504165e7b8ebf1ca743d8352 - pristine_git_object: a70393e56b803a455f0ea3e82d9270ee84fed5fe + last_write_checksum: sha1:8237527944c9d8670c8c323ce8bec709602d8322 + pristine_git_object: 062b3155e1ffd04dae559ccc126ff8b922616aee docs/components/toomanyrequestsresponseerrordata.mdx: id: 282b92f982c7 last_write_checksum: sha1:976995e37e897805df9f3f50c0aae39e41447822 @@ -6574,8 +6574,8 @@ trackedFiles: pristine_git_object: 513bb72efe9f74672b1b60d6b45dc0aca282ddf6 docs/sdks/chat/README.mdx: id: 1dd859c23fe1 - last_write_checksum: sha1:b6c104dc6b0c3461a2264a95d886f860e7277780 - pristine_git_object: 390ca7cf2ff70cf7a4273cd1c8c13cb58eb32971 + last_write_checksum: sha1:afeaa6d1195ec68d845aa76038b47498826d48a3 + pristine_git_object: 70aca7d4ce8dd7f8356abc4d836e8bdc236e090f docs/sdks/classifications/README.mdx: id: 4786130ef02a last_write_checksum: sha1:87ea3518b4147ae7833b01da7be92d41a4b49df7 @@ -6630,8 +6630,8 @@ trackedFiles: pristine_git_object: 32a291cb837977e7cdd475c664e5d475660b2ba3 docs/sdks/presets/README.mdx: id: eeb505928d52 - last_write_checksum: sha1:0c1569e8db293c65840433adda49310960a591d1 - pristine_git_object: ef18762b9c9c42a26bf61c24af1607d7ce19c01a + last_write_checksum: sha1:77d23418817e3a4e1d7135bdbd21a61812c960ee + pristine_git_object: 82e78fb13dc1c886ea37068b24ad1e5c786b6052 docs/sdks/providers/README.mdx: id: 5ea9af111324 last_write_checksum: sha1:570b55655ee7602d3807c3218e450741f634eed6 @@ -6642,8 +6642,8 @@ trackedFiles: pristine_git_object: cd1b341b1b7c0284b9ba9b102bd8020e0d7ce707 docs/sdks/responses/README.mdx: id: abab319e080e - last_write_checksum: sha1:69540ef8f6a556c86c4ba8a6ebd4ed03e36ee927 - pristine_git_object: bbd2952598bc9e67b6080bf8ee53d7f6ac838d9c + last_write_checksum: sha1:2dbf6b499e85a4605d79d756e043f7bfbc633087 + pristine_git_object: 708c8a1312812b7d552b5e970f0fb8c27f61b4df docs/sdks/stt/README.mdx: id: 190b0dc9a5d1 last_write_checksum: sha1:a8e68ac2b0bb8640e01d962177b42ab47b24898b @@ -6666,8 +6666,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:836c2f803d896f76e749fcfbae9070ea43880710 - pristine_git_object: cc31c2921b9b60ab306c0e306efc843bf847ff03 + last_write_checksum: sha1:bd90540d9cd6c97085fa5fd5f08dbbbfa2899391 + pristine_git_object: f72d3afab559e9db67b290ca5e6337adfcda58c9 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6694,8 +6694,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:94d5d591203cb4700f3decbcd7e864a271821999 - pristine_git_object: e72721452a9f36dce4f645bd1d995077867882a8 + last_write_checksum: sha1:cffbb1cf67568b37538f51f21b858e0242adb9cf + pristine_git_object: 44f59a476730ba6703b7d5e088bbd3a81e21b362 src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -6726,8 +6726,8 @@ trackedFiles: pristine_git_object: 08b177b0b39e7f3581f1a5da13e245c3daddf9d5 src/openrouter/chat.py: id: 723fdce15c1d - last_write_checksum: sha1:79e9c02b4a16cae3c202b5ae0bfd6cd1d0d6f89b - pristine_git_object: ab93b1be035fe591f6c8fac84b57ecad89ff5b1a + last_write_checksum: sha1:2afda128e7af2900cfeeaf79cc5a52122da8c3a2 + pristine_git_object: f14c3b5188d6dfdefcc28aa685daa24276ae2990 src/openrouter/classifications.py: id: 4f2efc24b95b last_write_checksum: sha1:3ab6fcd9ef679cd2149ec8dfbb4a86109cd152ad @@ -6794,8 +6794,8 @@ trackedFiles: pristine_git_object: 870c2e75705a43762b7aa2797e5b0cde4fe40d87 src/openrouter/components/anthropiccachecontroldirective.py: id: ffa72802cd82 - last_write_checksum: sha1:c73ec323b8d1e650f51d91f00b824804e4b9f6c3 - pristine_git_object: a9292b2d0dc104b016f7bc2600275d87fbd9ecac + last_write_checksum: sha1:2c92e5081aa549627b961c97cfe0ba8d672a567c + pristine_git_object: 05b36d10c1f772110394071a9c90b1d9c31bf2c2 src/openrouter/components/anthropiccachecontrolttl.py: id: 2ec3e3546afe last_write_checksum: sha1:338e193bd6929eb6ed69da9bdb4e608e5db6121b @@ -6830,16 +6830,16 @@ trackedFiles: pristine_git_object: 50ad24f32ec87623c006381c477c46f44d84c753 src/openrouter/components/anthropicdocumentblockparam.py: id: 2c3093530540 - last_write_checksum: sha1:904f1546a7a69df231395f33cb5b1b71ae0c2611 - pristine_git_object: 686764bb6991204328c5017ab636e3d38a4f2f09 + last_write_checksum: sha1:43f9b964f383ea77663e47c9a1e1cd76b7457d2c + pristine_git_object: be2d48fefcffa05ca80bfa647f77fafe60872a7d src/openrouter/components/anthropicfiledocumentsource.py: id: d824b52285d7 last_write_checksum: sha1:5d3c89e2d60df0116aed28d9a2274cf61536af41 pristine_git_object: 06ab054ee7227cb2186c19c108145d8e19646044 src/openrouter/components/anthropicimageblockparam.py: id: 71cab07562d1 - last_write_checksum: sha1:7077151d8ef411a85bc3cdafb17ae7969c8bf7cb - pristine_git_object: 979d0464c4ef00aba59e1431a2bbd3568c411246 + last_write_checksum: sha1:fbdb3a017bc51cb2848933aca87023159951a2aa + pristine_git_object: 7b5effbbab60e15e1daa06ad703f445d3dde96b6 src/openrouter/components/anthropicimagemimetype.py: id: 2434bf06fc4f last_write_checksum: sha1:2016e4ef5d678a2af645d50cb02e022c3918d494 @@ -6866,16 +6866,16 @@ trackedFiles: pristine_git_object: d16f6dc9a2449185ef45731cbcd0a78c266745ef src/openrouter/components/anthropicsearchresultblockparam.py: id: bccb7c6b3128 - last_write_checksum: sha1:aa8fcc04743f07cf8a72b3cbfaae212524101700 - pristine_git_object: 5925732967541b0d598ac249f372e5b18f975b0d + last_write_checksum: sha1:8d073fef507a39b53421384ff9a5914fd9438493 + pristine_git_object: 14967a292ebe05517a28c98b1e241bd2fd03a572 src/openrouter/components/anthropicspeed.py: id: 7e39c29f3d89 last_write_checksum: sha1:19e37bf7ec082d89258f44674405811cc8a010ad pristine_git_object: 4f9c2bc739541b12c381e3d6265184af879cc1ff src/openrouter/components/anthropictextblockparam.py: id: f387daeeb940 - last_write_checksum: sha1:266f0b2002e313484812c69d4b85a7d84aeb0c2b - pristine_git_object: a6a70aa6825c515fb5c9c1358d011314df010b2d + last_write_checksum: sha1:d07d4bef39b0f763604a58604da6aa4cb7979590 + pristine_git_object: 31a1df2ee27149c8862fb8709f4898ef0535360f src/openrouter/components/anthropicthinkingdisplay.py: id: 5d63f1a15f67 last_write_checksum: sha1:388d60bbe78d3b848744564f91b31142d7bfc7e3 @@ -7102,8 +7102,8 @@ trackedFiles: pristine_git_object: b937a2df121366183d40d9f124c9f1bf21b798db src/openrouter/components/chatcontentcachecontrol.py: id: fa34483583b7 - last_write_checksum: sha1:e34eec1c61fdbf41456cb25b3704f4f26c7590ac - pristine_git_object: e23d40503368f1c30d2bd3335b9196fea2094c51 + last_write_checksum: sha1:b8a998d3dc83c8edd1a35c25846f59d01ff2649c + pristine_git_object: d60c7b13de35893537d9c6867c1e51a888dcc72d src/openrouter/components/chatcontentfile.py: id: 2a747b8033b8 last_write_checksum: sha1:1203efad65c0e72e18fa600bd8ebbc72a82340fa @@ -7118,8 +7118,8 @@ trackedFiles: pristine_git_object: 61415b0c78602a7fabc4bf7f62ac869bacf38195 src/openrouter/components/chatcontenttext.py: id: 5301d8af31e7 - last_write_checksum: sha1:8c30921c5e1530becb0f646866787aa3d1deab13 - pristine_git_object: 86d0a046b85b9caba7f628344d55febb71936ca9 + last_write_checksum: sha1:f4abea5885878b3c6aaacac28829fae85a7c25ce + pristine_git_object: 45f9d3e9873702cbffb4cd7078fff4fffe2b81d2 src/openrouter/components/chatcontentvideo.py: id: 42859cb5a9f4 last_write_checksum: sha1:f60354c6602613f3f8628ca29330a6037fcf20e9 @@ -7162,8 +7162,8 @@ trackedFiles: pristine_git_object: 7a6140f2b8afb0cde9b031322a4284c9cbce7e33 src/openrouter/components/chatfunctiontool.py: id: 1fcf92f8a7da - last_write_checksum: sha1:a18e2ed4c62125b690f3baa254a8c1763f647726 - pristine_git_object: a225159f24b91219a9f3d7292feefabd81515cf6 + last_write_checksum: sha1:bd0f773ec2135cbfdffb56db092587410c7e5daf + pristine_git_object: 69f8f1c4be7afa41b812c012d3cf1b0906efcf1b src/openrouter/components/chatjsonschemaconfig.py: id: d2278e414fab last_write_checksum: sha1:73791c8aa5f3dec4a25903dcc9c61118fc88a4f3 @@ -7182,8 +7182,8 @@ trackedFiles: pristine_git_object: 8bbde153b53887e426989fd5b0486b6dc1122810 src/openrouter/components/chatrequest.py: id: 5e39eaefa9cf - last_write_checksum: sha1:e6f5dca8d7972b45dbb40d94867331ad0d1e09e7 - pristine_git_object: 914012755c34634740a1c91aa3f3f7b3da3f095e + last_write_checksum: sha1:2b4baaf4c3bf6d32c3514edfaab04ded9b71b001 + pristine_git_object: 4c79a21cfcf76239f27b251c35a5600839703c3a src/openrouter/components/chatresult.py: id: 9062fe2935fe last_write_checksum: sha1:2ff1963c54e7e79500115c8549c8d395f4e336d1 @@ -7610,8 +7610,8 @@ trackedFiles: pristine_git_object: 0015e263bbb2d817af89780610cc8f25ff852e73 src/openrouter/components/fusionservertoolconfig.py: id: 0d1d229c531f - last_write_checksum: sha1:df3f862acbedb4f4b3ed8b3e35f04fdf804b943f - pristine_git_object: e89fc6db28423e964f76e352ec20aa78763a8649 + last_write_checksum: sha1:ee754be65e6d2a35ed3f1f3985a0c3600116a6d0 + pristine_git_object: f7377d2de6c4e6129e8c7f9916200a06ae862afa src/openrouter/components/fusionsource.py: id: ce20a4a9f32f last_write_checksum: sha1:2141dd1dd9396035bf8070878c9ec945331514c8 @@ -7802,8 +7802,8 @@ trackedFiles: pristine_git_object: 39681f4c16af7831a14dcccf7447e742c8a2b43b src/openrouter/components/inputtext.py: id: a995ae96be99 - last_write_checksum: sha1:f78a6a35792b704f18ee6e1312c24f78f38cca36 - pristine_git_object: ab1dcb92e9370c9252ac5623a447669cca01e0ee + last_write_checksum: sha1:2da9ff645acc96772701908830151c5a707ed021 + pristine_git_object: 81a4151b3b1cdb6eb262a9ede28217b6c0afd1df src/openrouter/components/inputvideo.py: id: d262affd6f7e last_write_checksum: sha1:60c1792ab1f440ae67b5b451fd4d195e02783161 @@ -7922,16 +7922,16 @@ trackedFiles: pristine_git_object: 05b041967edf0ab2d8458f9f0fc3577f0a55fcfc src/openrouter/components/messagesmessageparam.py: id: ed8bbab6720d - last_write_checksum: sha1:4e5fb461702f78194596d7de570c7da25f05249e - pristine_git_object: 8a9738b371fb0ed0cd30d0bb7cc237fc7168eb92 + last_write_checksum: sha1:479cfffaf1013b89e92bb78ee7d5c5ad6646a1ca + pristine_git_object: e556cb06f6cf993616dd14191c43d6eca82edd7d src/openrouter/components/messagesoutputconfig.py: id: 54d1e297f740 last_write_checksum: sha1:01e41c73a07af6167f6934394f6e1f419f7ab878 pristine_git_object: 9b033dd8570e1d71ddb61a63a4b320d3003bd3ef src/openrouter/components/messagesrequest.py: id: 72b1f339024d - last_write_checksum: sha1:a14c123f9362720670a6cf4eb4bd55478d5fa376 - pristine_git_object: d2e30398f665dc6b5e8dac7f53bffab6e490d14b + last_write_checksum: sha1:31b9b9af3f04cb27796a56329b3ad8629c8ae33a + pristine_git_object: b4d8f657ed28a53d7cdd1dd963694631070d1e40 src/openrouter/components/messagessearchmodelsservertool.py: id: 53d755edb120 last_write_checksum: sha1:389786fc22ba4bb47b0a086b7aa321f2f04fe943 @@ -8362,8 +8362,8 @@ trackedFiles: pristine_git_object: a7c4599ac6ab794f54968f12cd6b15c3137a5159 src/openrouter/components/promptcachebreakpoint.py: id: f1e589a13300 - last_write_checksum: sha1:458ef5170c7c9ea1367dcfb090b1b28333aff73d - pristine_git_object: a082e2d9b4d27d0cffb7794279ab5fb9d9e06789 + last_write_checksum: sha1:ea0f5d81093058c261edd1937b4c7148989a203a + pristine_git_object: 13fbce26b5254ca66ebecfbbc8701d2002483399 src/openrouter/components/promptcacheoptions.py: id: 5c39fe555e03 last_write_checksum: sha1:77647b94fd80f6cfcae368bff4c87cbaf903a98e @@ -8538,8 +8538,8 @@ trackedFiles: pristine_git_object: f38c8edcb616d9e7cbd0f724fbb9d9f5aae014f9 src/openrouter/components/responsesrequest.py: id: 8c850080ec5d - last_write_checksum: sha1:f9f52d25db9ee9e72fbdf8491c47a3fc3a9971c7 - pristine_git_object: 6f97e56c468a1df21fc11fd4c3310fa648968c5f + last_write_checksum: sha1:52b22af092ebe8d61503b02aaaa806737ecd295f + pristine_git_object: 92873ed0edafcd63a858b859da883c1431f15e56 src/openrouter/components/responsesstreamingresponse.py: id: 142379f3bd90 last_write_checksum: sha1:a48d6f3610f5d15248ef4d25a0d88a0a4a1a9db7 @@ -9474,8 +9474,8 @@ trackedFiles: pristine_git_object: 31c74edd544c4ab7d4c5153a6d2888623ca66aed src/openrouter/presets.py: id: bd0c40379dcd - last_write_checksum: sha1:6de7b3adbfe270bf5b492b1da06230b9f6cc35d5 - pristine_git_object: 250c20d191dfd4a999ab461d6d5d1f066e1cfbeb + last_write_checksum: sha1:3b194964b25c57db796921e561898ae7073b6cbf + pristine_git_object: 832689477bac35ba16b604b330fdb3720e90a3a4 src/openrouter/providers.py: id: debc4c48f149 last_write_checksum: sha1:11dbc607825edee8dcc84b39ee8171e097c47acf @@ -9490,8 +9490,8 @@ trackedFiles: pristine_git_object: 76378ffba1806e0ca66fc873db1a568be0becebb src/openrouter/responses.py: id: f2108fb635e1 - last_write_checksum: sha1:b0e886f229ea3a440be77c9a037de5ffcf824100 - pristine_git_object: fbf686bae92410678880d1bbdb8da82c04b1869d + last_write_checksum: sha1:cea59e9d4f9ff5a5c61bc69ab696f6a82d77c137 + pristine_git_object: 74419ce01c4c30820bb1e6103d2542b59d062d7a src/openrouter/sdk.py: id: ee9846c4c9c5 last_write_checksum: sha1:2247537eca7f88a8f36e53fe011904b98569ad52 @@ -11149,4 +11149,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.guardrails.list()`: `response.data[].enforce_zdr_xai` **Added**\n* `open_router.guardrails.create()`: \n * `request.enforce_zdr_xai` **Added**\n * `response.data.enforce_zdr_xai` **Added**\n* `open_router.guardrails.get()`: `response.data.enforce_zdr_xai` **Added**\n* `open_router.guardrails.update()`: \n * `request.enforce_zdr_xai` **Added**\n * `response.data.enforce_zdr_xai` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.chat.send()`: \n * `request` **Changed**\n * `response.choices[].message.content.union(Array)[].union(text).prompt_cache_breakpoint` **Added**\n* `open_router.presets.create_presets_chat_completions()`: `request` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 2c82d293..c453c679 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 0.11.31 + version: 0.11.32 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index e7874432..0926697e 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -671,7 +671,7 @@ components: type: object AnthropicCacheControlDirective: description: >- - Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. example: type: ephemeral properties: @@ -4458,7 +4458,8 @@ components: - $ref: '#/components/schemas/AnthropicCacheControlDirective' - properties: {} type: object - description: Cache control for the content part + description: >- + Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. example: ttl: 5m type: ephemeral @@ -4553,6 +4554,8 @@ components: properties: cache_control: $ref: '#/components/schemas/ChatContentCacheControl' + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpoint' text: type: string type: @@ -5047,6 +5050,11 @@ components: format: double nullable: true type: number + prompt_cache_key: + nullable: true + type: string + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptions' provider: $ref: '#/components/schemas/ProviderPreferences' reasoning: @@ -18337,7 +18345,7 @@ components: type: object PromptCacheBreakpoint: description: >- - Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. + Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. example: mode: explicit nullable: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3caf57a3..efe462f6 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:e41d9374b62c6364b29b039f24a6fa33b6e1aecd74f3d592b4e5dc0e8915f539 - sourceBlobDigest: sha256:3395078b604c8be9e707ef5d4bfc1861adb8b27ec5b3e960694744eb75dce17c + sourceRevisionDigest: sha256:7ba0690911aa50c921dd9903da84f01fc6f17c079b207e23cdf58ea361564199 + sourceBlobDigest: sha256:d60cb272a488a05daf5bfe8efc1b69083f75852bff82d8deea1714b429b4d4fc tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:e41d9374b62c6364b29b039f24a6fa33b6e1aecd74f3d592b4e5dc0e8915f539 - sourceBlobDigest: sha256:3395078b604c8be9e707ef5d4bfc1861adb8b27ec5b3e960694744eb75dce17c + sourceRevisionDigest: sha256:7ba0690911aa50c921dd9903da84f01fc6f17c079b207e23cdf58ea361564199 + sourceBlobDigest: sha256:d60cb272a488a05daf5bfe8efc1b69083f75852bff82d8deea1714b429b4d4fc codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:4cb898e1201b335e38601e54fb5999ae9b324e5a45e518a0b443bd823affee26 + codeSamplesRevisionDigest: sha256:f52550d8391f3b538a0b03a1f483c981fcb926e95bec37ffa581344cfaf0d1e8 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 8ccf8783..d17bed87 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -418,4 +418,14 @@ Based on: ### Generated - [python v0.11.31] . ### Releases -- [PyPI v0.11.31] https://pypi.org/project/openrouter/0.11.31 - . \ No newline at end of file +- [PyPI v0.11.31] https://pypi.org/project/openrouter/0.11.31 - . + +## 2026-07-14 21:26:36 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.11.32] . +### Releases +- [PyPI v0.11.32] https://pypi.org/project/openrouter/0.11.32 - . \ No newline at end of file diff --git a/docs/components/anthropiccachecontroldirective.mdx b/docs/components/anthropiccachecontroldirective.mdx index 5f755985..12b753fe 100644 --- a/docs/components/anthropiccachecontroldirective.mdx +++ b/docs/components/anthropiccachecontroldirective.mdx @@ -2,7 +2,7 @@ title: "AnthropicCacheControlDirective" --- -Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. +Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. ## Fields diff --git a/docs/components/anthropicdocumentblockparam.mdx b/docs/components/anthropicdocumentblockparam.mdx index 5a242514..1ed7b7cd 100644 --- a/docs/components/anthropicdocumentblockparam.mdx +++ b/docs/components/anthropicdocumentblockparam.mdx @@ -4,11 +4,11 @@ title: "AnthropicDocumentBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `citations` | [OptionalNullable[components.AnthropicDocumentBlockParamCitations]](../components/anthropicdocumentblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | -| `context` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `source` | [components.AnthropicDocumentBlockParamSourceUnion](../components/anthropicdocumentblockparamsourceunion.mdx) | :heavy_check_mark: | N/A | | -| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `type` | [components.TypeDocument](../components/typedocument.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `citations` | [OptionalNullable[components.AnthropicDocumentBlockParamCitations]](../components/anthropicdocumentblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | +| `context` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `source` | [components.AnthropicDocumentBlockParamSourceUnion](../components/anthropicdocumentblockparamsourceunion.mdx) | :heavy_check_mark: | N/A | | +| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `type` | [components.TypeDocument](../components/typedocument.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/anthropicimageblockparam.mdx b/docs/components/anthropicimageblockparam.mdx index 2d95dd47..9be25eff 100644 --- a/docs/components/anthropicimageblockparam.mdx +++ b/docs/components/anthropicimageblockparam.mdx @@ -4,8 +4,8 @@ title: "AnthropicImageBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `source` | [components.AnthropicImageBlockParamSource](../components/anthropicimageblockparamsource.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.AnthropicImageBlockParamType](../components/anthropicimageblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `source` | [components.AnthropicImageBlockParamSource](../components/anthropicimageblockparamsource.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.AnthropicImageBlockParamType](../components/anthropicimageblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/anthropicsearchresultblockparam.mdx b/docs/components/anthropicsearchresultblockparam.mdx index 517785e7..89ae1afd 100644 --- a/docs/components/anthropicsearchresultblockparam.mdx +++ b/docs/components/anthropicsearchresultblockparam.mdx @@ -4,11 +4,11 @@ title: "AnthropicSearchResultBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `citations` | [Optional[components.AnthropicSearchResultBlockParamCitations]](../components/anthropicsearchresultblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | -| `content` | List[[components.AnthropicTextBlockParam](../components/anthropictextblockparam.mdx)] | :heavy_check_mark: | N/A | | -| `source` | *str* | :heavy_check_mark: | N/A | | -| `title` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.AnthropicSearchResultBlockParamType](../components/anthropicsearchresultblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `citations` | [Optional[components.AnthropicSearchResultBlockParamCitations]](../components/anthropicsearchresultblockparamcitations.mdx) | :heavy_minus_sign: | N/A | | +| `content` | List[[components.AnthropicTextBlockParam](../components/anthropictextblockparam.mdx)] | :heavy_check_mark: | N/A | | +| `source` | *str* | :heavy_check_mark: | N/A | | +| `title` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.AnthropicSearchResultBlockParamType](../components/anthropicsearchresultblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/anthropictextblockparam.mdx b/docs/components/anthropictextblockparam.mdx index 6d00495d..502d15e6 100644 --- a/docs/components/anthropictextblockparam.mdx +++ b/docs/components/anthropictextblockparam.mdx @@ -4,9 +4,9 @@ title: "AnthropicTextBlockParam" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `citations` | List[[components.Citation](../components/citation.mdx)] | :heavy_minus_sign: | N/A | | -| `text` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.AnthropicTextBlockParamType](../components/anthropictextblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `citations` | List[[components.Citation](../components/citation.mdx)] | :heavy_minus_sign: | N/A | | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.AnthropicTextBlockParamType](../components/anthropictextblockparamtype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/caching.mdx b/docs/components/caching.mdx index d9c71991..0d7013f5 100644 --- a/docs/components/caching.mdx +++ b/docs/components/caching.mdx @@ -2,7 +2,7 @@ title: "Caching" --- -Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. +Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. ## Fields diff --git a/docs/components/chatcontentcachecontrol.mdx b/docs/components/chatcontentcachecontrol.mdx index 250fd47f..6f1d2f8e 100644 --- a/docs/components/chatcontentcachecontrol.mdx +++ b/docs/components/chatcontentcachecontrol.mdx @@ -2,7 +2,7 @@ title: "ChatContentCacheControl" --- -Cache control for the content part +Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. ## Fields diff --git a/docs/components/chatcontenttext.mdx b/docs/components/chatcontenttext.mdx index a59dafe9..b31006bd 100644 --- a/docs/components/chatcontenttext.mdx +++ b/docs/components/chatcontenttext.mdx @@ -7,8 +7,9 @@ Text content part ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Cache control for the content part | \{
"ttl": "5m",
"type": "ephemeral"
} | -| `text` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.ChatContentTextType](../components/chatcontenttexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. | \{
"ttl": "5m",
"type": "ephemeral"
} | +| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. | \{
"mode": "explicit"
} | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.ChatContentTextType](../components/chatcontenttexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/chatfunctiontoolfunction.mdx b/docs/components/chatfunctiontoolfunction.mdx index 7619eec4..a6cf73c1 100644 --- a/docs/components/chatfunctiontoolfunction.mdx +++ b/docs/components/chatfunctiontoolfunction.mdx @@ -6,6 +6,6 @@ title: "ChatFunctionToolFunction" | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Cache control for the content part | \{
"ttl": "5m",
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. | \{
"ttl": "5m",
"type": "ephemeral"
} | | `function` | [components.ChatFunctionToolFunctionFunction](../components/chatfunctiontoolfunctionfunction.mdx) | :heavy_check_mark: | Function definition for tool calling | \{
"description": "Get the current weather for a location",
"name": "get_weather",
"parameters": \{
"properties": \{
"location": \{
"description": "City name",
"type": "string"
}
},
"required": [
"location"
],
"type": "object"
}
} | | `type` | [components.ChatFunctionToolType](../components/chatfunctiontooltype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/chatrequest.mdx b/docs/components/chatrequest.mdx index 1cc4f0f4..e831058c 100644 --- a/docs/components/chatrequest.mdx +++ b/docs/components/chatrequest.mdx @@ -9,7 +9,7 @@ Chat completion request parameters | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | @@ -26,6 +26,8 @@ Chat completion request parameters | `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. | true | | `plugins` | List[[components.ChatRequestPlugin](../components/chatrequestplugin.mdx)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../components/chatrequestreasoning.mdx) | :heavy_minus_sign: | Configuration options for reasoning models | \{
"effort": "medium",
"summary": "concise"
} | | `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../components/chatrequestreasoningeffort.mdx) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | diff --git a/docs/components/contentcompaction.mdx b/docs/components/contentcompaction.mdx index 39acf3a7..87f9c8d7 100644 --- a/docs/components/contentcompaction.mdx +++ b/docs/components/contentcompaction.mdx @@ -4,8 +4,8 @@ title: "ContentCompaction" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `content` | *Nullable[str]* | :heavy_check_mark: | N/A | | -| `type` | [components.MessagesMessageParamTypeCompaction](../components/messagesmessageparamtypecompaction.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `content` | *Nullable[str]* | :heavy_check_mark: | N/A | | +| `type` | [components.MessagesMessageParamTypeCompaction](../components/messagesmessageparamtypecompaction.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contentservertooluse.mdx b/docs/components/contentservertooluse.mdx index 527a1c1a..86c112ed 100644 --- a/docs/components/contentservertooluse.mdx +++ b/docs/components/contentservertooluse.mdx @@ -4,10 +4,10 @@ title: "ContentServerToolUse" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `id` | *str* | :heavy_check_mark: | N/A | | -| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | -| `name` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeServerToolUse](../components/typeservertooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `id` | *str* | :heavy_check_mark: | N/A | | +| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | +| `name` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeServerToolUse](../components/typeservertooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contenttoolresult.mdx b/docs/components/contenttoolresult.mdx index 4abde669..f83588a9 100644 --- a/docs/components/contenttoolresult.mdx +++ b/docs/components/contenttoolresult.mdx @@ -4,10 +4,10 @@ title: "ContentToolResult" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `content` | [Optional[components.MessagesMessageParamContentUnion2]](../components/messagesmessageparamcontentunion2.mdx) | :heavy_minus_sign: | N/A | | -| `is_error` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeToolResult](../components/typetoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `content` | [Optional[components.MessagesMessageParamContentUnion2]](../components/messagesmessageparamcontentunion2.mdx) | :heavy_minus_sign: | N/A | | +| `is_error` | *Optional[bool]* | :heavy_minus_sign: | N/A | | +| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeToolResult](../components/typetoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contenttooluse.mdx b/docs/components/contenttooluse.mdx index e29dae10..7149ea56 100644 --- a/docs/components/contenttooluse.mdx +++ b/docs/components/contenttooluse.mdx @@ -4,10 +4,10 @@ title: "ContentToolUse" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `id` | *str* | :heavy_check_mark: | N/A | | -| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | -| `name` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeToolUse](../components/typetooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `id` | *str* | :heavy_check_mark: | N/A | | +| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | +| `name` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeToolUse](../components/typetooluse.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/contentwebsearchtoolresult.mdx b/docs/components/contentwebsearchtoolresult.mdx index a2664d14..9a9180dc 100644 --- a/docs/components/contentwebsearchtoolresult.mdx +++ b/docs/components/contentwebsearchtoolresult.mdx @@ -4,9 +4,9 @@ title: "ContentWebSearchToolResult" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `content` | [components.MessagesMessageParamContentUnion3](../components/messagesmessageparamcontentunion3.mdx) | :heavy_check_mark: | N/A | | -| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.TypeWebSearchToolResult](../components/typewebsearchtoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `content` | [components.MessagesMessageParamContentUnion3](../components/messagesmessageparamcontentunion3.mdx) | :heavy_check_mark: | N/A | | +| `tool_use_id` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.TypeWebSearchToolResult](../components/typewebsearchtoolresult.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/fusionservertoolconfig.mdx b/docs/components/fusionservertoolconfig.mdx index ec3ad691..1247ee77 100644 --- a/docs/components/fusionservertoolconfig.mdx +++ b/docs/components/fusionservertoolconfig.mdx @@ -7,13 +7,13 @@ Configuration for the openrouter:fusion server tool. ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `analysis_models` | List[*str*] | :heavy_minus_sign: | Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion. | [
"~anthropic/claude-opus-latest",
"~openai/gpt-latest",
"~google/gemini-pro-latest"
] | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000. | 16384 | -| `max_tool_calls` | *Optional[int]* | :heavy_minus_sign: | Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16. | 12 | -| `model` | *Optional[str]* | :heavy_minus_sign: | Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request. | ~anthropic/claude-opus-latest | -| `reasoning` | [Optional[components.FusionServerToolConfigReasoning]](../components/fusionservertoolconfigreasoning.mdx) | :heavy_minus_sign: | Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking. | | -| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies. | 0.7 | -| `tools` | List[[components.FusionServerToolConfigTool](../components/fusionservertoolconfigtool.mdx)] | :heavy_minus_sign: | Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only). | [
\{
"parameters": \{
"excluded_domains": [
"example.com"
]
},
"type": "openrouter:web_search"
},
\{
"type": "openrouter:web_fetch"
}
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `analysis_models` | List[*str*] | :heavy_minus_sign: | Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion. | [
"~anthropic/claude-opus-latest",
"~openai/gpt-latest",
"~google/gemini-pro-latest"
] | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000. | 16384 | +| `max_tool_calls` | *Optional[int]* | :heavy_minus_sign: | Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16. | 12 | +| `model` | *Optional[str]* | :heavy_minus_sign: | Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request. | ~anthropic/claude-opus-latest | +| `reasoning` | [Optional[components.FusionServerToolConfigReasoning]](../components/fusionservertoolconfigreasoning.mdx) | :heavy_minus_sign: | Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking. | | +| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies. | 0.7 | +| `tools` | List[[components.FusionServerToolConfigTool](../components/fusionservertoolconfigtool.mdx)] | :heavy_minus_sign: | Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only). | [
\{
"parameters": \{
"excluded_domains": [
"example.com"
]
},
"type": "openrouter:web_search"
},
\{
"type": "openrouter:web_fetch"
}
] | \ No newline at end of file diff --git a/docs/components/inputtext.mdx b/docs/components/inputtext.mdx index ece32d6e..59084130 100644 --- a/docs/components/inputtext.mdx +++ b/docs/components/inputtext.mdx @@ -7,8 +7,8 @@ Text input content item ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit"
} | -| `text` | *str* | :heavy_check_mark: | N/A | | -| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. | \{
"mode": "explicit"
} | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/messagesrequest.mdx b/docs/components/messagesrequest.mdx index 2b25d420..89b9780c 100644 --- a/docs/components/messagesrequest.mdx +++ b/docs/components/messagesrequest.mdx @@ -9,7 +9,7 @@ Request schema for Anthropic Messages API endpoint | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `context_management` | [OptionalNullable[components.ContextManagement]](../components/contextmanagement.mdx) | :heavy_minus_sign: | N/A | | | `fallbacks` | List[[components.MessagesFallbackParam](../components/messagesfallbackparam.mdx)] | :heavy_minus_sign: | Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. | [
\{
"model": "claude-opus-4-8"
}
] | | `max_tokens` | *Optional[int]* | :heavy_minus_sign: | N/A | | diff --git a/docs/components/promptcachebreakpoint.mdx b/docs/components/promptcachebreakpoint.mdx index 1d1ff616..313ab84d 100644 --- a/docs/components/promptcachebreakpoint.mdx +++ b/docs/components/promptcachebreakpoint.mdx @@ -2,7 +2,7 @@ title: "PromptCacheBreakpoint" --- -Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer. +Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. ## Fields diff --git a/docs/components/responsesrequest.mdx b/docs/components/responsesrequest.mdx index 371d94f3..3090f61c 100644 --- a/docs/components/responsesrequest.mdx +++ b/docs/components/responsesrequest.mdx @@ -10,7 +10,7 @@ Request schema for Responses endpoint | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | diff --git a/docs/components/tooladvisor20260301.mdx b/docs/components/tooladvisor20260301.mdx index ee1f63bc..a00186b5 100644 --- a/docs/components/tooladvisor20260301.mdx +++ b/docs/components/tooladvisor20260301.mdx @@ -4,13 +4,13 @@ title: "ToolAdvisor20260301" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `caching` | [OptionalNullable[components.Caching]](../components/caching.mdx) | :heavy_minus_sign: | N/A | \{
"type": "ephemeral"
} | -| `defer_loading` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `max_uses` | *Optional[int]* | :heavy_minus_sign: | N/A | | -| `model` | *str* | :heavy_check_mark: | N/A | | -| `name` | [components.NameAdvisor](../components/nameadvisor.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeAdvisor20260301](../components/typeadvisor20260301.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `caching` | [OptionalNullable[components.Caching]](../components/caching.mdx) | :heavy_minus_sign: | N/A | \{
"type": "ephemeral"
} | +| `defer_loading` | *Optional[bool]* | :heavy_minus_sign: | N/A | | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | N/A | | +| `model` | *str* | :heavy_check_mark: | N/A | | +| `name` | [components.NameAdvisor](../components/nameadvisor.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeAdvisor20260301](../components/typeadvisor20260301.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/toolbash20250124.mdx b/docs/components/toolbash20250124.mdx index d9f17ef2..d3a3ea6c 100644 --- a/docs/components/toolbash20250124.mdx +++ b/docs/components/toolbash20250124.mdx @@ -4,8 +4,8 @@ title: "ToolBash20250124" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `name` | [components.NameBash](../components/namebash.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeBash20250124](../components/typebash20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `name` | [components.NameBash](../components/namebash.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeBash20250124](../components/typebash20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/toolcustom.mdx b/docs/components/toolcustom.mdx index 57073f64..ce9be3cd 100644 --- a/docs/components/toolcustom.mdx +++ b/docs/components/toolcustom.mdx @@ -4,10 +4,10 @@ title: "ToolCustom" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | | -| `input_schema` | [components.InputSchema](../components/inputschema.mdx) | :heavy_check_mark: | N/A | | -| `name` | *str* | :heavy_check_mark: | N/A | | -| `type` | [Optional[components.ToolTypeCustom]](../components/tooltypecustom.mdx) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `input_schema` | [components.InputSchema](../components/inputschema.mdx) | :heavy_check_mark: | N/A | | +| `name` | *str* | :heavy_check_mark: | N/A | | +| `type` | [Optional[components.ToolTypeCustom]](../components/tooltypecustom.mdx) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/tooltexteditor20250124.mdx b/docs/components/tooltexteditor20250124.mdx index 0fe06a93..a7f1a273 100644 --- a/docs/components/tooltexteditor20250124.mdx +++ b/docs/components/tooltexteditor20250124.mdx @@ -4,8 +4,8 @@ title: "ToolTextEditor20250124" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `name` | [components.NameStrReplaceEditor](../components/namestrreplaceeditor.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeTextEditor20250124](../components/typetexteditor20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `name` | [components.NameStrReplaceEditor](../components/namestrreplaceeditor.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeTextEditor20250124](../components/typetexteditor20250124.mdx) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/components/toolwebsearch20250305.mdx b/docs/components/toolwebsearch20250305.mdx index 33510135..36a09641 100644 --- a/docs/components/toolwebsearch20250305.mdx +++ b/docs/components/toolwebsearch20250305.mdx @@ -4,12 +4,12 @@ title: "ToolWebSearch20250305" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `name` | [components.NameWebSearch1](../components/namewebsearch1.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeWebSearch20250305](../components/typewebsearch20250305.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | +| `name` | [components.NameWebSearch1](../components/namewebsearch1.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeWebSearch20250305](../components/typewebsearch20250305.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/components/toolwebsearch20260209.mdx b/docs/components/toolwebsearch20260209.mdx index a70393e5..062b3155 100644 --- a/docs/components/toolwebsearch20260209.mdx +++ b/docs/components/toolwebsearch20260209.mdx @@ -4,13 +4,13 @@ title: "ToolWebSearch20260209" ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | -| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | -| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `name` | [components.NameWebSearch2](../components/namewebsearch2.mdx) | :heavy_check_mark: | N/A | | -| `type` | [components.TypeWebSearch20260209](../components/typewebsearch20260209.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allowed_callers` | List[[components.AnthropicAllowedCallers](../components/anthropicallowedcallers.mdx)] | :heavy_minus_sign: | N/A | [
"direct"
] | +| `allowed_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `blocked_domains` | List[*str*] | :heavy_minus_sign: | N/A | | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | +| `max_uses` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | +| `name` | [components.NameWebSearch2](../components/namewebsearch2.mdx) | :heavy_check_mark: | N/A | | +| `type` | [components.TypeWebSearch20260209](../components/typewebsearch20260209.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.AnthropicWebSearchToolUserLocation]](../components/anthropicwebsearchtooluserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/sdks/chat/README.mdx b/docs/sdks/chat/README.mdx index 390ca7cf..70aca7d4 100644 --- a/docs/sdks/chat/README.mdx +++ b/docs/sdks/chat/README.mdx @@ -84,7 +84,7 @@ with OpenRouter( | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `x_open_router_metadata` | [Optional[components.MetadataLevel]](../../components/metadatalevel.mdx) | :heavy_minus_sign: | Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. | enabled | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | @@ -100,6 +100,8 @@ with OpenRouter( | `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. | true | | `plugins` | List[[components.ChatRequestPlugin](../../components/chatrequestplugin.mdx)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.mdx) | :heavy_minus_sign: | Configuration options for reasoning models | \{
"effort": "medium",
"summary": "concise"
} | | `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../../components/chatrequestreasoningeffort.mdx) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | diff --git a/docs/sdks/presets/README.mdx b/docs/sdks/presets/README.mdx index ef18762b..82e78fb1 100644 --- a/docs/sdks/presets/README.mdx +++ b/docs/sdks/presets/README.mdx @@ -160,7 +160,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | @@ -176,6 +176,8 @@ with OpenRouter( | `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. | true | | `plugins` | List[[components.ChatRequestPlugin](../../components/chatrequestplugin.mdx)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{
"mode": "explicit",
"ttl": "30m"
} | | `provider` | [OptionalNullable[components.ProviderPreferences]](../../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{
"allow_fallbacks": true
} | | `reasoning` | [Optional[components.ChatRequestReasoning]](../../components/chatrequestreasoning.mdx) | :heavy_minus_sign: | Configuration options for reasoning models | \{
"effort": "medium",
"summary": "concise"
} | | `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../../components/chatrequestreasoningeffort.mdx) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium | @@ -255,7 +257,7 @@ with OpenRouter( | `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `context_management` | [OptionalNullable[components.ContextManagement]](../../components/contextmanagement.mdx) | :heavy_minus_sign: | N/A | | | `fallbacks` | List[[components.MessagesFallbackParam](../../components/messagesfallbackparam.mdx)] | :heavy_minus_sign: | Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. | [
\{
"model": "claude-opus-4-8"
}
] | | `max_tokens` | *Optional[int]* | :heavy_minus_sign: | N/A | | @@ -331,7 +333,7 @@ with OpenRouter( | `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | diff --git a/docs/sdks/responses/README.mdx b/docs/sdks/responses/README.mdx index bbd29525..708c8a13 100644 --- a/docs/sdks/responses/README.mdx +++ b/docs/sdks/responses/README.mdx @@ -69,7 +69,7 @@ with OpenRouter( | `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `x_open_router_metadata` | [Optional[components.MetadataLevel]](../../components/metadatalevel.mdx) | :heavy_minus_sign: | Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. | enabled | | `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | -| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{
"type": "ephemeral"
} | +| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{
"type": "ephemeral"
} | | `debug` | [Optional[components.ChatDebugOptions]](../../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{
"echo_upstream_body": true
} | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | | `image_config` | Dict[str, [components.ImageConfig](../../components/imageconfig.mdx)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | \{
"aspect_ratio": "16:9",
"quality": "high"
} | diff --git a/pyproject.toml b/pyproject.toml index cc31c292..f72d3afa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.11.31" +version = "0.11.32" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index e7272145..44f59a47 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.11.31" +__version__: str = "0.11.32" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 0.11.31 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.11.32 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index ab93b1be..f14c3b51 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -65,6 +65,10 @@ def send( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -135,7 +139,7 @@ def send( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -151,6 +155,8 @@ def send( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -223,6 +229,10 @@ def send( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -293,7 +303,7 @@ def send( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -309,6 +319,8 @@ def send( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -381,6 +393,10 @@ def send( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -453,7 +469,7 @@ def send( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -469,6 +485,8 @@ def send( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -540,6 +558,10 @@ def send( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -612,7 +634,7 @@ def send( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -628,6 +650,8 @@ def send( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -701,6 +725,11 @@ def send( plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -977,6 +1006,10 @@ async def send_async( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1047,7 +1080,7 @@ async def send_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1063,6 +1096,8 @@ async def send_async( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1135,6 +1170,10 @@ async def send_async( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1205,7 +1244,7 @@ async def send_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1221,6 +1260,8 @@ async def send_async( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1293,6 +1334,10 @@ async def send_async( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1366,7 +1411,7 @@ async def send_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1382,6 +1427,8 @@ async def send_async( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1453,6 +1500,10 @@ async def send_async( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1526,7 +1577,7 @@ async def send_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param x_open_router_metadata: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1542,6 +1593,8 @@ async def send_async( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1615,6 +1668,11 @@ async def send_async( plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), diff --git a/src/openrouter/components/anthropiccachecontroldirective.py b/src/openrouter/components/anthropiccachecontroldirective.py index a9292b2d..05b36d10 100644 --- a/src/openrouter/components/anthropiccachecontroldirective.py +++ b/src/openrouter/components/anthropiccachecontroldirective.py @@ -12,14 +12,14 @@ class AnthropicCacheControlDirectiveTypedDict(TypedDict): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: AnthropicCacheControlDirectiveType ttl: NotRequired[AnthropicCacheControlTTL] class AnthropicCacheControlDirective(BaseModel): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: AnthropicCacheControlDirectiveType diff --git a/src/openrouter/components/anthropicdocumentblockparam.py b/src/openrouter/components/anthropicdocumentblockparam.py index 686764bb..be2d48fe 100644 --- a/src/openrouter/components/anthropicdocumentblockparam.py +++ b/src/openrouter/components/anthropicdocumentblockparam.py @@ -135,7 +135,7 @@ class AnthropicDocumentBlockParamTypedDict(TypedDict): source: AnthropicDocumentBlockParamSourceUnionTypedDict type: TypeDocument cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: NotRequired[Nullable[AnthropicDocumentBlockParamCitationsTypedDict]] context: NotRequired[Nullable[str]] title: NotRequired[Nullable[str]] @@ -147,7 +147,7 @@ class AnthropicDocumentBlockParam(BaseModel): type: TypeDocument cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: OptionalNullable[AnthropicDocumentBlockParamCitations] = UNSET diff --git a/src/openrouter/components/anthropicimageblockparam.py b/src/openrouter/components/anthropicimageblockparam.py index 979d0464..7b5effbb 100644 --- a/src/openrouter/components/anthropicimageblockparam.py +++ b/src/openrouter/components/anthropicimageblockparam.py @@ -42,7 +42,7 @@ class AnthropicImageBlockParamTypedDict(TypedDict): source: AnthropicImageBlockParamSourceTypedDict type: AnthropicImageBlockParamType cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class AnthropicImageBlockParam(BaseModel): @@ -51,7 +51,7 @@ class AnthropicImageBlockParam(BaseModel): type: AnthropicImageBlockParamType cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/anthropicsearchresultblockparam.py b/src/openrouter/components/anthropicsearchresultblockparam.py index 59257329..14967a29 100644 --- a/src/openrouter/components/anthropicsearchresultblockparam.py +++ b/src/openrouter/components/anthropicsearchresultblockparam.py @@ -48,7 +48,7 @@ class AnthropicSearchResultBlockParamTypedDict(TypedDict): title: str type: AnthropicSearchResultBlockParamType cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: NotRequired[AnthropicSearchResultBlockParamCitationsTypedDict] @@ -62,7 +62,7 @@ class AnthropicSearchResultBlockParam(BaseModel): type: AnthropicSearchResultBlockParamType cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: Optional[AnthropicSearchResultBlockParamCitations] = None diff --git a/src/openrouter/components/anthropictextblockparam.py b/src/openrouter/components/anthropictextblockparam.py index a6a70aa6..31a1df2e 100644 --- a/src/openrouter/components/anthropictextblockparam.py +++ b/src/openrouter/components/anthropictextblockparam.py @@ -76,7 +76,7 @@ class AnthropicTextBlockParamTypedDict(TypedDict): text: str type: AnthropicTextBlockParamType cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: NotRequired[Nullable[List[CitationTypedDict]]] @@ -86,7 +86,7 @@ class AnthropicTextBlockParam(BaseModel): type: AnthropicTextBlockParamType cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" citations: OptionalNullable[List[Citation]] = UNSET diff --git a/src/openrouter/components/chatcontentcachecontrol.py b/src/openrouter/components/chatcontentcachecontrol.py index e23d4050..d60c7b13 100644 --- a/src/openrouter/components/chatcontentcachecontrol.py +++ b/src/openrouter/components/chatcontentcachecontrol.py @@ -12,14 +12,14 @@ class ChatContentCacheControlTypedDict(TypedDict): - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" type: ChatContentCacheControlType ttl: NotRequired[AnthropicCacheControlTTL] class ChatContentCacheControl(BaseModel): - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" type: ChatContentCacheControlType diff --git a/src/openrouter/components/chatcontenttext.py b/src/openrouter/components/chatcontenttext.py index 86d0a046..45f9d3e9 100644 --- a/src/openrouter/components/chatcontenttext.py +++ b/src/openrouter/components/chatcontenttext.py @@ -5,7 +5,14 @@ ChatContentCacheControl, ChatContentCacheControlTypedDict, ) -from openrouter.types import BaseModel, UNSET_SENTINEL +from .promptcachebreakpoint import PromptCacheBreakpoint, PromptCacheBreakpointTypedDict +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from pydantic import model_serializer from typing import Literal, Optional from typing_extensions import NotRequired, TypedDict @@ -20,7 +27,9 @@ class ChatContentTextTypedDict(TypedDict): text: str type: ChatContentTextType cache_control: NotRequired[ChatContentCacheControlTypedDict] - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" + prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]] + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" class ChatContentText(BaseModel): @@ -31,20 +40,32 @@ class ChatContentText(BaseModel): type: ChatContentTextType cache_control: Optional[ChatContentCacheControl] = None - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" + + prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["cache_control"]) + optional_fields = set(["cache_control", "prompt_cache_breakpoint"]) + nullable_fields = set(["prompt_cache_breakpoint"]) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): m[k] = val return m diff --git a/src/openrouter/components/chatfunctiontool.py b/src/openrouter/components/chatfunctiontool.py index a225159f..69f8f1c4 100644 --- a/src/openrouter/components/chatfunctiontool.py +++ b/src/openrouter/components/chatfunctiontool.py @@ -111,7 +111,7 @@ class ChatFunctionToolFunctionTypedDict(TypedDict): r"""Function definition for tool calling""" type: ChatFunctionToolType cache_control: NotRequired[ChatContentCacheControlTypedDict] - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" class ChatFunctionToolFunction(BaseModel): @@ -121,7 +121,7 @@ class ChatFunctionToolFunction(BaseModel): type: ChatFunctionToolType cache_control: Optional[ChatContentCacheControl] = None - r"""Cache control for the content part""" + r"""Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatrequest.py b/src/openrouter/components/chatrequest.py index 91401275..4c79a21c 100644 --- a/src/openrouter/components/chatrequest.py +++ b/src/openrouter/components/chatrequest.py @@ -38,6 +38,7 @@ from .imageconfig import ImageConfig, ImageConfigTypedDict from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict from .paretorouterplugin import ParetoRouterPlugin, ParetoRouterPluginTypedDict +from .promptcacheoptions import PromptCacheOptions, PromptCacheOptionsTypedDict from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDict from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict from .stopservertoolswhencondition import ( @@ -228,7 +229,7 @@ class ChatRequestTypedDict(TypedDict): messages: List[ChatMessagesTypedDict] r"""List of messages for the conversation""" cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: NotRequired[ChatDebugOptionsTypedDict] r"""Debug options for inspecting request transformations (streaming only)""" frequency_penalty: NotRequired[Nullable[float]] @@ -259,6 +260,9 @@ class ChatRequestTypedDict(TypedDict): r"""Plugins you want to enable for this request, including their settings.""" presence_penalty: NotRequired[Nullable[float]] r"""Presence penalty (-2.0 to 2.0)""" + prompt_cache_key: NotRequired[Nullable[str]] + prompt_cache_options: NotRequired[Nullable[PromptCacheOptionsTypedDict]] + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" provider: NotRequired[Nullable[ProviderPreferencesTypedDict]] r"""When multiple model providers are available, optionally indicate your routing preference.""" reasoning: NotRequired[ChatRequestReasoningTypedDict] @@ -310,7 +314,7 @@ class ChatRequest(BaseModel): r"""List of messages for the conversation""" cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: Optional[ChatDebugOptions] = None r"""Debug options for inspecting request transformations (streaming only)""" @@ -357,6 +361,11 @@ class ChatRequest(BaseModel): presence_penalty: OptionalNullable[float] = UNSET r"""Presence penalty (-2.0 to 2.0)""" + prompt_cache_key: OptionalNullable[str] = UNSET + + prompt_cache_options: OptionalNullable[PromptCacheOptions] = UNSET + r"""Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.""" + provider: OptionalNullable[ProviderPreferences] = UNSET r"""When multiple model providers are available, optionally indicate your routing preference.""" @@ -440,6 +449,8 @@ def serialize_model(self, handler): "parallel_tool_calls", "plugins", "presence_penalty", + "prompt_cache_key", + "prompt_cache_options", "provider", "reasoning", "reasoning_effort", @@ -473,6 +484,8 @@ def serialize_model(self, handler): "min_p", "parallel_tool_calls", "presence_penalty", + "prompt_cache_key", + "prompt_cache_options", "provider", "reasoning_effort", "repetition_penalty", diff --git a/src/openrouter/components/fusionservertoolconfig.py b/src/openrouter/components/fusionservertoolconfig.py index e89fc6db..f7377d2d 100644 --- a/src/openrouter/components/fusionservertoolconfig.py +++ b/src/openrouter/components/fusionservertoolconfig.py @@ -98,7 +98,7 @@ class FusionServerToolConfigTypedDict(TypedDict): analysis_models: NotRequired[List[str]] r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion.""" cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_completion_tokens: NotRequired[int] r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000.""" max_tool_calls: NotRequired[int] @@ -120,7 +120,7 @@ class FusionServerToolConfig(BaseModel): r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion.""" cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_completion_tokens: Optional[int] = None r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000.""" diff --git a/src/openrouter/components/inputtext.py b/src/openrouter/components/inputtext.py index ab1dcb92..81a4151b 100644 --- a/src/openrouter/components/inputtext.py +++ b/src/openrouter/components/inputtext.py @@ -23,7 +23,7 @@ class InputTextTypedDict(TypedDict): text: str type: InputTextType prompt_cache_breakpoint: NotRequired[Nullable[PromptCacheBreakpointTypedDict]] - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" class InputText(BaseModel): @@ -34,7 +34,7 @@ class InputText(BaseModel): type: InputTextType prompt_cache_breakpoint: OptionalNullable[PromptCacheBreakpoint] = UNSET - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/messagesmessageparam.py b/src/openrouter/components/messagesmessageparam.py index 8a9738b3..e556cb06 100644 --- a/src/openrouter/components/messagesmessageparam.py +++ b/src/openrouter/components/messagesmessageparam.py @@ -50,7 +50,7 @@ class ContentCompactionTypedDict(TypedDict): content: Nullable[str] type: MessagesMessageParamTypeCompaction cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ContentCompaction(BaseModel): @@ -59,7 +59,7 @@ class ContentCompaction(BaseModel): type: MessagesMessageParamTypeCompaction cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -136,7 +136,7 @@ class ContentWebSearchToolResultTypedDict(TypedDict): tool_use_id: str type: TypeWebSearchToolResult cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ContentWebSearchToolResult(BaseModel): @@ -147,7 +147,7 @@ class ContentWebSearchToolResult(BaseModel): type: TypeWebSearchToolResult cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -174,7 +174,7 @@ class ContentServerToolUseTypedDict(TypedDict): name: str type: TypeServerToolUse cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: NotRequired[Nullable[Any]] @@ -186,7 +186,7 @@ class ContentServerToolUse(BaseModel): type: TypeServerToolUse cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: OptionalNullable[Any] = UNSET @@ -304,7 +304,7 @@ class ContentToolResultTypedDict(TypedDict): tool_use_id: str type: TypeToolResult cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" content: NotRequired[MessagesMessageParamContentUnion2TypedDict] is_error: NotRequired[bool] @@ -315,7 +315,7 @@ class ContentToolResult(BaseModel): type: TypeToolResult cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" content: Optional[MessagesMessageParamContentUnion2] = None @@ -346,7 +346,7 @@ class ContentToolUseTypedDict(TypedDict): name: str type: TypeToolUse cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: NotRequired[Nullable[Any]] @@ -358,7 +358,7 @@ class ContentToolUse(BaseModel): type: TypeToolUse cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" input: OptionalNullable[Any] = UNSET diff --git a/src/openrouter/components/messagesrequest.py b/src/openrouter/components/messagesrequest.py index d2e30398..b4d8f657 100644 --- a/src/openrouter/components/messagesrequest.py +++ b/src/openrouter/components/messagesrequest.py @@ -659,14 +659,14 @@ def additional_properties(self, value): class CachingTypedDict(TypedDict): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: ToolTypeEphemeral ttl: NotRequired[AnthropicCacheControlTTL] class Caching(BaseModel): - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" type: ToolTypeEphemeral @@ -701,7 +701,7 @@ class ToolAdvisor20260301TypedDict(TypedDict): type: TypeAdvisor20260301 allowed_callers: NotRequired[List[AnthropicAllowedCallers]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" caching: NotRequired[Nullable[CachingTypedDict]] defer_loading: NotRequired[bool] max_uses: NotRequired[int] @@ -717,7 +717,7 @@ class ToolAdvisor20260301(BaseModel): allowed_callers: Optional[List[AnthropicAllowedCallers]] = None cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" caching: OptionalNullable[Caching] = UNSET @@ -766,7 +766,7 @@ class ToolWebSearch20260209TypedDict(TypedDict): allowed_domains: NotRequired[Nullable[List[str]]] blocked_domains: NotRequired[Nullable[List[str]]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: NotRequired[Nullable[int]] user_location: NotRequired[Nullable[AnthropicWebSearchToolUserLocationTypedDict]] @@ -783,7 +783,7 @@ class ToolWebSearch20260209(BaseModel): blocked_domains: OptionalNullable[List[str]] = UNSET cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: OptionalNullable[int] = UNSET @@ -838,7 +838,7 @@ class ToolWebSearch20250305TypedDict(TypedDict): allowed_domains: NotRequired[Nullable[List[str]]] blocked_domains: NotRequired[Nullable[List[str]]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: NotRequired[Nullable[int]] user_location: NotRequired[Nullable[AnthropicWebSearchToolUserLocationTypedDict]] @@ -853,7 +853,7 @@ class ToolWebSearch20250305(BaseModel): blocked_domains: OptionalNullable[List[str]] = UNSET cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" max_uses: OptionalNullable[int] = UNSET @@ -905,7 +905,7 @@ class ToolTextEditor20250124TypedDict(TypedDict): name: NameStrReplaceEditor type: TypeTextEditor20250124 cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ToolTextEditor20250124(BaseModel): @@ -914,7 +914,7 @@ class ToolTextEditor20250124(BaseModel): type: TypeTextEditor20250124 cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -943,7 +943,7 @@ class ToolBash20250124TypedDict(TypedDict): name: NameBash type: TypeBash20250124 cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" class ToolBash20250124(BaseModel): @@ -952,7 +952,7 @@ class ToolBash20250124(BaseModel): type: TypeBash20250124 cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -1033,7 +1033,7 @@ class ToolCustomTypedDict(TypedDict): input_schema: InputSchemaTypedDict name: str cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" description: NotRequired[str] type: NotRequired[ToolTypeCustom] @@ -1044,7 +1044,7 @@ class ToolCustom(BaseModel): name: str cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" description: Optional[str] = None @@ -1113,7 +1113,7 @@ class MessagesRequestTypedDict(TypedDict): messages: Nullable[List[MessagesMessageParamTypedDict]] model: str cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" context_management: NotRequired[Nullable[ContextManagementTypedDict]] fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]] r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries.""" @@ -1155,7 +1155,7 @@ class MessagesRequest(BaseModel): model: str cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" context_management: OptionalNullable[ContextManagement] = UNSET diff --git a/src/openrouter/components/promptcachebreakpoint.py b/src/openrouter/components/promptcachebreakpoint.py index a082e2d9..13fbce26 100644 --- a/src/openrouter/components/promptcachebreakpoint.py +++ b/src/openrouter/components/promptcachebreakpoint.py @@ -10,12 +10,12 @@ class PromptCacheBreakpointTypedDict(TypedDict): - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" mode: PromptCacheBreakpointMode class PromptCacheBreakpoint(BaseModel): - r"""Marks an explicit prompt-cache boundary on this content block. Everything through the block carrying this marker is part of the candidate cached prefix. Only supported by OpenAI GPT-5.6 and newer.""" + r"""Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically.""" mode: PromptCacheBreakpointMode diff --git a/src/openrouter/components/responsesrequest.py b/src/openrouter/components/responsesrequest.py index 6f97e56c..92873ed0 100644 --- a/src/openrouter/components/responsesrequest.py +++ b/src/openrouter/components/responsesrequest.py @@ -291,7 +291,7 @@ class ResponsesRequestTypedDict(TypedDict): background: NotRequired[Nullable[bool]] cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict] - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: NotRequired[ChatDebugOptionsTypedDict] r"""Debug options for inspecting request transformations (streaming only)""" frequency_penalty: NotRequired[Nullable[float]] @@ -351,7 +351,7 @@ class ResponsesRequest(BaseModel): background: OptionalNullable[bool] = UNSET cache_control: Optional[AnthropicCacheControlDirective] = None - r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.""" + r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.""" debug: Optional[ChatDebugOptions] = None r"""Debug options for inspecting request transformations (streaming only)""" diff --git a/src/openrouter/presets.py b/src/openrouter/presets.py index 250c20d1..83268947 100644 --- a/src/openrouter/presets.py +++ b/src/openrouter/presets.py @@ -664,6 +664,10 @@ def create_presets_chat_completions( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -736,7 +740,7 @@ def create_presets_chat_completions( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -752,6 +756,8 @@ def create_presets_chat_completions( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -825,6 +831,11 @@ def create_presets_chat_completions( plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -1011,6 +1022,10 @@ async def create_presets_chat_completions_async( ] ] = None, presence_penalty: OptionalNullable[float] = UNSET, + prompt_cache_key: OptionalNullable[str] = UNSET, + prompt_cache_options: OptionalNullable[ + Union[components.PromptCacheOptions, components.PromptCacheOptionsTypedDict] + ] = UNSET, provider: OptionalNullable[ Union[ components.ProviderPreferences, components.ProviderPreferencesTypedDict @@ -1083,7 +1098,7 @@ async def create_presets_chat_completions_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1099,6 +1114,8 @@ async def create_presets_chat_completions_async( :param parallel_tool_calls: Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. :param plugins: Plugins you want to enable for this request, including their settings. :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param prompt_cache_key: + :param prompt_cache_options: Request-level prompt-cache controls. `mode: \"explicit\"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. :param provider: When multiple model providers are available, optionally indicate your routing preference. :param reasoning: Configuration options for reasoning models :param reasoning_effort: Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. @@ -1172,6 +1189,11 @@ async def create_presets_chat_completions_async( plugins, Optional[List[components.ChatRequestPlugin]] ), presence_penalty=presence_penalty, + prompt_cache_key=prompt_cache_key, + prompt_cache_options=utils.get_pydantic_model( + prompt_cache_options, + OptionalNullable[components.PromptCacheOptions], + ), provider=utils.get_pydantic_model( provider, OptionalNullable[components.ProviderPreferences] ), @@ -1420,7 +1442,7 @@ def create_presets_messages( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param context_management: :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: @@ -1732,7 +1754,7 @@ async def create_presets_messages_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param context_management: :param fallbacks: Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. :param max_tokens: @@ -2054,7 +2076,7 @@ def create_presets_responses( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -2406,7 +2428,7 @@ async def create_presets_responses_async( :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. :param background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index fbf686ba..74419ce0 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -137,7 +137,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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -295,7 +295,7 @@ 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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -456,7 +456,7 @@ 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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -616,7 +616,7 @@ 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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1056,7 +1056,7 @@ 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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1214,7 +1214,7 @@ 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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1375,7 +1375,7 @@ 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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. @@ -1535,7 +1535,7 @@ 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 background: - :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. + :param cache_control: Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. :param debug: Debug options for inspecting request transformations (streaming only) :param frequency_penalty: :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. diff --git a/uv.lock b/uv.lock index ab467238..4c9698fd 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.11.31" +version = "0.11.32" source = { editable = "." } dependencies = [ { name = "httpcore" }, From 95b8d0c27a04eb4e84eb3bc07b4d95bbbed3434e Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 21:28:43 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow