[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:
- Claude CLI version: 1.0.11
- Operating System: macOS 15.0.1
- Terminal: iTerm2 / Jetbrains
Bug Description
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
The usage is charged against the API key
Actual Behavior
Claude Code continues using Claude Subscription instead of the provided API key
Additional Context
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.
Thanks for the report - we have repro on this and are working through this along with the other login-related issues (see #1582).
@dvarnai if you have a preference on the UX for handling these conflicts (see most recent comment on last issue), feel free to chime in!
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.