[BUG] Opus 4.7 doesn't work with bedrock
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?
(26-04-16 15:28:52) <1> [~]
dev-dsk-fotay-1d-35fa9bb2 % claude
╭─── Claude Code v2.1.111 ──────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ ▐▛███▜▌ │ Recent activity │
│ ▝▜█████▛▘ │ No recent activity │
│ ▘▘ ▝▝ │ │
│ │ │
│ Opus 4.7 with high effort · API Usage Billing │ │
│ /local/home/fotay │ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
❯ hi
⎿ API Error: 400 {"type":"error","request_id":"req_kp45ka3ga5m7upqi6w4r6i3vta2n3lvkx724eynqh2kt6qxiw4xa","error":{"type":"invalid_request_er
ror","message":"invalid beta flag"}}
❯ /model
⎿ Set model to Opus 4.7
❯ hi
⎿ API Error: 400 {"type":"error","request_id":"req_mo2t5pnuqx7mpk4ggz527bgxxpccd7nk2yth5hvcgxlhtydugihq","error":{"type":"invalid_request_er
ror","message":"invalid beta flag"}}
What Should Happen?
it should work
Error Messages/Logs
Steps to Reproduce
use bedrock as provider and set model to opus 4.7
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.1.111
Platform
AWS Bedrock
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
81 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Root cause analysis
I dug into this and found the precise cause. TL;DR: **Claude Code sends
anthropic_betain the request body when talking to Bedrock, but Bedrock only accepts it as theanthropic-betaHTTP header.** Bedrock returns 400 "invalid beta flag" for anything it sees in the body.Evidence
With
ANTHROPIC_LOG=debugon Claude Code2.1.111pointed at Bedrock (us.anthropic.claude-opus-4-7), the outbound request looks like:Bedrock rejects this with
400 "invalid beta flag".Minimal repro against Bedrock directly (no Claude Code)
I also tested every individual beta flag Claude Code uses (
interleaved-thinking-2025-05-14,tool-search-tool-2025-10-19,effort-2025-11-24, etc.) in theanthropic-betaheader — all of them are accepted by Bedrock onus.anthropic.claude-opus-4-7. The problem is purely the placement (body vs. header).Why Opus 4.6 works but Opus 4.7 doesn't
Looking at the minified source (search for
opus-4-7), Claude Code appears to route Opus 4 calls throughclient.beta.messages.createand addsinterleaved-thinking-2025-05-14+ (for 4.7) extra flags liketool-search-tool-2025-10-19andeffort-2025-11-24. The SDK path forclient.beta.messages.createserializes betas intobody.anthropic_betainstead of theanthropic-betaheader when the target is Bedrock. Opus 4.6 historically accepted (or didn't receive) the specific flags that now fail on 4.7, so the bug only surfaces now.Why
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1does not fully fix itThat flag removes some header-level experimental betas (e.g.
tool-search-tool-2025-10-19), butinterleaved-thinking-2025-05-14is still emitted inbody.anthropic_betaand still gets rejected. Related: #22893.Suggested fix
In the Bedrock transport, after constructing the JSON body:
This mirrors what the first-party Anthropic API does server-side (accepting both shapes) and what Bedrock requires (header only).
Workaround for anyone blocked today
A ~100 line local HTTP shim that moves
body.anthropic_beta→anthropic-betaheader and forwards tobedrock-runtime.<region>.amazonaws.commakes Claude Code 2.1.111 + Opus 4.7 work end-to-end. Point Claude Code at it withANTHROPIC_BEDROCK_BASE_URL=http://127.0.0.1:8765. Happy to share the script if useful.Environment
2.1.111v22.22.2us-east-1, modelus.anthropic.claude-opus-4-7(also repro'd onglobal.anthropic.claude-opus-4-7)AWS_BEARER_TOKEN_BEDROCKdoing this worked:
Key env vars:
ENABLE_TOOL_SEARCH=false— prevents a separatedefer_loading: Extra inputs are not permittederrorCLAUDE_CODE_SIMULATE_PROXY_USAGE=1— built-in flag that strips thebetas:SDK parameter from API requests (handles injection path 1)CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1— reduces beta count (not sufficient alone)Step 2: Binary Patch
SIMULATE_PROXY_USAGEonly blocks path 1. Path 2 (theSt()function) still injectsanthropic_betadirectly into the request body. We fix this with a 2-byte binary patch.What we're changing
The function
St()in the bundled code has this logic:We change
>to<so the condition is never true (H.length<0is always false for arrays):Find the patch offsets
You'll see ~5 offsets. The ones that matter are the first two that appear in actual code (not binary data sections). To identify them, check context around each:
Look for output containing:
Apply the patch
Once you find the two code copies of St(), locate the
>inH&&H.length>0and change it to<.Automated method (for 2.1.111 specifically — offsets may differ on other versions):
Manual method (if Python script doesn't work)
Step 3: Test
Exit any running Claude Code sessions, then:
It should connect to Opus 4.7 without the
invalid beta flagerror.Reverting
Remove
CLAUDE_CODE_SIMULATE_PROXY_USAGEfrom~/.claude/settings.json.Note: If Claude Code is running, the binary is locked. Either stop all sessions first, or copy the backup to a new name and update the symlink:
Known Trade-offs
CLAUDE_CODE_SIMULATE_PROXY_USAGEalso strips the context-hint beta body. This is a minor feature loss — context hints help with prompt caching optimization but aren't required for functionality.St()patch prevents anyCLAUDE_CODE_EXTRA_BODYenv var from addinganthropic_beta. If you don't use that env var (most people don't), this has zero impact.Why other approaches don't work
| Approach | Result |
|----------|--------|
|
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1alone | Reduces beta count but doesn't remove all ||
SIMULATE_PROXY_USAGEalone | Blocks SDK betas path but not theSt()extra body path || Binary patch alone (without env var) | Too many code paths to patch — betas flow through SDK headers, extra body, and duplicate code copies |
| Renaming
anthropic_beta→anthropic_betX| Bedrock rejects unknown fields too: "Extra inputs are not permitted" |E: Now fixed.
i assume in this case you have a fix? or is your plan to wait?, ah your based in uk. you should go comply with gdpr
It's monkey patch, yes, but at least a solution
A quick fix without patching the binary:
@Menci yeah nice find! but we should keep in mind this would _probably_ break once they ship a proper fix/update right? 🙃
@guicheffer It won't break once they ship a proper fix/update. A proper fix/update will exactly adds these to the request body. But it's always better to remove the workaround once it's not necessary.
didn't work due to :
+1 - also affected on macOS arm64, Bedrock us-west-1, Claude Code 2.1.111. The CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 workaround does not fix it.
+1
Seeing this as well
Sorry folks, Opus 4.7 on the
bedrock-runtimeendpoint is broken right now. We're working with AWS to fix this.It is still available on the
bedrock-mantleendpoint. Temporary workaround: follow these steps to switch claude code to the mantle endpoint.Confirmed the workaround works. Ensure you also unset
CLAUDE_CODE_USE_BEDROCKor it will attempt to use Bedrock native.I could select the model, but it doesn't respond, stuck in a retry loop of 10 attempts and then fails
You need to assure CreateInference policy is attached to your IAM role etc. if you are using role based.
You can have both bedrock and mantle set at the same time (
/statuswill say it is using both). The key is just that the mantle model name is different. You need to manually do this instead of using the picker:/model anthropic.claude-opus-4-7my complete setting for the workaround:
you can check
"https://bedrock-mantle.<region>.api.aws/v1/models"to see supported mantle models in your account.@brenden I know you all are probably scrambling around right now and I appreciate the note in here!
I did want to say though that in-app messaging would have been super helpful, since a few people at our company (and I'm sure many more out there) burned time thinking it was a permission issue and/or trying various fixes. I've seen a note on launch about Haiku being down, there's box listing a few new features after an upgrade, etc. Some small note on startup saying that Opus 4.7 isn't working on Bedrock would have saved a lot of time. If the system isn't general enough to do that right now, definitely is something to consider adding in the future!
@ShawnFumo that's a neat idea--we should have a better way of announcing these outages (cc @ant-kurt)
OK AWS has found the issue and is deploying a fix now. ETA for the fix is 1PM PDT.
@brenden Any further udpdates?
We had to use both env vars:
Also, adding
[1m]break it too. e.g.I can confirm that I am still affected by this issue.
Claude Code 2.1.112
macOS 26.3.1(a) arm64
Bedrock us-east-1, model us.anthropic.claude-opus-4-7
Auth: AWS_BEARER_TOKEN_BEDROCK
Claude Code 2.1.112 can connect to generic opus-4.7 model but still can't connect via inference profiles. I confirmed the inference profile is fine by using the AWS CLI
<img width="2544" height="934" alt="Image" src="https://github.com/user-attachments/assets/2d182f62-3429-4683-b991-6c55db5feb56" />
Sorry, the deployment to fix this is delayed. New ETA is 4PM PDT
OK the deployment has finished and O4.7 should be working on
bedrock-runtimenow.Is this a backend fix or do we need a new Claude Code version e.g. 2.1.113 which doesn't seem to be present yet.
Still getting same error on Claude Code
2.1.112Working on my machine ™️ thanks for the push and fix here folks!
I am getting now transient errors, 50% to 70%:
API Error: 400 {"type":"error","request_id":"req_rqfeb***,"error":{"type":"invalid_request_error","message":"invalid beta flag"}}@udo-hf Can you try
/model us.anthropic.claude-opus-4-7?I am still getting the same invalid beta flag error with 2.1.112 version (us-east-1).
I tried both
us.andglobal.prefix, getting same error.AWS_REGIONisus-east-2I fixed it with
"CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING": "1",
"CLAUDE_CODE_DISABLE_THINKING": "1",
in settings.json.
@brenden Don't have
usavailable in my region, so I have to useglobal. Hittingap-southeast-2. Still getting theinvalid beta flagresponse.I just had a successful test w/ Claude Code + "us.anthropic.claude-opus-4-7" without making any changes.
Still getting error in us-east-2, using global endpoint as well as us. one. Although working in us-east-1.
Works for me. (Intermittent behavior? Perhaps deployment is in progress??)
Using application inference profiles in AWS Bedrock us-west-2.
Ah sorry, I shared bad info earlier. The current state: fix for
us-east-1should be fully rolled out, and the fix forus-west-2is almost fully rolled out. We expect the fixes for other regions to be deployed by around 8PM PDT. Will keep this thread updated with what I hear from AWS.so AWS_REGION = us-east-1 & model id = us.anthropic.claude-opus-4-7? Confirmed worked
This works with 2.1.112 now!
The stable releases 2.1.85 and 2.1.97 still need export CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1 ; export CLAUDE_CODE_DISABLE_THINKING=1
Any plans to get it to work on prior CC releases without having to set those two variables?
us.anthropic.claude-opus-4-7is now working in eu-west-2, but no luck witheu.enthropic.claude-opus-4-7!I'm still seeing errors in us-west-2 using Application Inference Profiles in us-west-2:
The only thing that works is to disable thinking (CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1; CLAUDE_CODE_DISABLE_THINKING=1) but doesn't that defeat the benefits of Opus 4.7?
It works on us-east-1 and us-east-2 but not works on ap-northeast-1.
Apart from this, it doesn't work for thinking mode. However, I think the
thinking modeis the necessary feature for meFor me, I had several things going on in settings.json:
In env, MAX_THINKING_TOKENS set to 8192
In the main body of the settings, "alwaysThinkingEnabled": true
Removing MAX_THINKING_TOKENS, setting "alwaysThinkingEnabled": false, and ADDING an "effort": "high" to settings.json worked the magic. Now with 2.1.112, I can use my Opus 4.7 Application Inferencing Profile ARN with claude code perfectly (as ANTHROPIC_DEFAULT_OPUS_MODEL set to the ARN).
Un-doing any one of those 3 changes seems to bork it with API 400 errors.
Fix has now been deployed to all AWS regions. The
invalid beta flagerror should be gone.But
"thinking.type.enabled" is not supported for this modelis still there.Hi getting "permission_error" "message":"anthropic.claude-opus-4-7 is not available for this account. You can explore other available models on Amazon Bedrock. For additional access options, contact AWS Sales at https://aws.amazon.com/contact-us/sales-support/"}}.
When using Opus 4.7 via bedrock api despite it being listed as an available model
The AWS deployment has been resolved. This is a CC bug now. working on a hotfix to address this one.
Also getting this issue.
Get it in the playground too, even though we have model access per the catalog.
Same, I cannot get it enabled, do we really need to talk to the sales team? Wonder how long that's gonna take to get it resolved.
I'm not sure why the symptoms vary from person to person, but the issue persists for me using the Bedrock application inference profile and Claude Code
2.1.112.Oddly enough, it is working ok on a macOS machine running Claude Code
2.1.92(homebrew version).We are trying to call the 4.7 model via Cursor by model id and its failing.
Adding a detailed report to help diagnose the
permission_errorvariant of this issue. Several commenters above are experiencing the same symptom; this may help confirm it's a systemic issue rather than account-specific misconfiguration.Environment
us-east-1AmazonBedrockFullAccess(bedrock:*on*) on top of SSO AdministratorAccess — no IAM-layer restrictions possibleError (reproducible)
Response:
The same error occurs via both
global.anthropic.claude-opus-4-7andus.anthropic.claude-opus-4-7.Note: this is the AWS CLI reproducing the issue directly, not through Claude Code. The same error surfaces from any Bedrock runtime client. So while filed under
claude-code, the root cause appears to be AWS Bedrock / Anthropic-side model access.Happy to share specific
request_idvalues privately via a support case if it helps AWS/Anthropic engineers trace the exact requests.Pre-conditions that look correct
Every check I can run from the CLI returns a green light:
``
``aws bedrock get-foundation-model --model-identifier anthropic.claude-opus-4-7
→ modelLifecycle.status: ACTIVE
→ inferenceTypesSupported: ["INFERENCE_PROFILE"]
global.andus.variants, Type: SYSTEM_DEFINED)PurchaseAgreementACTIVESaaSProductaws bedrock get-use-case-for-model-access --region us-east-1returns a populatedformDatablob (company details, industry, intended use case).L-5DB28B7B(Cross-region TPM for Opus 4.7): 15,000,000L-34152C1D(Global cross-region TPM for Opus 4.7): 15,000,000Same invocation pattern, same IAM identity, same region — 4.6 succeeds, 4.7 fails with
permission_error. This rules out any credential / permission / networking issue on the user side.What's different about 4.7
The
list-foundation-model-agreement-offersresponse uses a new service code prefixAFS1for pricing dimensions:Opus 4.6's pricing dimensions use a different service code format. This could indicate a new billing/reconciliation path for Opus 4.7 that isn't yet fully wired up on the Bedrock
InvokeModelauthorization check.Time elapsed
Agreement became ACTIVE approximately 10 hours before filing this comment. This is well beyond any reasonable "propagation lag" window AWS typically documents (usually up to 15 minutes).
Cross-reference with other reports in this thread
Multiple users report the same exact error text in this thread:
permission_errorwith the "contact AWS Sales" verbiageAsk
Could AWS / Anthropic please confirm:
invalid beta flagfix was progressively rolled out? Is there an ETA or a status page we should watch?bedrock:*✓Happy to provide additional diagnostic info (request IDs, exact timestamps, etc.) via a support case or private channel if that helps. Thanks for your attention.
I actually got a reply from the support team and the policy seems to have changed with the release of opus 4.7. Here's a snippet of the response I got:
Pretty sure they're just spouting some BS stuff. It's already activated and quotas are fine if you check it
This is actually very well detailed thank you. I hope we get an official response from them. Btw, does this happen to everyone when using playground or api?
Thanks @caliburn420 🙏
Just tested: Bedrock Playground returns the exact same permission_error as the CLI. So it's happening on both API/CLI and the console-based playground — completely client-agnostic. The gate is per-AWS-account on the server side, likely independent of Claude Code itself.
On the "relatively new / usage limited" rationale: we filed a support case and proactively added evidence that our account is actively using Claude Opus 4.6 in production with prior quota-increase approvals. Will share back whatever reply we get; hoping for a less hand-wavy explanation than the one posted above.
I'm getting a different error from the
invalid beta flagone — still happening after the fix was deployed.Error:
What I've tried:
create-foundation-model-agreement— succeeded)get-foundation-model-availabilityreturnsAUTHORIZED+AVAILABLEus-east-1andus-west-2— same error everywhereEnvironment:
The error format is Anthropic's JSON, not an AWS error — so it seems like Anthropic's backend entitlement system isn't recognizing the marketplace subscription for Opus 4.7 specifically.
@brenden
— could this be a separate backend issue from the beta flag one?
I'm getting it on an enterprise account (Fortune 500).
Do we need to start another issue? Seems like many people have this problem
+1 on the 'permission_error', 'anthropic.claude-opus-4-7 is not available for this account'. Our 4.6 config works perfectly. We're unsure what path to take to resolve the issue. So, we're stuck.
The
permission_erroris an AWS problem. It means that access to Opus 4.7 hasn't been enabled on your AWS account yet. According to Amazon, you need to contact AWS Sales to get access.Summarizing:
invalid beta flag- fix has been deployed to all AWS regions, you should no longer be seeing this\"thinking.type.enabled\" is not supported for this model- we're pushing a change in 2.1.113 that should help with this in cases where the AWS credentials are able to read the application inference profile's metadata. Otherwise, you may need to setANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES=effort,xhigh_effort,max_effort,thinking,adaptive_thinking,interleaved_thinking. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilitiesanthropic.claude-opus-4-7 is not available for this account- Contact AWS Sales at https://aws.amazon.com/contact-us/sales-support/Just to confirm, is access to Opus 4.7 on Bedrock now gated behind AWS Sales approval for accounts?
Weird I still think it's an error on AWS' part, like I think support is just giving out generic responses, have anyone who requested access get them, and why do some accounts have them by default, even new ones.
@ant-kurt - sorry, but that's absolutely not an answer: "anthropic.claude-opus-4-7 is not available for this account - Contact AWS Sales at https://aws.amazon.com/contact-us/sales-support/"
I received an email from AWS yesterday saying I have access to Opus 4.7: "You have subscribed to the following product in AWS Marketplace: * Claude Opus 4.7 (Amazon Bedrock Edition) sold by Anthropic, PBC." But I'm running into the same issue as everyone else here about contacting sales.
absoloutly - feels like were second class.
Soo what now?
Still following up with the AWS team to get more information.
Here is the latest form the AWS team:
If you are still seeing this error, you may explore other available models on Amazon Bedrock, or contact AWS Sales at https://aws.amazon.com/contact-us/sales-support/ for additional access options
Will keep you updated as we learn more.
The service quota for opus 4.7 has tokens per minute but not requests per minute. I'm guessing access is being with held for the time being.
still not working, anything related to this: https://forum.cursor.com/t/opus-4-7-not-functioning-on-bedrock-because-of-temperature-deprecation-400/158212/11
I've filed an updated bug report here: https://github.com/anthropics/claude-code/issues/51183
This bug was closed without adequate coverage.
It's because it's not a bug, it's a feature. Availability of Opus 4.7 is gated with approval now. Probably because the quotas are much higher by default.
<img width="2140" height="703" alt="Image" src="https://github.com/user-attachments/assets/818f1d21-f980-4aa3-a38f-df68b6157ce3" />
Addendum: Quotas and Entitlements Confirmed
All AWS-side checks pass — the block is on Anthropic's runtime layer.
Service Quotas (non-zero, healthy)
Entitlement Status
Inference Profiles
Summary
Every AWS control plane check confirms this account is authorized and provisioned for Opus 4.7. The permission_error is originating from Anthropic's runtime behind Bedrock, not from AWS IAM, entitlements, or quotas.
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.