Environment Variables & API Keys

ANTHROPIC_API_KEY Inheritance

Anthropic recently changed how Claude Code handles API keys. If you have an ANTHROPIC_API_KEY in your .env file, Claude Code will automatically inherit and use that API key instead of your signed-in account credentials.

What This Means

  • If you’re signed into Claude Code with a Pro or Max plan, but have an ANTHROPIC_API_KEY in 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:
echo $ANTHROPIC_API_KEY
Or check your .env file:
grep ANTHROPIC_API_KEY .env

Managing API Keys

If you want Claude Code to use your signed-in account instead of an environment API key:
  1. Remove or comment out the ANTHROPIC_API_KEY from your .env file
  2. Restart Conductor