Skip to main content

Short Answer

If Claude Code returns 400 ValidationException, Extra inputs are not permitted, or an error related to cache_control.scope on the AWS Claude official route, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 before starting Claude Code. This disables Claude Code experimental beta request fields so unsupported extra fields are not rejected by the AWS Claude / Bedrock route. Use export for a quick test, then put the setting in ~/.claude/settings.json for persistent use.

When This Applies

  • Claude Code is already configured with LaoZhang API
  • The request uses the AWS Claude official route or a Bedrock-related route
  • The terminal or request log shows 400 ValidationException
  • The error contains Extra inputs are not permitted
  • The error points to cache_control.scope, cache_control, scope, or another extra request field
  • The API key, balance, and model ID look correct, but Claude Code is rejected before a normal model response
This error is usually a request-field compatibility issue. It does not automatically mean the account balance, model permission, or API key is wrong. Disable experimental beta request fields before rotating keys.

Steps To Fix

1

Stop the current Claude Code process

If Claude Code is already running, exit it first. The environment variable must be present before Claude Code starts.
2

Export the compatibility setting

Run this in the same terminal where you will start Claude Code:
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
3

Start Claude Code again

Start Claude Code from the same terminal:
claude
If the 400 error disappears, the issue was likely caused by Claude Code experimental beta fields being rejected by the AWS Claude / Bedrock route.

Persistent settings.json Configuration

To avoid setting the variable every time, add it to ~/.claude/settings.json:
{
  "env": {
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
If ~/.claude/settings.json already contains your LaoZhang API base URL, token, and model, merge the new key into the existing env object instead of replacing the file:
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.laozhang.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-laozhang-api-key",
    "ANTHROPIC_MODEL": "claude-sonnet-4-6",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
Do not share screenshots that expose the full ANTHROPIC_AUTH_TOKEN, API key, or AccessToken. If support needs the configuration, send a masked version plus the full error text.

Why This Fix Works

Some Claude Code versions may add experimental beta fields to the request body. The AWS Claude official route or Bedrock-related route may strictly validate the payload and reject unsupported fields with errors such as:
  • 400 ValidationException
  • Extra inputs are not permitted
  • Errors related to cache_control.scope
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 tells Claude Code not to send those experimental beta request fields, making the request shape closer to what the route accepts. This setting fixes field compatibility only; it does not replace checks for model access, balance, API key validity, or model ID correctness.

If The Error Continues

  1. Restart the terminal or restart Claude Code after changing the setting.
  2. Check that CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS is under the top-level env object in ~/.claude/settings.json.
  3. Update Claude Code to the current available version and retry.
  4. Confirm that the model ID is still available in the console.
  5. Make sure you are using a LaoZhang API key and a token group that works with Claude Code.
  6. Check usage logs to see whether the failure is request validation, model access, or balance related.

Still Need Help

If disabling experimental beta fields does not fix the issue, send support:
  • Account email or username
  • Claude Code version
  • Operating system and terminal type
  • Model ID
  • Whether the AWS Claude official route is being used
  • Full error text, especially the field name after ValidationException
  • Request time, status, and Request ID from LaoZhang API usage logs
  • A masked ~/.claude/settings.json, without the full API key or AccessToken