[BUG] CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS doesn't remove ?beta=true query params and anthropic-beta headers

Resolved 💬 18 comments Opened Jan 22, 2026 by pdecat Closed Jan 30, 2026

Description

When CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 is set, Claude Code still sends:

  1. ?beta=true query parameters on API URLs (e.g., /v1/messages?beta=true)
  2. anthropic-beta headers with beta feature flags

This causes issues when using LLM gateways like LiteLLM that proxy to AWS Bedrock, as Bedrock rejects requests with these beta flags with error: {"message":"invalid beta flag"}

Current behavior

The env var only disables betas when the provider is "anthropic" or "foundry":

(jB()==="anthropic"||jB()==="foundry")&&!f$(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)

Expected behavior

When CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 is set:

  1. All ?beta=true query parameters should be removed from API URLs
  2. The anthropic-beta header should be empty or not sent
  3. This should apply regardless of the detected provider

Workaround

Binary patching Claude Code:

sed -i 's/?beta=true//g; s/anthropic-beta/anthropic-xxxx/g' $(which claude)

Environment

  • Claude Code version: 2.1.15
  • OS: Linux
  • LLM Gateway: LiteLLM proxying to AWS Bedrock

Related issues

  • #11678 - BUG: claude -p fails with "tools.3.custom.input_examples: Extra inputs are not permitted"
  • #11960 - BUG: CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS ENV variable is not honored in claude settings
  • BerriAI/litellm#16726 - invalid beta flag for Anthropic models with AWS Bedrock

View original on GitHub ↗

18 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11678
  2. https://github.com/anthropics/claude-code/issues/12122
  3. https://github.com/anthropics/claude-code/issues/11154

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

mholttech · 5 months ago

Experiencing the same with Anthropic Models through Databricks

brian-lai · 5 months ago

another hacky workaround is to set up a local proxy server that strips the query parameter and beta header from all outbound requests to anthropic API. you can get claude-code to spin one up for you really easily if you don't feel like writing one yourself...

matanbaruch · 5 months ago

Any update on this?

TilmannF · 5 months ago

For me (using a proxy to Bedrock) this issue appeared when version 2.1.23 was rolled out. Version 2.1.22 still seems to work though.
So if you used the native install method on Mac & want to rollback:
curl -fsSL https://claude.ai/install.sh | bash -s -- 2.1.22

Source

AlejandroTorras-KION · 5 months ago

Confirming @TilmannF : 2.1.22 works fine, but 2.1.23 is failing. Just in case you want to rollback to 2.1.22 the NPM way: npm install -g @anthropic-ai/claude-code@2.1.22

nbebaw · 5 months ago

I have also the same issue with the Claude CLI with the new version 2.1.23

pdecat · 5 months ago

FWIW, recent reports are completely unrelated to MCP usage at all, v2.1.23 is just broken in regard to AWS Bedrock.

Also, my original workaround with sed won't work anymore.

andreweskeclarke · 5 months ago

Still happening in 2.1.25, specifically header structured-outputs-2025-12-15 does not work with Vertex but is still being sent by Claude Code even with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

xxdd10 · 5 months ago

Still happening in 2.1.25,please quick quick repair.

wsd886 · 5 months ago

In version 2.1.25, adding the global variable CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 worked, but I’m not sure if it’s possible to write an Nginx filter to remove parameters—it feels like it would be very troublesome.

pdecat · 5 months ago
andreweskeclarke · 5 months ago

You only fixed part of the issue.

In 2.1.22 I see errors about structured-outputs-2025-12-15 beta headers, but it doesn't break the main Claude Code workflow. let's call it BUG_MINOR
In 2.1.23 Claude Code can't even start, lets call it BUG_MAJOR
In 2.1.25 you fixed BUG_MAJOR but not BUG_MINOR, I still see errors about structured-outputs-2025-12-15 when sending messages to vertex. Even with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

bdavj · 5 months ago

Still seeing this issue. We weren't seeing this yesterday with 2.1.22.

LiteLLM, Claude Code, Bedrock

As of about 1400 GMT today, we've started seeing the invalid beta flag coming from the bedrock back end. Presumably the DISABLE_EXPERIMENTAL_BETAS flag shouldn't be needed, and this is something that needs fixing properly? Has a beta feature flag been deprecated recently?

pdecat · 5 months ago

Well, this issue was about CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 not being respected, and v2.1.25 resolves that in our context (LiteLLM proxying to AWS Bedrock).

PS: I'm just a user here.

bdavj · 5 months ago

Fair point - will raise a separate issue if one doesn't already exist.

chenrui333 · 5 months ago

Yeah, I can also confirm the issue is resolved for me now.

github-actions[bot] · 5 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.