How to Track Claude Code Token Usage with ccusage: See Your Real Costs
I kept seeing posts about Claude Code being expensive. Then I realized: almost nobody posting those complaints had actually measured their usage. I installed ccusage and found my costs were half what I feared.
The Problem
Claude Code costs money. That’s not news. But here’s what I noticed:
- Users complain about expense without data
- No visibility into which sessions cost most
- Can’t optimize without measurements
- Anxiety about spending limits grows without facts
I was one of those users. Then I found the Reddit thread where someone said: “most ‘Claude is expensive’ posts are people who never looked at their own numbers.”
That hit home. I decided to look at my actual numbers.
The Solution: ccusage CLI
ccusage (13.2k GitHub stars, by ryoppippi) is a CLI tool that prints your token spend per Claude Code session.
What It Shows
- Token count per session
- Cost estimates per conversation
- Cumulative daily/weekly spend
- Input vs output token breakdown
Installation and Basic Usage
# Install globallynpm install -g ccusage
# Check today's usageccusage --today
# Check last sessionccusage --last
# Weekly summaryccusage --weekWhen I first ran it, the output looked like this:
Session Input Output Total Est. Costabc123 45k 12k 57k $0.85def456 32k 8k 40k $0.60ghi789 78k 23k 101k $1.52Seeing the numbers changed everything. My “expensive” sessions were the ones where I was debugging complex issues with multiple tool calls. My cheap sessions were simple code reviews.
Why This Matters
Data beats anxiety. With actual numbers, I could:
- Know which workflows consume tokens
- Optimize expensive patterns
- Budget accurately
- Stop guessing about costs
Before ccusage, I worried about costs constantly. After seeing real data, I realized my daily spend was $3-5 for productive work. That’s cheaper than my coffee habit.
The Criticism (And Why It’s Partially Valid)
One Reddit user called ccusage “overrated, just another standard token dashboard.” They wanted session management features, not just visibility.
Valid point: ccusage shows data but doesn’t manage or close old sessions.
My approach: Use ccusage for visibility + manual session management for control.
Close old Claude Code windows regularly. Check ccusage before and after heavy workflows. Identify expensive patterns by comparing sessions.
What I Discovered About My Usage
After running ccusage for a week, patterns emerged:
- Long context windows cost more - Sessions with 100k+ context used 3x more tokens
- Tool-heavy sessions spike costs - Multiple file operations, web searches, and code execution added up
- Simple queries were cheap - Code reviews and explanations cost pennies
- Leaving windows open didn’t matter - It’s the active tokens, not idle time
Export Data for Analysis
# Export to CSV for spreadsheet analysisccusage --export csv --output usage-report.csv
# Verbose mode shows tool breakdownccusage --verboseThe verbose mode showed which tools consumed most tokens in each session. Web searches and image analysis were my biggest costs.
Common Mistakes to Avoid
Complaining about costs without measuring first
I did this. Then I measured and felt silly.
Leaving sessions open indefinitely
Not because idle time costs money (it doesn’t), but because you lose track of which session did what.
Not correlating high-cost sessions with specific workflows
Run ccusage —verbose after expensive sessions to see what drove the cost.
Assuming all token usage is equal
Input tokens cost less than output tokens. Know the difference.
The Minimal Cost Tracking Setup
My current workflow:
- Morning: Run
ccusage --todayto see yesterday’s spend - Before heavy task: Note session ID
- After heavy task: Run
ccusage --lastto see impact - Weekly: Run
ccusage --weekfor total spend
Total time investment: 2 minutes per day.
Total anxiety reduction: Massive.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
- 👨💻 Best GitHub Repos for Claude Code 2026 - r/ClaudeCode Discussion
- 👨💻 ccusage - Claude Code Token Usage Tracker
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments