Skip to content

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

Closed as not planned

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), [email protected]

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.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 17, 2026
  2. github-actions commented on Mar 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. cyberprophet commented on Mar 17, 2026

    @cyberprophet
    ContributorAuthor

    Thanks for flagging the duplicates. After reviewing:

    Closing as duplicate of #12485. Will track progress there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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