Analyze Claude Code token consumption and estimated costs across projects and sessions. Use when user asks about token usage, costs, spending, billing, how much they've used, or wants to optimize their Claude Code usage patterns.
Analyze token consumption patterns and estimate costs from Claude Code session files (~/.claude/projects/).
Run the analyzer with a time range argument:
python3 .claude/skills/token-usage/scripts/analyze.py $ARGUMENTS
| Argument | Example | Description |
|---|
| (empty) | All time | |
today | today | Since midnight UTC |
week | week | Last 7 days |
month | month | Last 30 days |
| N (number) | 3 | Last N days |
| Date | 2026-04-01 | Since that date |
| Datetime | 2026-04-01 11:00 | Since that datetime |
--compare — show current period vs previous period of same lengthExample: --compare week shows this week vs last week.
The script prints a summary to stdout and saves a detailed report to:
~/.claude/token-usage-reports/token_report.md
Prices are per million tokens, detected automatically per model:
| Model | Input | Cache Create | Cache Read | Output |
|---|---|---|---|---|
| Opus | $15.00 | $18.75 | $1.50 | $75.00 |
| Sonnet | $3.00 | $3.75 | $0.30 | $15.00 |
| Haiku | $0.80 | $1.00 | $0.08 | $4.00 |
The analyzer reads the model field from each assistant message and applies correct pricing automatically.
--compare)~/.claude/projects/)