[BUG] Opus 4.7 on Bedrock fails with 'invalid beta flag' — Claude Code sends deprecated thinking API format

Resolved 💬 5 comments Opened Apr 16, 2026 by ironmano-csco Closed Apr 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code v2.1.111 fails with a 400 "invalid beta flag" error when using Opus 4.7 (us.anthropic.claude-opus-4-7) on AWS Bedrock.

Root cause: Opus 4.7 (released April 16, 2026) introduced a breaking change to the thinking API:

  • Old (no longer supported by Opus 4.7): thinking.type: "enabled" with budget_tokens + anthropic_beta: ["interleaved-thinking-2025-05-14"]
  • New (required by Opus 4.7): thinking.type: "adaptive" with output_config: {effort: "high"} — no beta flag needed

Claude Code v2.1.111 still sends the old format to Bedrock's InvokeModel API:

body.anthropic_beta: ["interleaved-thinking-2025-05-14"]   ← rejected by Opus 4.7
body.thinking: {type: "enabled", budget_tokens: ...}       ← not supported by Opus 4.7

Verified via direct AWS CLI calls:

  • Opus 4.7 works on Bedrock without beta flags (basic messages succeed)
  • Opus 4.7 works with thinking.type: "adaptive" + output_config.effort
  • Opus 4.7 rejects anthropic_beta: ["interleaved-thinking-2025-05-14"] with "invalid beta flag"
  • Opus 4.7 rejects thinking.type: "enabled" with: "thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.

What Should Happen?

Claude Code should detect Opus 4.7 on Bedrock and use the new adaptive thinking API format instead of the deprecated enabled/budget_tokens format.

Error Messages/Logs

ANTHROPIC_LOG=debug output:

headers: {
  "anthropic-beta": "claude-code-20250219,effort-2025-11-24",
}
body: {
  thinking: [Object ...],
  anthropic_beta: [ "interleaved-thinking-2025-05-14" ],
}

API Error: 400
{"type":"error","request_id":"req_...","error":{"type":"invalid_request_error","message":"invalid beta flag"}}

Steps to Reproduce

  1. Configure Claude Code for Bedrock with Opus 4.7:

``json
{
"env": {
"CLAUDE_CODE_USE_BEDROCK": "1",
"AWS_REGION": "us-west-2",
"ANTHROPIC_MODEL": "us.anthropic.claude-opus-4-7"
}
}
``

  1. Start Claude Code: claude
  2. Send any message — immediately fails with "invalid beta flag"

Workarounds attempted (none worked):

  • CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 — does not strip interleaved-thinking-2025-05-14 from the body
  • Changing effortLevel — no effect on the beta flag in the body

Claude Model

Opus

Is this a regression?

No — Opus 4.7 is a new model released today (April 16, 2026) with breaking API changes

Claude Code Version

2.1.111 (Claude Code)

Platform

AWS Bedrock Commercial

Operating System

macOS

Terminal/Shell

zsh

Additional Information

  • Model anthropic.claude-opus-4-7 is available and listed via aws bedrock list-foundation-models
  • Direct API calls via AWS CLI to us.anthropic.claude-opus-4-7 work correctly without beta flags
  • Opus 4.6 (anthropic.claude-opus-4-6-v1) continues to work fine with Claude Code
  • The first-party Anthropic API likely handles this correctly since opus alias resolves to 4.7 there; the issue is specific to the Bedrock InvokeModel path

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗