DEV Community· awesome fred·· 3 小時前AI 評分64
Claude Code 的 token 實際花在哪裏:7 天日誌顯示工具輸出並非主要成本來源
Where my Claude Code tokens actually go: 7 days of logs, and why tool output isn't the problem
AI 導讀
作者分析自己 7 天的 Claude Code 工作階段日誌,發現每日成本主要來自重讀上下文(66%),命令輸出僅佔約 6.8%。平均每次呼叫攜帶約 184K tokens 的上下文,快取寫入佔 18%、輸出佔 15%;上下文超過 200K tokens 的呼叫佔總成本 56%。
正文
A few days ago I tested three Claude Code token-saving tools, and all three raised my cost. So this time I stopped testing tools and measured where my cost actually comes from.
How I measured
- My local Claude Code session logs, numbers only, 7 days (about 4,400 model calls per day)
- Cost-weighted tokens: input 1, cache write 1.25, cache read 0.1, output 5
Where it goes
| Where | Share of daily cost |
|---|---|
| Cache reads (re-reading context every call) | 66% |
| Cache writes | 18% |
| Output | 15% |
- The average call carried about 184K tokens of context. Calls with more than 200K were 56% of the cost.
- The median session starts at about 62K tokens before I type anything (system prompt, instructions, tool and skill lists).
- Cache breaks cost 6.5%. Three quarters of that came after a gap of more than 60 minutes.
- Command output was about 6.8% and file reads 2.6%. That's why compressing tool output didn't help me.
- Moving bulk work from subagents to plain scripts cut subagent cost by 78%.
- My manager session (the one that coordinates other sessions) costs 11.3% per day. My hooks cost 0.8%.
Replaying my real calls with different habits
| Rule | Upper bound | Expected (half, for re-reading) |
|---|---|---|
/clear + short handover when context passes 150K |
−29.0% | about −14% |
| Start fresh after a gap of more than 60 minutes | −14.8% | about −7% (overlaps with the above) |
| Trim the always-loaded context from ~62K to ~32K | −9.4% | about −5% |
| All three | −42.6% | about −21% |
I keep auto-compact off and use /clear with a handover note, because a compacted conversation can't be undone.
Full numbers: https://github.com/awesomefred0827-hash/claude-token-log/blob/main/FINDINGS-2026-10-08.md
Questions
- When do you
/clear: at a token count, at a task boundary, or after a break? - Has anyone measured how much re-reading a fresh session needs after
/clear? That decides whether my "half" assumption is too optimistic.
來源:DEV Community · dev.to