π Bug Report: Double Billing on API-Based Login
Summary
Users on API-based billing (pay-per-usage) are being charged twice for every request β once via API billing (correct) and once via prepaid credits (incorrect).
π Related Issues
This issue has been reported multiple times but remains unresolved:
| Issue |
Title |
Relevance |
| #20976 |
"Max plan shows as API Usage Billing" |
EXACT same issue |
| #7719 |
"API credits consumed despite Pro subscription" |
Same dual-billing pattern |
| #5300 |
"PRO account shows Credit balance too low" |
Credit depletion on paid plans |
π Evidence: Billing Proof
Test Session 1 (15 minutes of usage):
| Metric |
Before |
After |
Change |
| Prepaid Credits |
$1.53 |
$1.12 |
-$0.41 β |
| API Usage |
$8.71 |
$9.12 |
+$0.41 β
|
Test Session 2 (with forceLoginMethod: "console"):
| Metric |
Before |
After |
Change |
| Login managed API key |
$0.00 |
$0.26 |
+$0.26 |
| Prepaid Credits |
$4.84 |
$4.58 |
-$0.26 β |
Result: Exact dual charge β same amount charged to both payment methods even with forceLoginMethod set.
π Steps to Reproduce
- Have API billing enabled ($100/month limit)
- Log in to Claude Code using API-based billing (pay-per-usage)
- Use Claude Code for 10-15 minutes
- Check both:
Result: Both show charges for the same usage (approximately equal amounts)
β
Expected Behavior
- β
Only API usage increases
- β
Prepaid credits remain unchanged
- β
Single billing method
β Actual Behavior
- β Both prepaid AND API usage increase
- β Same usage charged twice
- β Prepaid balance can go negative
π Root Cause Analysis (Suspected - Unconfirmed)
We suspect (but cannot confirm) this may be related to an authentication split:
Suspected Issue:
- Main Claude Code process: Uses API key β API Usage Billing β
- MCP OAuth servers: Use OAuth tokens from
.credentials.json β Prepaid Credits β
β Failed Fix Attempts
| Attempt |
Action |
Result |
| 1 |
Delete ~/.claude/.credentials.json |
OAuth tokens regenerated automatically β |
| 2 |
Set "enableAllProjectMcpServers": false |
OAuth tokens still regenerated β |
| 3 |
Empty OAuth credentials manually |
Full OAuth configs restored from plugin files β |
| 4 |
Set "forceLoginMethod": "console" in settings.json |
Dual billing still occurs β |
| 5 |
Export ANTHROPIC_API_KEY in ~/.zshrc |
Key shows "Never used" - Claude Code ignores it and uses login managed key β |
| 6 |
Run /logout and restart |
Still charges both API key AND prepaid credits β |
Key Finding from Attempt 4-6:
Even with forceLoginMethod: "console" configured:
- Claude Code shows "API Usage Billing" in status bar β
- Login managed API key is charged β
- Prepaid credits STILL consumed β (same amount deducted from both)
- Environment variable
ANTHROPIC_API_KEY is completely ignored
Why Client-Side Fixes Don't Work:
- Official plugins are closed-source
- OAuth server URLs are hardcoded in plugin code
- No API key configuration option exists for plugins
- Plugins auto-load and override manual credential changes
forceLoginMethod doesn't prevent OAuth-based charges
π₯ Impact
| Impact Area |
Description |
| π° Financial |
Users charged 2x for requests |
| π Silent Failure |
No warning before credit depletion |
| β οΈ Negative Balance |
Users hit -$0.21 without ever buying credits |
| π Trust |
Unexpected charges erode user confidence |
π Environment
- OS: macOS (likely affects all platforms)
- Claude Code Version: v2.1.31 (Feb 2026)
- Billing Type: API-based billing (pay-per-usage via console.anthropic.com)
- API Key: Configured in
~/.zshrc as ANTHROPIC_API_KEY
- Settings:
forceLoginMethod: "console" in ~/.claude/settings.json
- Regression Started: ~February 2-3, 2026
- Frequency: 100% reproducible
π Requested Fix
- Immediate: Audit billing routing to identify why dual charges occur
- Root Cause: Ensure API billing users are only charged via API billing
- Refund: Consider refunding incorrectly charged prepaid credits for affected users
Potential Solutions (for Anthropic team to evaluate):
- Option 1: Make OAuth MCP servers use API billing when API key is present
- Option 2: Allow API key auth for official plugins instead of OAuth
- Option 3: Skip prepaid charges for OAuth requests when API billing is enabled
π Additional Notes
- This is a regression β worked correctly before Feb 2-3, 2026
- Possibly related to Jan 2026 platform changes that restricted OAuth tokens to Claude Code only
- The issue is server-side β no client-side workaround available
- Only working workaround: Uninstall OAuth-based plugins (but loses valuable integrations)
π Additional Issue: Broken /login Flow
When running /login command and selecting "Anthropic Console account β’ API usage billing":
Expected: Should provide an API key token to copy for authorization
Actual: Redirects to "Buy credits to get started" page
This indicates the system is incorrectly routing API billing users through the credits purchase flow instead of the API key authorization flow.
π Bug Report: Double Billing on API-Based Login
Summary
Users on API-based billing (pay-per-usage) are being charged twice for every request β once via API billing (correct) and once via prepaid credits (incorrect).
π Related Issues
This issue has been reported multiple times but remains unresolved:
π Evidence: Billing Proof
Test Session 1 (15 minutes of usage):
Test Session 2 (with forceLoginMethod: "console"):
Result: Exact dual charge β same amount charged to both payment methods even with forceLoginMethod set.
π Steps to Reproduce
Result: Both show charges for the same usage (approximately equal amounts)
β Expected Behavior
β Actual Behavior
π Root Cause Analysis (Suspected - Unconfirmed)
We suspect (but cannot confirm) this may be related to an authentication split:
Suspected Issue:
.credentials.jsonβ Prepaid Credits ββ Failed Fix Attempts
~/.claude/.credentials.json"enableAllProjectMcpServers": false"forceLoginMethod": "console"in settings.jsonANTHROPIC_API_KEYin~/.zshrc/logoutand restartKey Finding from Attempt 4-6:
Even with
forceLoginMethod: "console"configured:ANTHROPIC_API_KEYis completely ignoredWhy Client-Side Fixes Don't Work:
forceLoginMethoddoesn't prevent OAuth-based chargesπ₯ Impact
π Environment
~/.zshrcasANTHROPIC_API_KEYforceLoginMethod: "console"in~/.claude/settings.jsonπ Requested Fix
Potential Solutions (for Anthropic team to evaluate):
π Additional Notes
π Additional Issue: Broken
/loginFlowWhen running
/logincommand and selecting "Anthropic Console account β’ API usage billing":Expected: Should provide an API key token to copy for authorization
Actual: Redirects to "Buy credits to get started" page
This indicates the system is incorrectly routing API billing users through the credits purchase flow instead of the API key authorization flow.