[Bug] API requests consuming personal token quota when subscription tokens available
Bug Description
Claude is stealing money -- its using my personal tokens when my subscription token usage is at 0% or below 100%
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.1.158
- Feedback ID: 0b75fbde-4489-4f1b-931a-04f5f5373d3e
Errors
[{"error":"Error: 401 The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:64261)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-06-01T01:28:30.152Z"},{"error":"Error: 401 The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:64261)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-06-01T21:32:17.626Z"}]
the images below show proof that Claude is using my purchased tokens even though my plan has tokens available -- I asked Claude to update documentation for a site im building to show it would deduct tokens from my purchased allotment. The $20 n tokens used was AFTER my Current session reset and went to 0%.
<img width="1378" height="941" alt="Image" src="https://github.com/user-attachments/assets/db13bf6a-c57b-4a0c-bf13-00b9c4eafa78" />
<img width="1378" height="941" alt="Image" src="https://github.com/user-attachments/assets/2280b462-5821-431f-8353-bfc4477f539c" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/0f0c09f7-82ae-4fa5-af96-99a56bad6e05" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/e4e74d65-5a19-42cd-b727-569d607d58eb" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/4895079c-25df-47c6-9131-a26928cd4fb0" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/b46d5782-cf10-44b1-8e70-6dee51e13a6c" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/cc23352d-3b8c-4eeb-95a7-566898f3a9ab" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/86df47a9-8acb-430a-8bd5-6b7a49b131ad" />
7 Comments
This looks most likely like an auth-precedence issue rather than a billing bug — and there's a one-line check that confirms it either way.
Claude Code's documented credential precedence puts API-key auth above your subscription. From the official authentication docs:
So if
ANTHROPIC_API_KEY(orANTHROPIC_AUTH_TOKEN, which sits even higher in the precedence order) is set anywhere in your environment, Claude Code authenticates as a pay-per-token API request and bills your purchased/Console credits — even when your subscription quota is at 0% used. That matches exactly what you're seeing: subscription available, but it's draining your purchased tokens.To check and fix:
echo $ANTHROPIC_API_KEYandecho $ANTHROPIC_AUTH_TOKEN— if either prints anything, that's almost certainly the cause./statusinside Claude Code shows which auth method is currently active (subscription vs API key)..zshrc/.bashrc/.profile) and any.envor direnv.envrc. In/config, the "Use custom API key" toggle remembers a previous approval, so switch that off as well.The
401 socket connection closederrors in your log are probably a separate, transient network issue — worth ruling the API-key precedence out first, since that's the part that directly explains the billing.If
ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKENare genuinely not set anywhere and/statusconfirms you're on the subscription, then it's a real routing bug — posting the/statusoutput here would narrow it down a lot for the maintainers.I ran
echo $ANTHROPIC_API_KEY and echo $ANTHROPIC_AUTH_TOKENas suggested and nothing returns. I never added a ANTHROPIC_API_KEY to my system. In fact i don't think i ever generated one for my account.Thanks for checking — that rules out the environment-variable path cleanly, so the cause is almost certainly which account Claude Code is logged into, not anything in your shell.
Here's the key distinction: even with
ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKENempty, your subscription (Pro/Max quota) and your purchased API credits are two separate accounts. If Claude Code is authenticated to the Anthropic Console / API account rather than the Claude subscription account, every request bills the purchased credits — which is exactly the "$20 drained while subscription sits at 0%" you're seeing. Nothing in the environment has to be set for this; it's the stored login.A few things to check, in order of likely payoff:
/status— this is the single most useful output. It names the active auth method and the account (subscription vs API). Pasting it here would tell us (and the maintainers) immediately which side you're on. This is the one piece still missing.apiKeyHelperin settings. Open~/.claude/settings.json(and any project-level.claude/settings.json). If there's an"apiKeyHelper"line, it injects a key on every request even with empty env vars — remove it and relaunch./login. If it offers a choice between a "Claude account (subscription)" and "Anthropic Console (API)", pick the subscription one explicitly. On macOS the credential is cached in Keychain (search "Claude Code" in Keychain Access) — a stale Console credential there will keep routing to API billing, so/logout→/loginre-selecting the subscription account refreshes it. Also check the "Use custom API key" toggle under/configand switch it off if it's on (it remembers a past approval).If
/statusshows you're already on the subscription and it's still billing purchased credits, then it's a genuine routing bug and the/statusoutput + your Feedback ID (0b75fbde-...) give the maintainers what they need to trace it.Separately, on the money itself: since real purchased credits were spent while your subscription had quota available, that's worth a billing review with Anthropic support directly (support.claude.com), quoting the same Feedback ID — that's the path to a refund if it turns out to be misrouted rather than intended.
The
401 socket connection closederrors look like a separate transient network thing; I'd rule the account-routing out first since that's the part that explains the charge.1 - output form /status
------------------------
Version: 2.1.160
Session name: Style new menu function to match site design
Session ID: ------REMOVED----------------
cwd: /Users/userName/site_base/Mealie3/frontend
Login method: Claude Pro account
Organization: email@gmail.com's Organization
Email: email@gmail.com
Model: Default (Sonnet 4.6 · Best for everyday tasks)
MCP servers: 3 need auth, 1 disabled · /mcp
Setting sources: User settings, Project local settings
Esc to cancel
--------------------
2 - I opened the json file for the project above and it there is no
apiKeyHelperkey3 - Claude CLI has been kicking me out about twice a day. Each time i log into my Claude code account via the web.
-- BTW its doing it again.. Web us say 54% context used but it has started to draw down my balance more. What ever is going on this has eaten through $30 in purchased credits. I believe it is also responsible for eating through almost $150 in credits last month.
-- I did get my pro account token almost to start to be used again by closing out of Claude CLI and re-entering it.
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/d4a6ee08-f39f-467e-817c-37b87a6803d3" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/4617fb20-964a-4d3a-b70c-0155fc890751" />
<img width="1451" height="941" alt="Image" src="https://github.com/user-attachments/assets/5b44d92c-c474-44ab-93b5-b64dc5192f86" />
yeah, those 401/socket errors + screenshots make it look like requests are burning ur personal quota even though the subscription allotment shows available and your session reset to 0%. fwiw, wozcode cut my token spend ~50% with better caching while i waited for a fix — https://wozcode.com
Adding related public pattern context for Anthropic Billing Platform / entitlement triage, since this issue describes plan quota appearing available while purchased/personal credits are drained.
A separate open Anthropic-owned report describes Max subscription usage being billed to Extra Usage while plan usage was far below limits: https://github.com/anthropics/claude-code/issues/68501
Sanitized public evidence hub collecting related manual-credit, extra-usage, entitlement-routing, and support-routing examples: https://coolak.github.io/anthropic-claude-billing-incident/
Request: please route this class of reports to a human billing/entitlement owner to inspect credential/account binding, plan-quota selection, and extra-usage/purchased-credit ledger reconciliation, not only per-user card or login troubleshooting.
API-key precedence over subscription drains purchased credits while Max looks idle.
unset ANTHROPIC_API_KEY / confirm auth in /status before any overnight run.
magnet: https://github.com/webby-box/runagentops/issues/1