Skip to content

[Bug] Anthropic provider sends invalid API parameters (thinking.type: adaptive, output_config.effort) when variant is set #17876

Description

@cyberprophet

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

  1. Configure an agent with "model": "anthropic/claude-opus-4-6" and "variant": "max" (via oh-my-opencode or directly)
  2. Start a session and send any message
  3. OpenCode attempts to call https://api.anthropic.com/v1/messages with the invalid parameters
  4. 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.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions