Description
When using the native Anthropic provider with claude-opus-4-6 and a "max" variant (configured via oh-my-opencode plugin), OpenCode's bundled @ai-sdk/anthropic provider generates invalid request parameters, causing the Anthropic API to return HTTP 400 invalid_request_error.
The request body sent to https://api.anthropic.com/v1/messages includes:
{
"model": "claude-opus-4-6",
"max_tokens": 32000,
"thinking": {"type": "adaptive"},
"output_config": {"effort": "max"}
}
"thinking": {"type": "adaptive"} — not a documented Anthropic API parameter (should be {"type": "enabled", "budget_tokens": N})
"output_config": {"effort": "max"} — not part of the Anthropic Messages API spec
The API response:
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Error"
}
}
This was working on 2026-03-16 and broke on 2026-03-17 with no changes to OpenCode version, config, or plugins. This suggests either a server-side Anthropic API validation change, or an issue in how OpenCode's @ai-sdk/anthropic bundle maps variant options to Anthropic API parameters.
Plugins
oh-my-opencode (sets "variant": "max" on agent configs), opencode-anthropic-auth@0.0.13
OpenCode Version
1.2.27
Steps to Reproduce
- Configure an agent with
"model": "anthropic/claude-opus-4-6" and "variant": "max" (via oh-my-opencode or directly)
- Start a session and send any message
- OpenCode attempts to call
https://api.anthropic.com/v1/messages with the invalid parameters
- API returns 400
invalid_request_error
Operating System
macOS (Darwin 25.3.0)
Additional Context
From the logs:
service=provider providerID=anthropic pkg=@ai-sdk/anthropic using bundled provider
ERROR service=session.processor error=Error stack="AI_APICallError: Error\n at <anonymous> (/$bunfs/root/src/index.js:101905:30)"
Key observation: Custom provider models defined in opencode.json with explicit variant mappings (e.g., Antigravity proxy models using thinkingConfig.thinkingBudget) work correctly. The issue is specifically with the built-in Anthropic provider interpreting the variant and producing non-standard API parameters.
Workaround: Removing the "variant": "max" from the model config allows claude-opus-4-6 to work without extended thinking.
Description
When using the native Anthropic provider with
claude-opus-4-6and a"max"variant (configured via oh-my-opencode plugin), OpenCode's bundled@ai-sdk/anthropicprovider generates invalid request parameters, causing the Anthropic API to return HTTP 400invalid_request_error.The request body sent to
https://api.anthropic.com/v1/messagesincludes:{ "model": "claude-opus-4-6", "max_tokens": 32000, "thinking": {"type": "adaptive"}, "output_config": {"effort": "max"} }"thinking": {"type": "adaptive"}— not a documented Anthropic API parameter (should be{"type": "enabled", "budget_tokens": N})"output_config": {"effort": "max"}— not part of the Anthropic Messages API specThe API response:
{ "type": "error", "error": { "type": "invalid_request_error", "message": "Error" } }This was working on 2026-03-16 and broke on 2026-03-17 with no changes to OpenCode version, config, or plugins. This suggests either a server-side Anthropic API validation change, or an issue in how OpenCode's
@ai-sdk/anthropicbundle maps variant options to Anthropic API parameters.Plugins
oh-my-opencode (sets
"variant": "max"on agent configs), opencode-anthropic-auth@0.0.13OpenCode Version
1.2.27
Steps to Reproduce
"model": "anthropic/claude-opus-4-6"and"variant": "max"(via oh-my-opencode or directly)https://api.anthropic.com/v1/messageswith the invalid parametersinvalid_request_errorOperating System
macOS (Darwin 25.3.0)
Additional Context
From the logs:
Key observation: Custom provider models defined in
opencode.jsonwith explicit variant mappings (e.g., Antigravity proxy models usingthinkingConfig.thinkingBudget) work correctly. The issue is specifically with the built-in Anthropic provider interpreting the variant and producing non-standard API parameters.Workaround: Removing the
"variant": "max"from the model config allowsclaude-opus-4-6to work without extended thinking.