[BUG] API key not actually used when already logged in with Claude Subscription
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.11
- Operating System: macOS 15.0.1
- Terminal: iTerm2 / Jetbrains
Bug Description
<!-- A clear and concise description of the bug -->
API key override is ignored when already logged in with Claude Subscription.
Steps to Reproduce
- Log in with Claude Subscription
- Run Claude with API key override
- Use Claude
Expected Behavior
<!-- What you expected to happen -->
The usage is charged against the API key
Actual Behavior
<!-- What actually happened -->
Claude Code continues using Claude Subscription instead of the provided API key
Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
Claude is detecting the API key as expected:
/cost still shows that the session didn't cost anything:
Also confirmed on the Anthropic Console that usage wasn't charged against the API key.
/logout is not available when API key is provided, to log out of my subscription I had to run claude code again without API key.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗