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

Resolved 💬 4 comments Opened Jun 5, 2025 by dvarnai Closed Dec 10, 2025

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

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

!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.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗