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
bug: Claude Sonnet 4.5 with thinking + ephemeral cache returns HTTP 400 #17883
When using claude-sonnet-4-5 via the Anthropic provider with extended thinking enabled, the API returns HTTP 400. The request includes thinking: { type: "enabled", budget_tokens: 31999 } and system messages with ephemeral cache_control type.
This was observed when using the model through a plugin (shop-plugin) that injects system prompts via experimental.chat.system.transform hook. The system array contains blocks with type: "ephemeral", which appears to conflict with the thinking configuration.
After investigating the oh-my-openagent codebase, this issue is confirmed to be on the OpenCode / @ai-sdk/anthropic side, not oh-my-openagent.
oh-my-openagent's role
oh-my-openagent applies thinking: { type: "enabled", budgetTokens: 32000 } to all non-GPT models in its agent factories (e.g., Sisyphus, Oracle, Metis). This is a valid Anthropic API parameter for models that support extended thinking like claude-sonnet-4-5.
The ephemeral cache_control in system messages comes from the plugin layer (experimental.chat.system.transform hook) — oh-my-openagent's own system-transform.ts is currently a no-op stub.
Root cause
OpenCode's provider layer should validate that the combination of thinking + system messages with cache_control: { type: "ephemeral" } is compatible before sending to the Anthropic API. The Anthropic Messages API rejects this combination with HTTP 400.
Suggested fix
Either:
Strip cache_control from system message blocks when thinking is enabled (pre-flight sanitization)
Or validate the combination and surface a clear error to the user before sending to the API
Closing oh-my-openagent#2631 as this is an OpenCode-level concern.
Activity
cyberprophet commentedon Mar 17, 2026
Cross-reference from oh-my-openagent#2631
After investigating the oh-my-openagent codebase, this issue is confirmed to be on the OpenCode /
@ai-sdk/anthropicside, not oh-my-openagent.oh-my-openagent's role
oh-my-openagent applies
thinking: { type: "enabled", budgetTokens: 32000 }to all non-GPT models in its agent factories (e.g., Sisyphus, Oracle, Metis). This is a valid Anthropic API parameter for models that support extended thinking likeclaude-sonnet-4-5.The
ephemeralcache_control in system messages comes from the plugin layer (experimental.chat.system.transformhook) — oh-my-openagent's ownsystem-transform.tsis currently a no-op stub.Root cause
OpenCode's provider layer should validate that the combination of
thinking+ system messages withcache_control: { type: "ephemeral" }is compatible before sending to the Anthropic API. The Anthropic Messages API rejects this combination with HTTP 400.Suggested fix
Either:
cache_controlfrom system message blocks whenthinkingis enabled (pre-flight sanitization)Closing oh-my-openagent#2631 as this is an OpenCode-level concern.
ref: code-yeongyu/oh-my-openagent#2631
github-actions commentedon Jul 6, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.