A Claude Code plugin that tracks token usage and dollar costs across sessions.
- Automatically records token usage (input, output, cache) per session
- Calculates costs using bundled model pricing
- Tracks per-project usage
- Aggregates by day and week
claude plugin add robbedoo/claude-token-tracker/token-tracker:token
Displays a summary like:
╭────────────────────────────────────────────────╮
│ Claude Token Tracker │
├────────────────────────────────────────────────┤
│ Today 42,300 tokens $1.85 (2 sess) │
│ Week 318,000 tokens $12.40 (9 sess) │
├────────────────────────────────────────────────┤
│ By model (week): │
│ opus-4-6 $11.20 (90%) │
│ sonnet-4-6 $1.20 (10%) │
├────────────────────────────────────────────────┤
│ Project: cresly │
│ Today $1.85 • Week $8.60 │
╰────────────────────────────────────────────────╯
- SessionStart hook snapshots
~/.claude/stats-cache.json - SessionEnd hook diffs the snapshot against the current state
- Cost is calculated per model using bundled pricing
- Session record is appended to
~/.claude/token-usage.json /token-tracker:tokenreads the store and prints a formatted summary
All data is stored locally in ~/.claude/token-usage.json. Nothing is sent externally.
Model pricing is bundled in config/pricing.json. When Anthropic updates prices, install the latest plugin version:
claude plugin update token-trackerOr manually edit the pricing file in the plugin cache.
claude plugin remove token-trackerThe data file (~/.claude/token-usage.json) is preserved after uninstall. Delete it manually if you want to remove all data.
- Claude Code CLI
- Node.js (already required by Claude Code)
MIT