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

Status Fixed / completed
Reported on v2.1.111
Maintainer reply None cached
Activity 5 comments · opened Apr 16, 2026 · 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 ↗

5 Comments

rakodev · 4 months ago

Same issue here, tried claude code 2.1.110, 2.1.111 and also 2.1.112. always same error:

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

It works on any other model than 4.7. I'm on mac, with zsh terminal. I tried all I can find online on that issue, still same result.

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/49370
  2. https://github.com/anthropics/claude-code/issues/49238
  3. https://github.com/anthropics/claude-code/issues/49279

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

graypay · 4 months ago

+1 — confirmed this persists on v2.1.112 (macOS, Bedrock commercial, us-east-1).

Tested with both us.anthropic.claude-opus-4-7 directly and via application inference profiles. Same "invalid beta flag" error. ANTHROPIC_BETAS="" and CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 have no effect.

v2.1.112 release notes mention fixing "claude-opus-4-7 is temporarily unavailable" for auto mode, but the beta flag in the request body is still being sent.

ironmano-csco · 4 months ago

Closing as duplicate of #49238. Apologies for the duplicate — should have searched first. Our investigation confirmed the root cause: Opus 4.7 requires thinking.type: "adaptive" with output_config.effort instead of the old thinking.type: "enabled" with budget_tokens, and the interleaved-thinking-2025-05-14 beta flag is no longer valid for this model on Bedrock.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.