claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] API key not actually used when already logged in with Claude Subscription

Open dvarnai opened this issue 7 months ago • 1 comments

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

  1. Log in with Claude Subscription
  2. Run Claude with API key override
  3. 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:

Image Image

/cost still shows that the session didn't cost anything:

Image

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.

dvarnai avatar Jun 05 '25 13:06 dvarnai

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!

ant-kurt avatar Jun 05 '25 19:06 ant-kurt

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.

github-actions[bot] avatar Oct 10 '25 10:10 github-actions[bot]