[BUG] Claude Code Alters ANTHROPIC_API_KEY when it should not
Resolved 💬 2 comments Opened Jun 13, 2025 by marty-sullivan Closed Jun 13, 2025
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ X] Other: LiteLLM + Bedrock
- Claude CLI version: 1.0.22
- Operating System: macOS 15.5
- Terminal: macOS zsh
- Environment:
ANTHROPIC_BASE_URL set to a LiteLLM proxy endpointANTHROPIC_API_KEY set to LiteLLM proxy API keyCLAUDE_CODE_USE_BEDROCK=TrueCLAUDE_CODE_SKIP_BEDROCK_AUTH=True
Bug Description
When passing ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL via the environment, claude code for some reason prepends sk-ant to the value passed in with ANTHROPIC_API_KEY. This obviously breaks
Steps to Reproduce
- Set
ANTHROPIC_API_KEYin environment - Run Claude Code with empty configuration
- Claude Code will display with
sk-ant-automatically prepended to whatever is in the environment variable with no way to remove it:
Detected a custom API key in your environment │
│ │
│ ANTHROPIC_API_KEY: sk-ant-...-abcdefg123456 │
│ │
│ Do you want to use this API key? │
│ │
│ 1. Yes │
│ ❯ 2. No (recommended)✔ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Enter to confirm ․ Esc to cancel
Expected Behavior
Claude Code should not alter the value in ANTHROPIC_API_KEY in any way and pass it exactly as entered.
Actual Behavior
Claude Code alters the value in ANTHROPIC_API_KEY with no way to change it
Additional Context
N/A
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗