x-api-key header dropped when using CLAUDE_CODE_SKIP_BEDROCK_AUTH + custom ANTHROPIC_BEDROCK_BASE_URL (regression in v2.1.228)
Summary
Since v2.1.228, Claude Code no longer sends the x-api-key header on model-invoke requests when using a Bedrock-compatible proxy (CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 + ANTHROPIC_BEDROCK_BASE_URL pointing at a non-AWS endpoint, e.g. an internal LiteLLM proxy). v2.1.227 and earlier send the header correctly. The proxy then rejects the request with 401 Authentication Error, No api key passed in.
Environment
- CLAUDE_CODE_SKIP_BEDROCK_AUTH=1
- CLAUDE_CODE_USE_BEDROCK=1
- ANTHROPIC_BEDROCK_BASE_URL=https://<internal-litellm-proxy>/bedrock
- ANTHROPIC_API_KEY=<proxy-issued key>
- ANTHROPIC_MODEL=us.anthropic.claude-sonnet-5
Versions tested
- v2.1.226, v2.1.227: OK —
x-api-keyheader present on POST /model/.../invoke-with-response-stream - v2.1.228, v2.1.229: broken — same request has NO
x-api-keyheader at all (all other headers identical)
How I verified
Ran the actual platform binaries from @anthropic-ai/claude-code-darwin-arm64@2.1.227 and @2.1.228 against a local dummy HTTP server (in place of ANTHROPIC_BEDROCK_BASE_URL) and diffed the captured request headers directly. Confirmed the x-api-key header is simply absent in 2.1.228, not malformed.
Also noticed the bundled Anthropic SDK version jumped between these builds (X-Stainless-Package-Version: 0.94.0 → 0.112.1), suggesting the regression was introduced by that SDK bump rather than a claude-code-specific change.
Expected
x-api-key should still be sent when CLAUDE_CODE_SKIP_BEDROCK_AUTH is set with a custom ANTHROPIC_BEDROCK_BASE_URL, same as v2.1.227 behavior.
Workaround
Pin to v2.1.227 via npx @anthropic-ai/claude-code@2.1.227.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗