Skip to content

skipguy/claude-usage-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claude-usage-tracker

"How much of my Claude Pro have I burned today?" — you, probably, at 2am

A no-nonsense terminal dashboard for tracking Claude Code token usage on Linux. Because the macOS menu bar app is great, but some of us don't own a MacBook.

╭─────────────────────── 5-Hour Session ───────────────────────╮
│  Model              Input   Output   Cache R   Cache W   Cost │
│  ─────────────────────────────────────────────────────────── │
│  claude-sonnet-4-6   3.7K   124.9K   10.46M   312.4K  $6.19  │
│  TOTAL               3.7K   124.9K   10.46M   312.4K  $6.19  │
╰──────────────────────────────────────────────────────────────╯

(yes, those are the real numbers from building this tool)


What it does

  • Shows token usage across 5h session / 24h / 7 days / all-time
  • Breaks down by model (Sonnet, Opus, Haiku)
  • Estimates USD cost using Anthropic's published pricing
  • Daily table — see which day you went absolutely feral
  • Watch mode — live refresh every N seconds
  • Reads directly from ~/.claude/projects/no API calls, no auth, no internet

Requirements

  • Linux (any distro)
  • Python 3.9+
  • Claude Code CLI — must be installed and used at least once

Install

git clone https://github.com/skipguy/claude-usage-tracker.git
cd claude-usage-tracker
bash install.sh

The installer finds the right Python on your system, installs rich, and drops a claude-usage command into ~/.local/bin.

Add to PATH if needed:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc

Usage

claude-usage                # summary: 5h / 24h / 7d / all-time
claude-usage --daily        # + per-day breakdown for last 14 days
claude-usage --watch 30     # refresh every 30 seconds
claude-usage --plain        # no colors, good for scripts/pipes

How it works

Claude Code saves every conversation as JSONL files in ~/.claude/projects/. Each assistant message has a usage block with exact token counts. This tool reads those files, aggregates by time window and model, and calculates cost.

That's it. No session cookies. No reverse engineering. No Cloudflare fights.

Cost reference

Model Input Output Cache Read Cache Write
Opus 4.x $15.00 $75.00 $1.50 $18.75
Sonnet 4.x $3.00 $15.00 $0.30 $3.75
Haiku 4.x $0.80 $4.00 $0.08 $1.00

Prices per million tokens. Check anthropic.com/pricing for updates.

FAQ

Why not the macOS app? hamed-elfayome/Claude-Usage-Tracker is excellent but requires macOS 14+. This is for the rest of us.

Does it show the actual Pro rate limit (5-hour window %)? Not yet — that requires authenticating against claude.ai which Cloudflare blocks from scripts. This shows raw token counts instead, which is arguably more useful.

The cost estimate seems wrong. It's an estimate based on the API pricing model. Claude Pro/Max subscribers pay a flat subscription, not per-token — but this tells you what equivalent API usage would cost, which is a useful proxy for how hard you're pushing the limits.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors