claude-code - 💡(How to fix) Fix [BUG] Excessive token usage (~20k–30k tokens) for trivial prompts in Claude Code CLI [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52979Fetched 2026-04-25 06:15:39
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
0
Timeline (top)
commented ×3labeled ×3cross-referenced ×1

Error Message

Error Messages/Logs

No explicit error messages.

Code Example

No explicit error messages.

Observed via:
- Claude Code verbose mode token display (~19k–31k tokens per trivial prompt)
- ccusage showing very high cache read tokens

Example:
Prompt: "hi"
Observed tokens: ~31,000
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Excessive token usage for trivial prompts in Claude Code CLI.

In a completely clean environment (empty folder, no repository, no CLAUDE.md), very simple prompts are consuming tens of thousands of tokens.

<img width="1108" height="501" alt="Image" src="https://github.com/user-attachments/assets/1058578f-3dea-4bb5-a7a5-879d7ef82d12" /> <img width="1101" height="701" alt="Image" src="https://github.com/user-attachments/assets/1a49bafc-6a56-414d-824a-5c78d8fefba5" />

Examples:

  • Prompt: "hi" → ~31,000 tokens
  • Prompt: "what colour is the sky?" → ~19,000 tokens

This occurs consistently even in a fresh session using:

  • claude --verbose
  • different models (sonnet-4.6, haiku-4.5)
  • different effort levels (low/medium)

Expected behavior: Simple prompts should use ~50–200 tokens.

Actual behavior: There appears to be a large fixed token overhead (~20k–30k tokens) per request, even with no files or tools involved.

Impact: This significantly increases cost and makes the CLI impractical for lightweight usage.

Additional notes:

  • Issue reproducible in empty directory (C:\claude-clean)
  • No repo, no agents, no commands executed
  • ccusage shows very high cache read tokens for these simple prompts

This suggests excessive system prompt/context injection or a context/caching issue where tokens are not being trimmed properly.

What Should Happen?

For trivial prompts (e.g. "hi" or "what colour is the sky?"), Claude Code should use a minimal number of tokens (~50–200).

There should not be a large fixed baseline token overhead per request in a clean environment with no files, tools, or context.

Token usage should scale with the size and complexity of the prompt.

Error Messages/Logs

No explicit error messages.

Observed via:
- Claude Code verbose mode token display (~19k–31k tokens per trivial prompt)
- ccusage showing very high cache read tokens

Example:
Prompt: "hi"
Observed tokens: ~31,000

Steps to Reproduce

  1. Create an empty folder (e.g. C:\claude-clean)
  2. Open terminal and navigate to the folder
  3. Run: claude --verbose
  4. Enter: "hi"
  5. Observe token usage in the top-right (~30k tokens)

Repeat with:

  • "what colour is the sky?"
  • different models (haiku, sonnet)
  • different effort levels

Result is consistent across all tests.

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Earlier versions (and API/chat usage) showed ~50–200 tokens for trivial prompts. Exact CLI version unknown.

Claude Code Version

2.1.119 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

  • Issue occurs in completely empty directory with no repository or CLAUDE.md
  • No tools or commands are executed during tests
  • Token usage is consistently high (~20k–30k) regardless of prompt size
  • ccusage shows extremely high cache read tokens for simple prompts
  • Suggests large fixed system prompt or context not being trimmed properly

This makes Claude Code significantly more expensive for simple interactions compared to expected usage.

extent analysis

TL;DR

The issue can be mitigated by investigating and optimizing the system prompt or context injection that seems to be causing a large fixed token overhead per request.

Guidance

  • Verify the issue by running the claude --verbose command with simple prompts and observing the token usage to confirm the excessive token consumption.
  • Investigate the ccusage output to understand the cache read tokens and identify potential areas of optimization.
  • Test the issue with different models (e.g., haiku, sonnet) and effort levels to see if the problem persists across various configurations.
  • Consider reaching out to the Anthropic API support or the Claude Code community to report the issue and gather more information about potential fixes or workarounds.

Example

No code snippet is provided as the issue seems to be related to the underlying system or API behavior rather than a specific code implementation.

Notes

The issue appears to be a regression, and the exact cause is unclear. Further investigation is needed to determine the root cause and develop a permanent fix.

Recommendation

Apply a workaround by optimizing the system prompt or context injection, as this seems to be the most likely cause of the issue. This may involve collaborating with the Anthropic API support or the Claude Code community to identify the best approach.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING