[BUG] CLI API Key Helper execution environment does not update ANTHROPIC_BASE_URL specified in settings.json
Resolved 💬 2 comments Opened Feb 19, 2026 by ablack-jpl Closed Mar 20, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When Claude Code CLI invokes an apiKeyHelper specified in a settings.json file and an ANTHROPIC_BASE_URL is specified in the settings.json file, the key helper execution environment does not include the ANTHROPIC_BASE_URL value from the settings.json file.
What Should Happen?
Claude Code should include the ANTHROPIC_BASE_URL variable in the environment of the specified key helper.
Error Messages/Logs
Steps to Reproduce
Claude CLI will not work properly with these settings, but will generate an output file that shows the problematic behavior.
- Prepare your environment with any ANTHROPIC_BASE_URL:
````
export ANTHROPIC_BASE_URL=BASEENV
````
- Create a .claude/settings.json file with a key helper and :
{
"apiKeyHelper": "printenv | grep ANTHROPIC > helper.env",
"env": {
"ANTHROPIC_BASE_URL": "JSON"
}
}
````
3. Invoke Claude Code CLI. The output helper.env file will show "BASEENV" instead of the desired "JSON"
### Claude Model
Not sure / Multiple models
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.47
### Platform
AWS Bedrock
### Operating System
macOS
### Terminal/Shell
Terminal.app (macOS)
### Additional Information
Other env variables in settings.json seem to override just fine. And this works as expected in the VSCode plugin.This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗