跳到正文
DEV Community· Eren Çolak·· 3 小時前AI 評分65

Claude Code 用量為何快速耗盡,以及如何找出用量來源

Why Claude Code usage runs out so fast, and what is using it

AI 導讀

Claude Code 的工作階段或每週用量可能因長對話反覆提交上下文、快取未命中、排程任務、跨工作階段訊息及子智能體等而快速增加;文章整理八項成因和相應處理方法。

正文

Hitting your session or weekly limit sooner than your activity suggests is one of the most common complaints about Claude Code. The cause is usually not one big thing: a session that has been open for hours spends far more than the work you typed into it. Anthropic's cost documentation (checked 21 October 2026) lists the usual reasons. This guide goes through them, then shows how to find which one is yours.

Find out first: /usage

Before changing habits, look. On a Pro, Max, Team or Enterprise plan, /usage shows your plan limits and a breakdown of what counts against them:

  • Attribution: recent usage attributed to skills, subagents, plugins and individual MCP servers, each as a share of the total.
  • Behavior flags: long context or cache misses, flagged when one accounts for 10% or more of recent usage, each with a tip.
  • Loops: your heaviest /loop and other scheduled tasks, by total tokens (newer versions of Claude Code).

Press d or w to switch between the last 24 hours and 7 days. The figures are approximate and come from the session history on that machine, so usage from other devices or claude.ai is not in them. Newer versions also add a prompt cache line to the Session block, showing the share of input served from cache and how many misses there were.

Eight reasons usage climbs

These are the causes the documentation names for a long session using more of your limit than it seems to deserve.

1. A long conversation is re-read on every request

Claude Code sends your whole conversation with each request, and every round of tool use sends it again with the results. Prompt caching re-reads that history at the cheaper cached rate, but a one-line question at the end of a day-long session still draws on the entire conversation. Fix: run /clear when you switch to unrelated work (use /rename first and /resume later if you want to come back), and /compact with instructions about what to keep when you need continuity.

2. Cache misses after a break

Your first message after a pause longer than the cache lifetime misses the cache and reprocesses the whole context at full rate. Fix: if you know you are done with a session for a while, start fresh later rather than resuming a huge context after the break.

3. Scheduled tasks keep firing

A /loop or other session-scoped scheduled task fires on its interval even while the session is idle, sending the full context each time. Fix: check the Loops rows in /usage and stop tasks you forgot.

4. Messages from your other sessions

When another of your sessions sends a message to an idle one, it starts a new turn that sends the full context. The crossSessionInbound setting can be set to hold to keep inbound messages from being delivered.

5. Goal check-ins

While background work keeps an active goal waiting, Claude Code can start idle check-ins, each a new turn with your full context. Recent versions cap them at three per goal between your prompts; CLAUDE_CODE_GOAL_CHECKIN_MINUTES=0 turns them off.

6. Subagents and workflows

Every subagent, and every agent a workflow spawns, sends its own requests on top of the main conversation's. The attribution breakdown in /usage shows their share. Fix: give simple subagent tasks a smaller model (model: haiku in the subagent's configuration), and keep verbose work such as running tests in a subagent so only a summary returns.

7. Agent teams

Each active teammate keeps its own context window and keeps consuming tokens until it exits. The documentation says teams use roughly seven times the tokens of a standard session when teammates run in plan mode. Fix: keep teams small, give them focused tasks and shut teammates down when their work is done.

8. Compaction is a big request too

/compact has to read the conversation it summarizes, so compacting a large context is itself a large request. When you want a clean start rather than continuity, /clear costs nothing.

Smaller levers

  • Model and effort. Sonnet handles most coding tasks for less than Opus; switch with /model. Lower the effort level with /effort for simple tasks.
  • MCP servers. Run /context to see what fills your context and /mcp to disable servers you are not using.
  • A big CLAUDE.md. It loads at the start of every session. Anthropic suggests moving workflow-specific instructions into skills, which load only when used, and keeping CLAUDE.md under 200 lines.
  • Vague prompts. "Improve this codebase" triggers broad scanning; naming the file and the change does not.
  • Plan mode and early course-correction. Press Shift+Tab for plan mode before big changes, and Esc as soon as Claude heads the wrong way.

When you run several sessions

Every session draws on the same allowance, each with its own conversation, so four sessions spend it faster than one, and a long-lived one spends more than a fresh one. /usage works per machine, not per session. Paneherd shows the five-hour and weekly figures at the top of its sidebar and estimates each open pane's approximate share of the current window from its transcript, so the heavy session stands out. It also flags a pane that repeats the same failing call, which spends usage and gets nothing done. The shares are an estimate based on Paneherd's own weights, not Anthropic's accounting. More in how parallel sessions use your usage limits.

Keep the numbers in view

If you only want the limits in front of you, without a sidebar or panes, the free Claude Code & Codex Usage Meter puts the five-hour and weekly percentages, and Codex's, in the VS Code status bar and warns at 85% by default. It reads what Claude Code and Codex already report on your computer and sends nothing anywhere.

Install Paneherd free


Originally published at paneherd.com/guides/claude-code-usage-running-out-fast. I make Paneherd, a VS Code extension for running coding agents side by side.

來源:DEV Community · dev.to