
ANTHROPIC_API_KEY Inheritance
Anthropic recently changed how Claude Code handles API keys. If you have anANTHROPIC_API_KEY in your .env file, Claude Code will automatically inherit and use that API key instead of your signed-in account credentials.
This behavior can frequently come as a surprise. If you’d like to see a fix, please upvote our GitHub issue: anthropics/claude-code#12047.
What This Means
- If you’re signed into Claude Code with a Pro or Max plan, but have an
ANTHROPIC_API_KEYin your environment, Claude Code will use the API key instead of your subscription - This can result in unexpected API usage charges if the API key is connected to a pay-per-use account
- Your subscription benefits (higher rate limits, priority access) won’t apply when using the environment API key
Check Your Environment
To see if you have an API key set in your environment:.env file:
Managing API Keys
If you want Claude Code to use your signed-in account instead of an environment API key:- Remove or comment out the
ANTHROPIC_API_KEYfrom your.envfile - Restart Conductor
