[BUG] Opus 4.7 on Bedrock fails with 'invalid beta flag' — Claude Code sends deprecated thinking API format
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"withbudget_tokens+anthropic_beta: ["interleaved-thinking-2025-05-14"] - New (required by Opus 4.7):
thinking.type: "adaptive"withoutput_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
- 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"
}
}
- Start Claude Code:
claude - Send any message — immediately fails with "invalid beta flag"
Workarounds attempted (none worked):
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1— does not stripinterleaved-thinking-2025-05-14from 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-7is available and listed viaaws bedrock list-foundation-models - Direct API calls via AWS CLI to
us.anthropic.claude-opus-4-7work 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
opusalias resolves to 4.7 there; the issue is specific to the Bedrock InvokeModel path
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗