Beta headers (interleaved-thinking-2025-05-14) sent to third-party gateways despite DISABLE_EXPERIMENTAL_BETAS=1 and BETAS=""

Status Fixed / completed
Reported on v2.1.220
Maintainer reply None cached
Activity 1 comment · opened Aug 4, 2026 · closed Aug 25, 2026

Beta headers sent to third-party gateways despite DISABLE_EXPERIMENTAL_BETAS=1

Environment

  • Claude Code version: 2.1.220
  • OS: macOS 15 (Darwin 25.5.0)
  • Model: step-router-v1 (third-party gateway)
  • API gateway: https://tokenrhythm.studio/ (Anthropic-compatible)

Env vars set

CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
CLAUDE_CODE_BETAS="" (empty string)
CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144

Settings.json

{
  "env": {
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1",
    "CLAUDE_CODE_BETAS": ""
  }
}

Bug description

Despite CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 and CLAUDE_CODE_BETAS="" being set in both shell env and settings.json, Claude Code still sends the interleaved-thinking-2025-05-14 beta header to the upstream API gateway. This causes a 400 error on third-party gateways that do not recognize this beta:

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "尚未验证或不支持的 anthropic-beta:interleaved-thinking-2025-05-14"
  }
}

Expected behavior

With DISABLE_EXPERIMENTAL_BETAS=1 or BETAS="", NO beta headers should be sent to the upstream gateway, regardless of whether the beta is related to advisor or any other experimental feature.

Actual behavior

The interleaved-thinking-2025-05-14 beta header is still included in API requests, causing 400 errors on third-party gateways.

Related bugs

This is the same category as previously reported:

  • #46105 / #70563: Unrecognized beta header causes 400 on non-Anthropic gateways
  • The advisor-tool-2026-03-01 beta was previously blocked by DISABLE_EXPERIMENTAL_BETAS=1, but new betas (interleaved-thinking) are still being sent despite the same env var.

Suggestion

Either:

  1. Make DISABLE_EXPERIMENTAL_BETAS=1 and BETAS="" actually strip ALL beta headers (including interleaved-thinking), not just advisor
  2. Or provide a way to see which beta headers are being sent (debug mode) so users can verify the env var is working
  3. Or add a new env var like CLAUDE_CODE_DISABLE_ALL_BETAS=1 that strips every beta header unconditionally

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗