[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
5 Comments
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.
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
+1 — confirmed this persists on v2.1.112 (macOS, Bedrock commercial, us-east-1).
Tested with both
us.anthropic.claude-opus-4-7directly and via application inference profiles. Same "invalid beta flag" error.ANTHROPIC_BETAS=""andCLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1have 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.
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"withoutput_config.effortinstead of the oldthinking.type: "enabled"withbudget_tokens, and theinterleaved-thinking-2025-05-14beta flag is no longer valid for this model on Bedrock.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.