Analyzing 187 Claude Code Sessions: Where the Tokens Went
The author analyzed their usage of the Claude AI assistant and found that 97% of their 3.3 billion tokens were used for cache reads, which are cheap but unavoidable. They share insights on optimizing token usage, such as using /compact more often and avoiding heavy sessions during peak hours.
Why it matters
This analysis provides valuable insights into optimizing token usage for the Claude AI assistant, which can help users better manage their costs and quota.
Key Points
- 197% of tokens were used for cache reads, which are cheap but unavoidable
- 2Only 2.8% of tokens were controllable, mostly for cache creation and Claude's output
- 3Identified issues like long sessions without /compact and excessive subagent calls
- 4Made changes like using /compact more often and avoiding peak hours for heavy sessions
Details
The author used the Claude AI assistant extensively for building trading bots, automation tools, and side projects. They decided to analyze their usage and found that they had 187 sessions, consuming 3.3 billion tokens worth $6,744 in API costs (though the author is on a Max plan and not paying per token). Surprisingly, 97% of the tokens were used for cache reads, which are cheap but unavoidable as Claude re-reads the entire conversation context for each turn. Only 2.8% of the tokens were actually controllable, with 92.5% used for cache creation, 6.6% for Claude's output, and 0.9% for the author's input. The analysis also revealed issues like 86 sessions over 30 turns without using /compact, 840 subagent calls duplicating the full conversation context, and Bash commands making up 40% of all tool calls. The author made changes like using /compact more often, avoiding Agent for codebase searches, and trying to keep heavy sessions out of peak hours, which has reduced the number of anomaly sessions.
No comments yet
Be the first to comment