[BUG] [Billing]
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Title: Runaway input token consumption via Claude Code CLI — extreme input/output ratio depleting API credits during active sessions
Environment
- OS: Linux Mint 22.2 Cinnamon
- Claude Code CLI (latest)
- API key: newly created April 6, 2025
- Correlated Anthropic incident: "Elevated errors on Claude.ai" — April 6, 15:00–16:30 UTC
---
Description
Claude Code CLI is generating extreme input token consumption with a wildly disproportionate input/output ratio across two separate sessions, depleting API credits and resulting in a negative account balance.
Incident 1 (April 6, during/after documented Anthropic service incident)
- Total tokens in: 29,969,665
- Total tokens out: 406,386
- Ratio: ~74:1
- Account balance: moved from +$8.46 to -$13.23
Incident 2 (April 7, active working session, balance monitored in real time)
- Total tokens in: 5,626,102
- Total tokens out: 32,215
- Ratio: ~175:1
- Balance dropped from $13.76 to $10.10 during a single normal working session
Both incidents occurred after a new API key was created on April 6. Prior to the new key, usage was normal.
---
Expected behaviour
A typical Claude Code agentic session should produce an input/output ratio in the range of 5:1 to 15:1. The context resending architecture means input tokens are always higher than output, but a 74:1 or 175:1 ratio is not consistent with any normal usage pattern.
---
Actual behaviour
Each API call appears to be resending a massively inflated context — likely a compounding loop where accumulated conversation history and/or project file context grows unbounded across tool calls, with every subsequent call resending the entire inflated context.
The issue appears triggered or exacerbated by:
- New API key creation
- Concurrent Anthropic service incident causing elevated errors and likely retry loops
- No token limit or context size cap enforced by Claude Code per session
---
Impact
- API account depleted and driven negative
- Account blocked, development environment offline
- Forced to manually disable API key to stop consumption
- Commercial business operations interrupted across two separate days
- Support ticket raised (ref: 215473797766657) — no resolution at time of filing this issue
---
Steps to reproduce
- Create a new Anthropic API key
- Configure Claude Code CLI with the new key
- Start an agentic working session involving multiple tool calls
- Monitor token usage in platform.claude.ai console in real time
- Observe input token consumption at 50–175x the output token count
---
Suggested fix / mitigation
- Enforce a configurable max context size per session in Claude Code
- Add a
--max-input-tokensflag to cap context resending per call - Implement a warning or hard stop when input/output ratio exceeds a configurable threshold
- Investigate whether new API key initialisation triggers a context inflation event
---
Additional context
The April 6 Anthropic service incident ("Elevated errors on Claude.ai", 15:00–16:30 UTC) likely compounded this issue through retry loops during the elevated error window. However Incident 2 occurred on April 7 after the incident was resolved, confirming this is not solely incident-related.
Support ticket: 215473797766657
Account: Alpha2Zulu LLC
What Should Happen?
Expected behaviour
A typical Claude Code agentic session should produce an input/output ratio in the range of 5:1 to 15:1. The context resending architecture means input tokens are always higher than output, but a 74:1 or 175:1 ratio is not consistent with any normal usage pattern.
Error Messages/Logs
Steps to Reproduce
Steps to reproduce
- Create a new Anthropic API key
- Configure Claude Code CLI with the new key
- Start an agentic working session involving multiple tool calls
- Monitor token usage in platform.claude.ai console in real time
- Observe input token consumption at 50–175x the output token count
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.92
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
Additional context
The April 6 Anthropic service incident ("Elevated errors on Claude.ai", 15:00–16:30 UTC) likely compounded this issue through retry loops during the elevated error window. However Incident 2 occurred on April 7 after the incident was resolved, confirming this is not solely incident-related.
Support ticket: 215473797766657
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗