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 tokens were spent on cache reads, which are necessary but uncontrollable. 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 when working with the Claude AI assistant, which can help users save costs and improve their productivity.

Key Points

  • 197% of tokens were spent on cache reads, which are necessary but uncontrollable
  • 2Only 2.8% of tokens were spent on controllable actions like creating prompts and providing input
  • 3Identified issues like long sessions without /compact, excessive subagent calls, and high Bash usage
  • 4Made changes like using /compact more often, avoiding Agent for codebase searches, and scheduling heavy sessions during off-peak hours

Details

The author used the Claude AI assistant extensively for building trading bots, automation tools, and side projects. After 187 sessions totaling 3.3 billion tokens ($6,744 equivalent API cost), they found that the majority of the tokens were spent on cache reads, which are necessary for the assistant to maintain context but cannot be directly controlled by the user. Only 2.8% of the tokens were spent on controllable actions like creating prompts, loading system prompts, and providing input. The analysis also revealed issues like long sessions without using /compact, excessive subagent calls, and high Bash usage, all of which contributed to unnecessary token consumption. Based on these insights, the author made changes like using /compact more often, avoiding the Agent tool for codebase searches, and scheduling heavy sessions during off-peak hours, which helped reduce the number of anomaly sessions burning tokens at a higher rate.

Like
Save
Read original
Cached
Comments
?

No comments yet

Be the first to comment

AI Curator - Daily AI News Curation

AI Curator

Your AI news assistant

Ask me anything about AI

I can help you understand AI news, trends, and technologies