Stored primaryApiKey silently overrides an active Max subscription; "no usage credits" error gives no cause

Status Open
Maintainer reply None cached
Activity 1 comment · opened Jul 23, 2026

What happened: With an active Claude Max subscription, Claude Code kept showing "you don't have usage credits." Root cause was a stored primaryApiKey (sk-ant-…) in ~/.claude.json — not an env var, not in settings.json. Claude Code prioritized that key and billed Console pay-as-you-go credits instead of the subscription. When the Console balance reached $0, the error appeared, even though the subscription was fully active. It surfaced after logging in on a second machine (laptop while traveling); the desktop then showed the same state.

Impact: The error gives no indication that (a) a stored API key is in use, or (b) an active subscription exists but isn't being billed. This led me to purchase Console credits I didn't need.

Expected:

  • When a paid subscription is available, don't silently prefer a stored API key — or at minimum surface which account/wallet is being billed.
  • The "no usage credits" error should name the active auth method and note if a subscription is available (e.g., "Billing against API key / Console credits. You also have a Max subscription — run /login to switch.").
  • /status is currently the only way to discover the active auth mode; that info belongs in the error itself.

Workaround: Remove primaryApiKey from ~/.claude.json (or /logout), then /login → "Claude account with subscription," verify with /status.

Environment: Claude Code on Windows 11.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗