跳到正文
DEV Community· Raunak Pathak·· 6 小時前AI 評分60

Claude Code 帳單與使用配額是兩個不同問題

Your Claude Code bill and your Claude Code quota are two different problems

AI 導讀

Raunak Pathak 指出,Claude Code 的 API 費用估算與 Pro、Max 訂閲方案的使用配額是兩個不同問題,後者應從使用習慣排查。他列出休息後提示詞快取過期、常駐上下文、子智能體並行及工作階段中途切換模型等用量來源,並建議離開前使用 /compact 或 /clear、以 /context 檢查上下文及用 /mcp 關閉未使用的伺服器。

正文

Raunak Pathak

(Written with AI help and edited by me.)

A lot of the token tools for Claude Code answer one question: what would this have cost on the API? That's useful if you pay per token. But most people I see complaining on r/ClaudeCode are on Pro or Max, and their question is different: why did I hit my 5-hour or weekly limit so fast, and what do I change?

Those need different answers.

Cost view vs quota view

  • Cost view: sums input, output and cache tokens per session and multiplies by API prices. Great for budgeting API spend.
  • Quota view: looks at which habits made usage pile up: cold cache rebuilds after a break, big always-loaded context, subagent fan-out, mid-session model switches. Anthropic doesn't publish exactly how each token type counts against plan limits, so the useful output is a ranked list of habits to change, not a dollar figure.

The usual culprits I found in my own logs

  1. Resuming after a break. The prompt cache expires, so the next turn re-reads the whole context at full price. /compact or /clear before you step away helps.
  2. Always-loaded context. CLAUDE.md and every MCP tool definition ride along on every turn. /context shows how much; /mcp lets you switch off servers you aren't using.
  3. Subagents. Each one runs its own context. Five parallel subagents is roughly five sessions' worth of reading.
  4. Model choice and switches. Routine edits on Sonnet, save Opus for the hard parts, and pick the model at the start of a session: switching mid-session makes the next request re-read the whole history uncached.

Checking your own logs

Session transcripts are JSONL files under ~/.claude/projects. You can sum them yourself, use ccusage for a cost-style view, or run my free CLI, cc-quota-doctor, which focuses on the quota side: https://github.com/raunakpathak20/cc-quota-doctor-

It runs locally with no network calls. It reads those transcript files plus your CLAUDE.md files, to estimate how much always-loaded context you carry.

There's also an optional paid Pro kit linked in the README (ready-made templates, hooks and a playbook), but the free tool works fine on its own.

來源:DEV Community · dev.to