You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: allow disabling cache_control on tool definitions for Anthropic-compatible endpoints #58799
Some Anthropic-compatible endpoints accept prompt-cache markers on system and message content but reject cache_control on tool definitions with HTTP 400.
Repro shape: ordinary prompts work fine, but as soon as OpenCode's automatic cache policy marks the last tool definition, the request fails with a 400. Suppressing only the tool-definition marker restores both the streaming response and the tool-call loop, while system and message caching keeps working.
The current workaround is cache: "none", which disables all automatic cache placement — including the system and message cache sites these endpoints do support. That is a bigger loss than necessary.
What I would like: a model-level compatibility option (for example compatibility.supportsToolCacheControl) that lets a model declare that its endpoint rejects cache_control on tool definitions. When set to false:
automatic cache placement skips tool definitions
manually supplied tool cache hints are dropped when lowering to the Anthropic Messages wire format
tool hints are excluded from the four-breakpoint budget, so system and message markers keep the available capacity
When the option is omitted it should default to the existing behavior, so Anthropic and other providers are unaffected. This is generic compatibility metadata — it should not special-case any particular provider ID.
I have a working implementation and tests ready, and can open a PR.
To restate the request: add a model-level compatibility option (for example compatibility.supportsToolCacheControl: false). It would let Anthropic-compatible endpoints that reject cache_control on tool definitions keep their system and message cache breakpoints. Today the only workaround is cache: "none", which turns off all automatic cache placement. Maintainers will consider it.
Your PR #58793 was closed automatically only because it targeted the old v2 branch. If you want to go ahead, you can open a new PR from the same branch into dev and add Closes #58799 to its description so it is linked to this issue.
Activity
opencode-agent commentedon Oct 24, 2026
Thanks for the detailed write-up, @TheBrain0110!
To restate the request: add a model-level compatibility option (for example
compatibility.supportsToolCacheControl: false). It would let Anthropic-compatible endpoints that rejectcache_controlon tool definitions keep their system and message cache breakpoints. Today the only workaround iscache: "none", which turns off all automatic cache placement. Maintainers will consider it.Your PR #58793 was closed automatically only because it targeted the old
v2branch. If you want to go ahead, you can open a new PR from the same branch intodevand addCloses #58799to its description so it is linked to this issue.Related issues:
cacheFormat: "anthropic"placement in tool messages)compatibility.cacheFormat, where the existingalibabaformat already skips tool definitions